Slashdot Mirror


Code Review of Doom For the iPhone

Developer Fabien Sanglard has written a code review for id Software's iPhone port of Doom. It's an interesting look into how the original 1993 game (which he also reviewed to understand its rendering process) was adapted to a modern platform. "Just like Wolfenstein 3D, Doom was rendering a screenframe pixel per pixel. The only way to do this on iPhone with an acceptable framerate would be to use CoreSurface/CoreSurface.h framework. But it is unfortunately restricted and using it would prevent distribution on the AppStore. The only solution is to use OpenGL, but this comes with a few challenges: Doom was faking 3D with a 2D map. OpenGL needs real 3D vertices. More than 3D vertices, OpenGL needs data to be sent as triangles (among other things because they are easy to rasterize). But Doom sectors were made of arbitrary forms. Doom 1993's perspective was also faked, it was actually closer to an orthogonal projection than a perspective projection. Doom was using VGA palette indexing to perform special effect (red for damage, silver for invulnerable...)."

12 of 161 comments (clear)

  1. Re:Already done by VShael · · Score: 5, Funny

    did you even read the article?

    You must be new here...

  2. Pushing pixels by MtHuurne · · Score: 4, Interesting

    Forgive my ignorance, but couldn't you have the original software renderer write to an in-memory buffer and then upload that using glTexSubImage2D()?

    1. Re:Pushing pixels by RedK · · Score: 4, Interesting

      glDrawPixels is not supported under OpenGL ES which is what the iPhone uses. An in-memory buffer used as a texture is about the only way for fullscreen images (vertex arrays drawn using GL_POINTS is another solution but would not be fast enough).

      --
      "Not to mention all the idiots who use words like boxen."
      Anonymous Coward on Monday August 04, @06:49PM
  3. Classics never die by adosch · · Score: 5, Insightful

    I remember playing Doom in the mid-90's on my friend's Gateway 2000 Pentium 100Mhz. I still play it to this day from time to time (openGL port on Linux). It's mindless, self-indulging, gory, non-challenging (now, not then!), and it's becoming one of timeless those FPS games that won't die because it's story line is simple and not drug out, you're thrown right into the mix and you can keep your objective as simple as you want: Make it to the end of the map.

    1. Re:Classics never die by Hadlock · · Score: 4, Funny

      DOOM was a good game but it wasn't ground breaking in the same way that Quake was a few years later. It was the first FPS to do real 3D, and gave birth to real FPS competitive play, based on the groundwork that DOOM did with FPS LAN play. Aside from that, the Quake engine led to all sorts of interesting gamemodes and mods that live with us still (Team Fortress was originally a Quake mod), and the physics of Quake 1 still has a legacy today (rocket jumping, bunny hopping).

      You sir, have a career in video game blogging! Let me sign you up for a 3000 word "Top 10 Groundbreaking games of the 1990s" blog entry.

      --
      moox. for a new generation.
    2. Re:Classics never die by Antiocheian · · Score: 5, Insightful

      The groundbreaking REAL 3d game was Ultima Underworld. Amazing story, great music and paced to the action (due to midi synthesis) and total 3d immersion.

      Pay your respects to Looking Glass.

  4. He's wrong though by Anonymous Coward · · Score: 5, Interesting

    Doom 1993's perspective was also faked, it was actually closer to an orthogonal projection than a perspective projection

    Not remotely true; DOOM's perspective is/was perfectly correct (apart from the monsters being billboards, of course - but they were perspective-correct billboards).

    The method for achieving perspective is rather unconventional, but the maths works out the same.

    Matching up floor and ceiling in an animated view with fake perspective is basically impossible.

    [I did a port of DOOM before it was open-source, so I know a thing or two about this.]

    1. Re:He's wrong though by Anonymous Coward · · Score: 5, Informative

      You are correct. What TFA probably means is that walls, floors and ceilings are drawn in strips, and that for every strip all the texels are looked up according to a straight line. But that doesn't mean at all that hence Doom just uses an orthogonal projection, since it actually let's things diminish in the distance properly. A lot of real three dimensional games actually linearised texel lookup, but that says nothing at all about the overall projection a game uses. If you want to know what an orthogonal projection looks like, go play Age of Empires. As an added comparison, take a look at Mode 7 tricks on the SNES. You can actually perspectively correctly display a flat surface on it. How is this done? By setting a different orthogonal projection for each (in this case horizontal) line. That does not mean however that games using this therefore use an orthogonal projection, because the parameters are different for each scanline and the overall projection is perspective.

  5. What's with this CoreSurface licensing restriction by mikelieman · · Score: 4, Insightful

    The only way to do this on iPhone with an acceptable framerate would be to use CoreSurface/CoreSurface.h framework. But it is unfortunately restricted and using it would prevent distribution on the AppStore.

    Now this is what really annoys me. Here are tools. Appropriate tools. But you aren't allowed to use the tools, because what you're going to use them for offends The Gods.

    What was that RMS was saying again?

    --
    Technology -- No Place For Wimps! Grateful Dead and Jerry Garcia Chatroom -- http://www.wemissjerry.org
  6. Re:I'd like to read this article by slim · · Score: 4, Informative

    You need the Readability bookmarklet.

  7. Re:What's with this CoreSurface licensing restrict by slim · · Score: 4, Insightful

    What was that RMS was saying again?

    Don't bring attention to RMS's pragmatism. It confuses those who prefer to think of him as a hippy.

  8. Re:What's with this CoreSurface licensing restrict by Fahrvergnuugen · · Score: 4, Interesting

    Disallowing the use of private APIs ensures that your software will continue to function with new versions of the iPhone OS. The private APIs might change, but the public ones will not. The real questions is whether or not there should be a public API for CoreSurface.

    --
    Kiteboarding Gear Mention slashdot and get 10% off!