Slashdot Mirror


Quake 3 For Android

An anonymous reader writes "Over the last two months I ported Quake 3 to Android as a hobby project. It only took a few days to get the game working. More time was spent on tweaking the game experience. Right now the game runs at 25fps on a Motorola Milestone/Droid. 'Normally when you compile C/C++ code using the Android NDK, the compiler targets a generic ARMv5 CPU which uses software floating-point. Without any optimizations and audio Quake 3 runs at 22fps. Since Quake 3 uses a lot of floating-point calculations, I tried a better C-compiler (GCC 4.4.0 from Android GIT) which supports modern CPUs and Neon SIMD instructions. Quake 3 optimized for Cortex-A8 with Neon is about 15% faster without audio and 35% with audio compared to the generic ARMv5 build. Most likely the performance improvement compared to the ARMv5 build is not that big because the system libraries of the Milestone have been compiled with FPU support, so sin/cos/log/.. take advantage of the FPU.''

15 of 137 comments (clear)

  1. DUDE You're incredible by linhares · · Score: 5, Funny

    Team fortress by any chance? Steal the code, kill people, I can help with whatever task is needed.

  2. Hmmm. by Anonymous Coward · · Score: 5, Informative

    Dunno why TFA didn't include it, but there is video.

    1. Re:Hmmm. by ionix5891 · · Score: 3, Informative

      doesnt work on Nexus One

  3. Re:Where's my flying car?! by pipatron · · Score: 3, Informative

    Hm? Quake 3 has been available for my Nokia since 2007 or 2008 or something.

    --
    c++; /* this makes c bigger but returns the old value */
  4. I wonder how fast... by dvh.tosomja · · Score: 5, Funny

    > Quake 3 optimized for Cortex-A8 with Neon is about 15% faster without audio

    I wonder how much faster it will be without video

  5. Re:Not impressed by Beelzebud · · Score: 4, Insightful

    Yeah and that is Epic Software doing that. They aren't exactly a hobbyist working without pay...

  6. What about the N900? by anomnomnomymous · · Score: 4, Interesting

    The N900 has also recently received a port of IOQuake3: Have a look at their site for more details.

    If you're looking for a very nice (open) phone, I'd go with the N900. No, I'm not from Nokia, just a -very- satisfied customer.

    --
    When you shoot a mime, do you use a silencer?
    1. Re:What about the N900? by kamapuaa · · Score: 4, Informative

      If you read the article (I know, I know...) this is actually based on the N900 port.

      --
      Slashdot: providing anti-social weirdos a soapbox, since 1997.
  7. Re:Not impressed by Anonymous Coward · · Score: 4, Informative

    If that is "Unreal 3", then it's a very, very stripped down version. It doesn't even look like it has pixel shaders, which removes all benefit to using it over the Quake III engine.

    By the way, the Quake III engine is capable of handling visuals that look better than the screenshots you linked to. Here are a few examples of what the Quake III engine can do.

    http://www.szico-vii.com/uploads/photos/16.jpg
    http://www.szico-vii.com/uploads/photos/17.jpg
    http://www.szico-vii.com/uploads/photos/31.jpg
    http://www.szico-vii.com/uploads/photos/42.jpg

  8. Re:Just another note: by Thunderbird2k · · Score: 3, Informative

    On my project page I mention that Android 1.6 is required since I used the Android 1.6 NDK (previous versions didn't support OpenGL).

  9. Re:Running Demos by Thunderbird2k · · Score: 4, Informative

    Demos should run well but from the main menu they don't work for some reason. During development I always ran them from the quake3 console (so 'demo four') and that works fine.

  10. Re:How about integers instead of floating point? by Sasayaki · · Score: 3, Informative

    I don't know anything about the code either, but I can take a stab.

    The angles aren't actually the problem, the real problem is points on a Cartesian plane (x and y coordinates)... but angles suffer from the same thing that is the real problem. I'll explain as simply as I can (even for experienced programmers and mathematicians, I have found simple to be better, so don't take that the wrong way).

    The exact location of every 3D object in a game is represented by X, Y and Z coordinates. These are currently stored in floating point, so that something can be at x=.5 and be comprehensible to the engine. This means that the object can be almost anywhere without rounding to an integer.

    Your idea is that basically with small enough points, the player would be unable to tell the difference. While it's true that with tiny enough points this may be true, one of the big issues is movement within a 3D world. Essentially, the movement is something like this:

    Your current position is (0,0) facing 0 degrees. You are getting 60 FPS. You press the forward key, moving north.

    New X Coordinate = old_X + time * Sin(angle) = 0 + .3 + 1 microsecond * 0 = 0
    New Y Coordinate = old_Y + time * Cos(angle) = 0 + .3 + 1 microsecond * 1 = 1

    You are now at (0,1), which is as you'd expect. Let's mess things up a bit.

    Your current position is (3, 6) facing 146 degrees. You are getting 34 FPS. You push the forward key, moving at the angle 146.

    New X Coordinate = old_X + time * Sin(angle) = 3 + 0.566666667 * .75011107 = 3.42506294
    New Y Coordinate = old_Y + time * Cos(angle) = 6 + 0.566666667 * 0.661311865 = 5.62525661

    See what's starting to happen here? Floating point representations of coordinates are vital to preserving the object's exact coordinates. If you used ints for these values, you'd be forced to round and lose a lot of precision. That adds up, especially when these calculations are being performed every 34 seconds. The model would 'jitter' and seem to be very slightly spasming, which would look terrible. Unfortunately floating point numbers are required here.

    --
    Check out my sci-fi book "Lacuna" at http://goo.gl/MVxX8
  11. Re:Kudos! by jo42 · · Score: 3, Informative

    Actually, with Xcode and iPhone OS you do not have to jump through all the hoops this guy did. GCC in Xcode generates ARM6 or ARM7, Thumb or non-Thumb code - no futzing with compilers, tools or worrying about taking advantage of the hardware FPU. You can also mix Objective C, C, C++ code and libraries with very little effort - no Java to NDK-level and back calling BS. Stuff like this is easier, NOT harder, on iPhone OS.

  12. Re:How about integers instead of floating point? by Jenny+Z · · Score: 3, Informative

    You can still use integer math to represent fractional values. For example, using the upper 16 bits as the integer part, and the lower sixteen as the fractional part.

        Something like this only implemented with inline assembly:

    Int32 fMult( Int32 a, Int32 b)
    {
          return (Int32) (((Int64) a * (Int64) b)>>32);
    }

    You don't have nearly the dynamic range of floating point, but you *can* implement rotation matrices, vectors, time and distance and physics calculations. You just have to be careful to keep the values in range.

  13. Re:How about integers instead of floating point? by jgostling · · Score: 4, Insightful

    Unfortunately floating point numbers are required here.

    Not quite. When doing this stuff on a platform with limited or non existent floating point support you can always use fixed point arithmetic.

    Cheers!