Porting quake2 (work in progress)


18 posts
by reefab » Sun Jul 01, 2012 9:33 am
I'm currently trying to port Quake2, with some limited success.

I'm basing the port on the https://github.com/yquake2/yquake2/tree/opengl_es port.

What works:

    - Build
    - Link
    - Launch
    - Display initial demo


What doesn't work yet:

    - Input
    - Correct screen resolution
    - Sound (Alsa driver issue)

So, so far, when I launch it, it display a 320x240 "window" halfway down the screen on the left side, with the initial rolling demo. The console (the linux fb console, not the internal quake 2 one) is still displayed on top of it and it has the keyboard input meaning that I can't access the menu yet or actually play the game.

It seems to create a correctly sized "window" at the beginning but then restart the rendering subsystem and get reverted to 320x240 for some reason.

There is also some graphical bugs, some of them I've managed to workaround by disabling some effects in the configuration.

I'm hitting a roadblock in fixing those issues, I'm not familiar enough with the quake 2 codebase and/or the Raspberry specific opengl es/EGL to figure it out.

I'm investigating the quake 3 port to check if using SDL to initialize the display is the way to go instead of doing it "natively" as in the included opengl es 2 example.

I posted the port so far in: https://github.com/reefab/yquake2/tree/raspberry
Posts: 5
Joined: Sun Jul 01, 2012 9:11 am
by dom » Sun Jul 01, 2012 12:09 pm
reefab wrote:I'm investigating the quake 3 port to check if using SDL to initialize the display is the way to go instead of doing it "natively" as in the included opengl es 2 example.

Note in Quake 3, SDL is only used to get keyboard/mouse input.
You can remove all the SDL and the openGL ES will still function correctly.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5041
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by reefab » Sun Jul 01, 2012 12:54 pm
Thanks, I'll check how to grab the mouse/keyboard using SDL even if I don't use it for display.

In the meantime, I've made some good progress: I've fixed the "postal stamp" display (that was actually hardcoded for the Wiz and Cannoo consoles) and the TTY being displayed on top of the es display.

Here is a video: http://youtu.be/Hw_zGdoNGrU

It can now run "fullscreen" and doesn't have the geometry occlusion mode I had before.

There is some weird ray/yellow triangles for some reasons that seems to be slowing it down quite a bit and I had to disable the screen flashes but it seems ok otherwise for the graphical part.
Posts: 5
Joined: Sun Jul 01, 2012 9:11 am
by reefab » Sun Jul 01, 2012 3:24 pm
I fixed the remaining issues and it's now quite playable.

https://github.com/reefab/yquake2/tree/raspberry
Posts: 5
Joined: Sun Jul 01, 2012 9:11 am
by Narishma » Sun Jul 01, 2012 3:24 pm
This code review might be helpful to familiarize yourself with Quake 2's code base.
Posts: 151
Joined: Wed Nov 23, 2011 1:29 pm
by danboid » Sat Jul 28, 2012 1:23 pm
Hi reefab!

I was happy to hear you got GLES working under Q2 on your Pi as I'm trying to do the same with Q2 but on the Pandaboard. You can see where I'm up by reading the last few posts in this thread:

http://www.gp32x.com/board/index.php?/t ... o-and-wiz/

I have tried downloading the code from your git repo but I just get this error:

git clone https://github.com/reefab/yquake2/tree/raspberry
Cloning into 'raspberry'...
fatal: https://github.com/reefab/yquake2/tree/ ... /info/refs not found: did you run git update-server-info on the server?

So would it be possible to fix that repo or put the code up elsewhere?

I'm also very keen to get Q3 running with OGLES on my Pandaboard but I've not been able to find a working repo, at least not one that works with rq3 (reaction quake 3) as I don't own Q3. I've tried

https://github.com/raspberrypi/quake3

But that requires lots of odd libs not in Ubuntu and that I doubt I even need to run it on my Pandaboard. I found a linaro tree of an ioquake3 GLES port which built but I can't get it to load rq3 and I've not had any response of its maintainer yet.

Thanks for your help!

Dan
Posts: 15
Joined: Sat Jul 28, 2012 1:07 pm
by 7F20 » Sun Aug 05, 2012 9:19 pm
I have been using darkplaces for years and I have had the best experience with it. here is the site if you don't already know. http://icculus.org/twilight/darkplaces/

There is a linux verision already, but I don't know what it would take to compile it for arm, or to optimize it for the pi.

