Topic: Quake on the Chumby

I've finally gotten Quake for the Chumby to a workable state.  The source (sdlquake and SDL) are available at http://files.chumby.com/hacks/chumby_quake_src.tar.gz .  A dongle image, ready to be extracted, is available for download at http://files.chumby.com/hacks/chumby_quake.tar.gz

You control it by tilting the Chumby.  When sitting on your desk, it shouldn't move too much.  Squeeze to shoot, tap to jump, unplug to quit.

A bit about how I did the build:

For starters, I used the Snapgear toolchain.  It has everything compiled with soft-float support.  Without soft-floats, I was getting framerates of <1 FPS.  The Snapgear toolchain can be found at http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/

Then, I configured ALSA with ./configure --build=i386-linux --host=arm-linux --prefix=/usr/local/arm-linux --enable-static=yes --enable-shared=no build_alias=i386-linux host_alias=arm-linux CFLAGS=-msoft-float.  Be sure to apply the Chumby patches or else you'll have choppy audio.

Next I got SDL.  I went with a subversion checkout, making it easy to do see what's changed.

It's configured by running CFLAGS=-msoft-float ./configure --build=i386-linux --host=arm-linux --prefix=/usr/local/arm-linux --enable-alsa --enable-static --disable-oss
--disable-esd--disable-pulseaudio --disable-video-x11 --enable-video-fbcon --disable-alsa-shared

You can easily see all of my ugly, ugly hacks by running "svn diff".  Also, you can see my code droppings from initial attempts where I actually used a USB keyboard and mouse.  I had to mostly rewrite those drivers, so those of you wanting SDL support might want to take a look at those sections.  Also, SDL uses deprecated ALSA calls, which don't get renamed properly when statically compiling.  I manually added __old_ in front of a few of those calls to get it to link right.  There are also a few egregious hacks where, for example, tapping the screen mimics pressing the space bar, because I couldn't get Quake to accept the fact that I wanted MOUSE3 bound to +jump.  Maybe once I've slept more I'll take another look at it.

Finally, Quake itself.  I modified the Makefile by hand to, for example, remove all the x86 .S files, and enable -msoft-float.  I also had it statically link, because we're using soft-float libraries not present on the Chumby.  And I added a few calls manually to the startup code to, for example, adjust the brightness and start on the first map.

Networking doesn't yet work.  This is due to a combination of things, ranging from a bug I found in the Quake BSD code that was causing a segfault, to an issue with not being able to call gethostbyaddr() on localhost, to issues with statically linking.  When I do get that working, I think I'll have a separate build with networking that relies on keyboard/mouse rather than accelerometer/touchscreen/bend sensor.

One more thing: I have a simple touchscreen driver written.  The first SDL program I ported, the Planet Hively music disk, requires an actual pointing device.  To get that mode back, you'll just have to remove the if/elseif/else block around line 1210 on SDL_fbevents.c, and remove line 1253.

I think that's everything.

Re: Quake on the Chumby

HOLY $H!7!!! Very nice! Honestly, when I plugged in my flash drive, I was half expecting a virus to brick my chumby. I was very relieved and excited to see that Quake startup screen. Fantastic work!

Re: Quake on the Chumby

wholy cow batman!
That is awesome and it runs smooth too..
Couple questions-
Is this ment to be played or is more if a challange (to port Quake to anything and everything)?
If it is ment to be played, I can't seem to stop the marine from moving. I assume the accelorometer would know what I am doing, but it doesn't.

DUDE YOU ROCK!!!

Nice work, Matt

Re: Quake on the Chumby

sorry, i'm a newb and not much of a programer ... how do i add it to my chumby?

Re: Quake on the Chumby

Amazing!

telos81 - download the .gz file above. For a win pc I use a program called 7-zip to unpack the files. You'll then have a .tar file you'll have to unpack. Then you just copy the files and folder that's extracted to the root of a flash drive and reboot your chumby.

Re: Quake on the Chumby

Very very good job!!
Is a bit difficult to control but is very easy to "install" and play!

Re: Quake on the Chumby

burkhardi wrote:

wholy cow batman!
Is this ment to be played or is more if a challange (to port Quake to anything and everything)?
If it is ment to be played, I can't seem to stop the marine from moving. I assume the accelorometer would know what I am doing, but it doesn't.

It started out to see if it Could Be Done.  I'd gotten SDL working somewhat, and wanted to see if Quake could be ported.  I tried Doom first, but couldn't get it easily working, mostly because of the strange pointer math iD did that doesn't seem to work so well on the ARM.

Then I wanted to see how much faster soft-floats would be than hard-floats.  Answer: a lot.

It's playable, though the controls are greatly simplified.  The Chumby only has two "buttons", so in order to get more fine-grained control like weapon switching, strafing, or mouselook I'd need to either add regions to the touchscreen that are clickable, or add a gesture recognizer to the accelerometer, or both.

The accelerometer ought to be calibrated such that setting the Chumby on your desk will cause the player to stop moving, or at least not move so much.  I suppose one fix might be to add a dead zone, wherein it zeros out the mouse events.    But then again it's Quake, you shouldn't stop moving wink

Re: Quake on the Chumby

ChumbyLurker wrote:

