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...)."
Doom was ported to OpenGL a long time ago.
Forget magic. Any technology distinguishable from divine power is insufficiently advanced.
Forgive my ignorance, but couldn't you have the original software renderer write to an in-memory buffer and then upload that using glTexSubImage2D()?
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.
I thought it was "Code Review of Doom" for the iPhone not "Code Review" of "Doom for the iPhone".
I've seen some "code reviews of doom". I was looking forward to some juicy ApplePain.
Oh well.
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.]
But it won't fit on a 800 pixel wide screen. WTF? I thought it was a code review, not a flash game.
"You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
idspispopd
This isn't a "code review" -- it's a short monograph (with Quicktime movies!) that talks about how Id got DOOM working well on the iPhone. A "code review" is, well, a critique of code, and the style, correctness, and efficiency, thereof.
</pedant>
Cantankerous old coot since 1957.
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
Heh, I remember playing Doom in my uncle's computer back in 94 as as 9 year old boy, and loved it, adored it.
16 years later, now an employed programmer, I still think it is made of black sorcery and an ingenious amount of coding. That's awesome!
Does Carmack /id Soft have a donation paypal-esque account? I'd love to give them what is due for all those early years of pure fun.
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.
So when can I expect Counterstrike for my iPhone?
idspispopd
Somehow I don't see that being easy to enter on an iphone while playing doom...
Although the important one was really IDKFA
Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
The Sony Ericson P800 and the Motorola A920 had Doom ports that were very true to the Doom experience... in 2003.
As an unlocked A920 user, there is very little on the iPhone that I didn't see on that device. Apple's real accomplishment has been wrestling control away from the carriers who {locked down/disabled/walled gardened/made crappy} all of the devices that they sold.
I am happy for what Apple has done. It has allowed me to buy a Motorola Droid from Verizon without all of the restrictions it would otherwise have had.
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!
Doom as a general game as cool. Doom as a multiplayer/deathmatch game was freaking incredible at the time.
While the whole "pixel 3d" theme may not have been new, I don't recall any other games of the like that were LAN'able or could be played on a 9600 baud modem.
Maybe there were some, but I don't remember any.
Yea...But no. I appreciate their decision to limit their supported frameworks: it's basically the same decision as a console makers. They want a stable, easy to support platform that is still robust enough to allow people to do interesting things.
It's not their job to support every conceivable framework. It's your job to develop within the boundaries that they've set, same as people have been doing with consoles and embedded devices for years.
ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
What was that RMS was saying again?
I don't remember, I was too busy watching him while he was talking.
Doom was groundbreaking in ATMOSPHERICS. Come on, in the second level that corridor with the lights out except the bust light flickering down the bottom with (unbeknownst to you at the time) Imp just out of sight under it?
Atmospheric.
Quake brought us Brown.
If it is considered groundbreaking, then the ground it broke was one that gave us Ubuntu.
It also, unlike Quake (and not repeated again until Serious Sam), gave us HORDES of enemies. Better yet, they'd start fighting. One much later level had a diagonal corridor that had the walls drop and scores of various demons were hiding. You ran through and the Imp missiles hit Cacofiends or whatever and they became pissed off, fighting Imps. Meanwhile, other monsters got in the crossfire and THEY got pissed off.
If you were careful in your aim, you could get rid of them all and only have had to shoot a handful of them. Just don't miss 'cos that might spoil the personal barney going on between two demons, who hate you more than they hate each other.
Tactical too.
Quake? No. Quake 2 got a lot closer in playability and lost the brown mostly.
I think this is how I'll start referring to ALL my code reviews ;-)
smashing pumpkins into small piles of putrid debris?
Jump using accelerometer!
Just like the unintentional Nintendo and Mario Bros. Which they should seriously do by the way!
That's a fine hack, well done old chap.
All those moments will be lost in time, like tears in rain.
A long time ago, I ported Quake 3 to windows mobile. Tedious, but it worked reasonably at around 30fps (and deathmatch worked) with OpenGLES acceleration on the Dell Axim x50v enabled with the intel 2700g coprocessor. The code is still out there, but frankly, it wouldn't be kosher for me to push a copy of Quake 3 to the iphone store since i dont have copyright access to the 'assets' of the game and i dont need to get sued or something.
it's a bit useless to gpl your game and not the assets. If iD software wants to use the code for a quake 3 for iphone, they can do so at http://code.google.com/p/q3ce/source/checkout. Should save them some time. Open invite, go right ahead, i can't do anything with it these days anyway.
(and yes, i converted the whole thing from floating point to fixed point using some fun c++ templates, poke around the code to see how it works, it's kinda neat.)
Did someone else read the word "doom" in the title out of context?
idspispopd
Somehow I don't see that being easy to enter on an iphone while playing doom...
Wasn't easy to enter on a keyboard while playing Doom. Hell, wasn't easy to remember (I'd need to recite the full name and use that as a mnemonic). Made worse because usually you had to type it twice in fairly quick succession. All likely reasons for why it was changed to IDCLIP for Doom 2.
From the headline, I was expecting a story about the code for the iPhone being put under the microscope of a top-to-bottom review -- you know, "The Code Review of Doom".