Just throwing this out there because I haven't seen it mentioned. :D
User avatar
Posts: 30
Joined: Tue Jul 24, 2012 2:45 am
Location: New York
by danboid » Sun Aug 05, 2012 9:39 pm
Posts: 15
Joined: Sat Jul 28, 2012 1:07 pm
by SSilver2k2 » Tue Aug 07, 2012 1:32 am
Compiled Quake2 today and got it working on my Pi. It's playing great. So many memories playing this game!
My blog of various geeky things - http://blog.sheasilverman.com
PiPLAY - http://piplay.org
DeskCade.com - Mini Raspberry Pi Arcade Cabinet
Posts: 179
Joined: Wed Jun 06, 2012 1:51 am
Location: United States
by texy » Tue Aug 07, 2012 6:31 am
Great! Waiting for your blog update with instructions ;)
Whats the framerate like?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4883
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by SSilver2k2 » Tue Aug 07, 2012 5:58 pm
The framerate is really all over the place. Still playable though. You really need to use the yq2.cfg file to get it playable on the Raspberry Pi. Without it, my board would run REALLY hot, framerate would be low, and then it would eventually crash. Using the second config file it can run the intro loop with no issues.

texy wrote:Great! Waiting for your blog update with instructions ;)
Whats the framerate like?

Texy
My blog of various geeky things - http://blog.sheasilverman.com
PiPLAY - http://piplay.org
DeskCade.com - Mini Raspberry Pi Arcade Cabinet
Posts: 179
Joined: Wed Jun 06, 2012 1:51 am
Location: United States
by SSilver2k2 » Wed Aug 08, 2012 2:25 am
And the precompiled binaries / instructions are now up on my site:

http://blog.sheasilverman.com/2012/08/r ... i-quake-2/

Thanks to Reefab for all the hard work that has been put into this.
My blog of various geeky things - http://blog.sheasilverman.com
PiPLAY - http://piplay.org
DeskCade.com - Mini Raspberry Pi Arcade Cabinet
Posts: 179
Joined: Wed Jun 06, 2012 1:51 am
Location: United States
by tulblut » Fri Aug 10, 2012 10:12 pm
I tried your binaries launching them (without X) but I have this error:

ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
Loading plaque timed out.

Backtrace:
Segmentation fault

and then I return to the prompt.

I understand that it has some sound issues, can I run it disabling ALSA?
Posts: 11
Joined: Fri Aug 10, 2012 10:07 pm
by reefab » Sun Aug 12, 2012 7:27 am
danboid wrote:I have tried downloading the code from your git repo but I just get this error:

git clone https://github.com/reefab/yquake2/tree/raspberry
Cloning into 'raspberry'...
fatal: https://github.com/reefab/yquake2/tree/ ... /info/refs not found: did you run git update-server-info on the server?

So would it be possible to fix that repo or put the code up elsewhere?



Hi danboid,

The "https://github.com/reefab/yquake2/tree/raspberry" is the url for the project page, not the git repository, you'll want to use this instead: https://github.com/reefab/yquake2.git

I put all the PI specific code in "USE_PI" blocks, you'll probably need to change the initialization part as I don't think the Pandaboard uses videocore.
Posts: 5
Joined: Sun Jul 01, 2012 9:11 am
by reefab » Sun Aug 12, 2012 7:30 am
tulblut wrote:I tried your binaries launching them (without X) but I have this error:

ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
Loading plaque timed out.

Backtrace:
Segmentation fault

and then I return to the prompt.

I understand that it has some sound issues, can I run it disabling ALSA?


You can add "set s_initsound 0" in the yq2.conf to disable sound.

It used to work, quite badly (very crackly), but sound didn't make it crash, at least using the analog audio output.

Are you using HDMI for sound output or the analog one?
Posts: 5
Joined: Sun Jul 01, 2012 9:11 am
by tulblut » Sun Aug 19, 2012 9:15 am
Yes, I'm using HDMI.
Without audio it works fine.
It has apparently some problems with the hud, but it's playable and very smooth.
Thank you! ;-)
Posts: 11
Joined: Fri Aug 10, 2012 10:07 pm
by Tirpitz » Sat Feb 02, 2013 11:31 am
I tested this on my Raspberry Pi. I use normal monitor connected by DVI and speakers are connected by jack. I do not have sound. Also I have issue with mouse. I cannot turn around, I am limited only to about 90 degrees.
Posts: 27
Joined: Thu Aug 02, 2012 5:55 pm
by Pickle » Wed Sep 04, 2013 2:45 am
I updated my port which this was based on. Check it out here:
viewtopic.php?f=78&t=54683
Posts: 64
Joined: Tue Sep 20, 2011 5:09 pm