No matter what type of iPhone game you are creating, reusable bodies of code are available that can supplement many parts of your game engine. They come in the form of libraries, middleware, and even fully fledged open source games.
The iPhone SDK makes available many low-level Apple APIs (such as Core Graphics and Core
Audio) and mid-level APIs (such as
NSNetService). But you are not limited to
these alone; many other libraries are available, and some even come with
the SDK (such as OpenGL and OpenAL).
Libraries exist to help you with sound, networking, and many other tasks that you might find too low level.
Perhaps you want to store and organize large amounts of data; SQLite provides database functionality on the iPhone. Most likely you don’t want to write volumes of linear algebra code for your 3D physics; that’s OK—Newton, Open Dynamics Engine, and Bullet have beat you to the punch. For a really cool 2D rigid body physics library, you should check out Box2D.
The iPhone is a relatively new platform and new libraries are still being made available. Fortunately, the iPhone shares a lot of code with the OS X platform, so many libraries that work for the Mac can be used for the iPhone with a little tweaking.
If your goal is simply to make a game in the easiest way possible, gluing together a game engine of your own from scratch (even with the help of libraries) might not be the right choice for you. Fortunately, a number of middleware solutions are available for the iPhone.
Think of middleware as a game engine (with all of the graphics, audio, and input components you would expect), but without a game sitting on top of it. All you have to do is write your game logic and add the art resources: middleware gives you a huge jump-start toward a finalized game.
Packages vary in quality and price, from hobbyist and research projects to open source projects such as cocos2D and the Oolong Game Engine (which are both freely available) to proven cross-platform commercial products such as Torque 3D and the Unity engine.
Some of the games built off the open source middleware engines listed earlier are also open source. In addition, others have also released their game code to the public.
For example, a fan of the game Quake3 ported its open source PC project to the iPhone. Because the source is GPL’d, the results also must be under the GPL and are therefore freely available to the public.
In fact, John Carmack (the head graphics programming guru of id Software) is involved in iPhone development. The company recently released Wolfenstein 3D, and Carmack ported an open source project named Wolf3D Redux on SourceForge, itself based on the open source version of Wolfenstein 3D originally released by id Software. Naturally, Wolfenstein 3D for the iPhone was also released to the public.
Learn more about this topic from iPhone Game Development.
What do you need to know to create a game for the iPhone? Even if you've already built some iPhone applications, developing games using iPhone's gestural interface and limited screen layout requires new skills. Loaded with descriptive examples and clear explanations, iPhone Game Development provides everything from game development basics and iPhone programming fundamentals to guidelines for dealing with special graphics and audio needs, creating in-game physics, and much more.