Wolfenstein 3D—yes, that Wolfenstein 3D—has been a member of the open-source community since programmer and visionary John Carmack tossed the code out into the open in 1995. That’s not news. What is news is his successful attempt at converting the first-person-shooter, practically old enough to have run on punch cards, onto a next-generation mobile platform. The evil Nazis are now Apple-friendly, and you can get the iPhone version of Wolfenstein 3D for a mere $5 from Apple’s application store.
And how did he do it? Carmack didn’t just go back and start hacking into the Borland C and TASM code of the original title. In a sense, he branched his own game. Turning to an open-source variant called Wolfenstein 3D Redux , Carmack used this Wolfenstein OpenGL retrofit as the graphical basis for his mobile release.
As Carmack details in an extensive post on the official Wolfenstein 3D site , jumping from a DOS environment to the iPhone came with a few design and technical challenges. For starters, he had to consider just how true to the original he wanted the new mobile game to remain. The level designs and sprites are all the same between the two versions, as are the included power-ups, weaponry, and enemies. The UI has been completely retrofitted to fit a mobile device, with directional and firing controls occupying the two lower corners.
There's no strafe button, but tilt support has been built into the title for those that don't mind looking like they're performing a gymnastics routine just to escape a Nazi castle. All doors are now of the "walk by it and it opens" variety, and the older concept of player lives and a running score has been replaced by Doom-style percentages of a player's level completion stats.
Beyond that, Carmack made multiple improvements to the code to translate the original Wolfenstein 3D's drawing functionality and ray casting into an iPhone-friendly format. Why's that? He found that later levels in the game that featured a number of displayed items combined with wide, open spaces would destroy an iPhone's frame rates based on how the screen was drawn in the original release.
Carmack also bounced back and forth between slapping OpenGL compatibility on the core Wolfenstein code or using the modified Redux project alongside a few hacks of his own. He ended up opting for the latter, hand-coding in new elements like loading and saving for the mobile release. His workarounds... work, but the code itself isn't as tight as Carmack would have preferred: "I'm still not positive if this was the right call, since the codebase is sort of a mess with lots of vestigial code that doesn't really do anything, and I don't have time to clean it all up right now," he says.
Technical details aside, the full source code for Wolfenstein 3D mobile is available on Id's site. Although Carmack doesn't think that an average user would be able to download and compile the code in an effort to escape the $5 purchasing fee, it's already been done. If you're sporting a jailbroken iPhone, you can fire up the Cydia installer and grab the exact same, $5-on-the-app-store game yourself. And there's nothing Carmack himself can do about it, as the software is completely legal to download. But that's assuming that he wants to do something about it.
Although that news might not bode well for his bank account, Carmack nevertheless hopes that the release of the source code alongside the commercial application will help spawn a bunch of derivative Wolfenstein projects. In a perfect world, Carmack expects enterprising developers to bolt their own add-ons and updates onto Wolfenstein 3D mobile. And as they link back to the original, and Id links to them, Carmack expects a giant Wolfenstein community to take off--just like one of his rocketship projects. "That should turn out to be a win for everyone," he says.