Porting Quake to the iPhone
The iTunes app store has created a new community of developers that are pushing the limits of what can be done on the iPhone and iPod Touch. Initially, the app store hosted applications and games that were simple in design. Nobody really knew if the iPhone could be considered a true gaming platform. Kevin Arunski and Todd Moore set out on a mission to find out by creating the ultimate test-- A fully functional, hardware optimized, multiplayer port of Quake!
Kevin Arunski started the project by downloading the GLQuake source code from ID Software. His first major breakthrough was getting the Quake demo video playing in portrait mode when the game started. No sound, no networking, no controls, but tons of potential.
Kevin showed his progress to Todd Moore who became very interested in the project. They setup a shared source code repository and divided up the work. Kevin would continue with graphics, sound, and networking while Todd worked on the user interface and player controls.
Quake is heavily dependent on using a keyboard and mouse so adapting player controls that didn’t take away from game play was very important. The accelerometer was used to handle player movement by tilting left, right, forward, and backward. The iPhone's ability to track up to 5 individual touches at the same time meant the touch screen could easily support free look while pressing jump or fire.
The graphics were rotated to landscape mode using the full screen resolution of 480x320 and native Open GL ES. Numerous optimizations were added to make full use of the iPhone’s PowerVR MBX GPU. The game currently runs at 20 to 30 frames per second and includes effects like perspective correct multi-textured polygons, trilinear/anisotropic filtering, alpha blended explosions, and depth testing.
The sound was implemented using Open AL and network support enabled using the WiFi connection. The menu system received a button overlay for the arrow keys, escape, and enter buttons along with a keyboard popup for entering things like player name or IP address. They now had every major piece completed and could setup, configure, and play the game.
After additional tweaking and optimizing, the game was ready for the ultimate test. Kevin and Todd, along with two other players, launched Quake and quickly joined in on a multiplayer deathmatch game. The interesting thing was they weren’t sitting in chairs, behind their desk, and out of sight from the other players. They were standing in the middle of the room, huddled together in a circle, and playing the most intricate \multiplayer game they had ever seen on their iPhones.
Source code from the port is available here: http://code.google.com/p/quake1-iphone/