The accelerometer ought to be calibrated such that setting the Chumby on your desk will cause the player to stop moving, or at least not move so much.  I suppose one fix might be to add a dead zone, wherein it zeros out the mouse events.    But then again it's Quake, you shouldn't stop moving wink

Error behind the headset (ID ten T) I was holding the Chumby like you do for Chumby Ball. I was just looking at Bunnies Blog (it shows your game) and saw that the marine was not moving and snapped to my wrong oriantaion...LOL

Off to kill more baddies...
Thanks, Matt

Re: Quake on the Chumby

Just tried it, seems to work great. Thanks!

Re: Quake on the Chumby

Wow, that is terrific! Can't wait to try it on this weekend. Out of curiosity, what kind of FPS are you getting?

Re: Quake on the Chumby

Wow! It actually works! That even more impressive than it running on my Tapwave Zodiac. (Although not as playable.)

Re: Quake on the Chumby

Classic!

Re: Quake on the Chumby

FPS counter isn't on screen, but there are a few moments (large areas, lots going on at once) where it noticeably becomes choppy.

Re: Quake on the Chumby

techvd wrote:

Wow, that is terrific! Can't wait to try it on this weekend. Out of curiosity, what kind of FPS are you getting?

Here's the results I'm seeing from timedemo, which logs the FPS of the fairly intensive built-in demos:
demo1: 969 frames 107.2 seconds   9.0 fps
demo2: 985 frames 101.9 seconds   9.7 fps
demo3: 1090 frames 124.6 seconds   8.7 fps

Re: Quake on the Chumby

I am seeing a better fps than that in normal use.

Re: Quake on the Chumby

darundal wrote:

I am seeing a better fps than that in normal use.

You know, it really would help if I ran stop_control_panel before running the tests.  Those were run with chumbyflashplayer still running (albeit not doing much.)

demo1: 969 frames  86.0 seconds  11.3 fps
demo2: 985 frames  81.3 seconds  12.1 fps
demo3: 1090 frames 100.0 seconds  10.9 fps

Re: Quake on the Chumby

All I can say is.... WOW!!! Nice job.

Re: Quake on the Chumby

Adding my plaudits - nice work!

I tried compiling your modified SDL using the GNU toolchain from files.chumby.com, but it failed - couldn't find asm_generic/bitops.h. This doesn't seem to be in the toolchain headers but is in the Chumby kernel. Do you have those kernel headers in your include path, or does the SnapGear toolchain have that header? (it is a bit of a large download for me to try on the off-chance).

Out of interest, may I ask why you're using that toolchain? Any significant advantages?

Re: Quake on the Chumby

dozencrows wrote:

Out of interest, may I ask why you're using that toolchain? Any significant advantages?

The biggest advantage by far, and the reason I went through all the trouble to fiddle with it to get it working right, is the -msoft-float option.  Quake came out at a time when the FPU was common, so it relies heavily on floats.  The Chumby doesn't have an FPU, so any floating point calculation triggers an exception, which kicks Chumby into kernel space where it uses the Linux software FPU.  This is why it'll work with the toolchain from files.chumby.com (provided you grab those include files out of the kernel tree,) but you'll get framerates way below 1FPS.

dozencrows wrote:

I tried compiling your modified SDL using the GNU toolchain from files.chumby.com, but it failed - couldn't find asm_generic/bitops.h.

It looks as though it does (I just re-fetched it to verify I hadn't done anything silly do that directory, and it looks good.)  The SnapGear toolchain puts all of the Linux include files like that in /usr/local/arm-linux/sys-include/.

I did make other modifications to the directory, though.  It seems as though compiling with -msoft-float didn't actually cause it to use the soft-float libraries, so I ended up moving everything from /usr/local/arm-linux/lib/soft-float/ to /usr/local/arm-linux/lib/.

Re: Quake on the Chumby

Fantastic work. I am always surprised on how smooth Quake seems to run on low power devices like the chumby (or my iPhone/Treo/etc...)

21 (edited by Ganson 2008-08-30 21:07:56)

Re: Quake on the Chumby

I just added my own video of Quake loading off of a USB dongle on my website along with brief instructions.
http://blog.garrickanson.com/?p=761

Update:
I didn't realize until after making this video that Bunnie had already posted a video of this on his blog here:
http://www.bunniestudios.com/blog/?p=262
Gotta give credit where credit is due!

Re: Quake on the Chumby

how about coding in a usb controller that we can plug in, and play the game?

Re: Quake on the Chumby

Locutus has a nice idea, how about keyboard support or support for a USB controller? Maybe the xbox 360 gamepad if possible, considering the ubiquity of the thing. Oh, and if you can make the application dispense money and gold bars that would be good.

Re: Quake on the Chumby

If you wanted to play Quake with a controller, wouldn't you just play it on a PC? Playing with the tilt sensors is the only thing that would be right on the Chumby.

Re: Quake on the Chumby

The PC doesn't fit into a lot of environments that a Chumby might seem natural in, plus the Chumby is a lot less trouble to just grab and move from place to place. Using the accelerometer is fun as a gimmick for the Chumby, but it gets real old real quick for playing games, or at least for playing games like Quake. Plus, I think I made it clear in my post that I was only half serious about getting a controller working with it (wouldn't mind, but definitely no big issue really).