1493474570 iPhone Game Development: Developing 2D & 3D games in Objective-C (Animal Guide) - Mobile Development - Books - Books - GameDev.net

Jump to content

Game Development Books

  • You cannot edit this book

iPhone Game Development: Developing 2D & 3D games in Objective-C (Animal Guide) *****

iPhone Game Development: Developing 2D & 3D games in Objective-C (Animal Guide) By Paul Zirkle, Joe Hogue
Published November 2009
List Price: $34.99, Your Amazon.com Price: $16.29

Amazon.com Sales Rank: 1,933,282
Availability: Usually ships in 24 hours

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. With iPhone Game Development, you get 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.

Loaded with descriptive examples and clear explanations, this book helps you learn the technical design issues particular to the iPhone and iPod Touch, and suggests ways to maximize performance in different types of games. You also get plug-in classes to compensate for the areas where the iPhone's game programming support is weak.

Buy it now:

  • You cannot edit this book


Dec 28 2009 08:12 AM
iPhone Game Development from O'Reilly is aimed at a reader who has some experience programming in C, C++, Java or a similar language, but is new to game development or the iPhone platform, or both. The cover image of a roadrunner is appropriate, this book moves fast. The book is quite thorough, bringing together a handful of topics: iPhone development, game engine design, graphics theory, and even 3D games. The book is written by two practicing iPhone developers, with a ton of experience in developing games for mobile platforms, and this experience comes through.

The book starts off with an introduction to XCode and InterfaceBuilder, Apple's development environment for the iPhone. Even if you're not anticipating a lot of interface work for your game, most games will have a settings screen or at least a main menu. It also provides a way to introduce the platform, and a place for the obligatory "hello world" app.

Next, there is a quick intro to Objective-C, the C-derived language used for the iPhone. This intro is done mostly by comparison with C++ and Java. It's a good overview and enough for a C++ or Java coder to get a sense of the language, but there's not enough depth to be all you need to make the transition to Obj-C. For example, Apple's "property" extension (@synthesize) appears in one example but is not explained. Memory management, which is quite different from C++ or Java and often a stumbling block for newcomers to Obj-C, is barely mentioned. It is noted that you can mix C or C++ in with your Obj-C project, but there aren't any details or examples given. I would have liked to see more information on this topic because it is quite common game development. In particular, a discussion of the distinction between the NS (Obj-C) API and the CoreFoundation (C based) API seemed absent. Still, as a gentle introduction to Obj-C, and combined with the plentiful online resources (such as the introduction to Obj-C in Apple's developer docs), this section serves its purpose.

The next several chapters -- the meat of the book -- consist of a building a pair of actual, complete iPhone games. This is where the book really stands out. The projects are very complete and much higher quality than typical example code; these are real games on par with what you'd find in the app store, the 2D game in particular. The downloadable code is all available on Sourceforge here.

The chapter on Game Engine Design will be useful to anyone with programming experience but who has never written a game. The framework presented is not the only way to structure a game, but it's solid and well explained. Some of the information is a bit too general for a book focused on iPhone development. For example, it was great that a discussion of game mainloops were included, but CADisplayLink or NSTimer, which are the iPhone specific ways to approach this, weren't mentioned. The technical information in this section is presented very broadly, for example there is a discussion of texture mapping and blending, but no mention of iPhone details such as the PVR hardware texture compression on the iPhone. This chapter covers a lot of ground, and does a good job describing every part of a typical game engine, regardless of platform.

Remarkably, the book includes not only a discussion of the framework required, but it includes full source code for the framework itself, as an additional download from SourceForge, under a very permissive license. I was able to get both of the games running with no problems on my iPhone, and the project files are well packaged and organized. This framework gives readers a huge head start in developing their first iPhone game, and looks good enough to include in shipping games. It's not as complete as a full game engine, but that's often overkill for smaller games aimed at a casual audience. Depending on the scope of your project, this can be extremely useful (I know I'm planning on using some of this code in my games in the future).

The downside of this means that the book spends some time explaining the framework, instead of the underlying implementation details. The book takes you through their sprite and tile framework, but with only sparse discussion of how that is implemented as actual OpenGL ES calls. This may turn off some readers if they are expecting to learn Apple's APIs without incorporating any of the book's example code. You won't be able to fully grok the material in this book unless you're willing to dive in and pick apart their source code. Still, that's true of game programming in general. I think the authors made the right choice here -- they wouldn't be able to present even one functional game if they had gone into that kind of detail, even if the book were three or four times as long. However, a bit more discussion of implementation would have been welcome.

The games themselves are really well done for sample code, better than many real games in the app store. The 2D game is a safari-themed action/puzzle game is fun and very playable, and a great choice for the book as the gameplay elements presented here apply to many different types of games, from action to RPG to platformers or even puzzle games. In particular I was impressed that each level of the game had different gameplay, demonstrating how the framework can apply to a variety of projects. The tilemap and sprite sections were clear and very practical discussions of the tradeoffs and details of different approaches. Only about 40 pages of the book are spent on the 3D project, and that game is a bit less complete. They did manage to touch on every part of a 3D game engine, which is no small feat. While the 2D game project is really enough to take you through the complete process of building a game, the 3D one is more of a starting point. The material in this section would be useful to someone who has never worked with a 3D game before. Oddly, the skybox appears to be upside down, both in the screenshots and the game itself.

Screenshot of the safari-themed action puzzle game from the book.

There is a brief discussion of third party engines such as Torque and Oolong, but for the most part these are beyond the scope of the book. This is probably a good decision, as most games in the app store have smaller scopes and don't need the additional complexity brought by an engine.

The only glaring omission, to me, is the lack of any discussion of social networking or social gaming features. Simple features such as posting high-scores or achievements on Facebook or Twitter are becoming almost a prerequisite these days, and full integration with one of the many burgeoning social gaming networks can really boost the profile of a game and help build a community of players.

For the target audience -- an experienced developer with little iPhone or games experience -- the book is a slam dunk, but developers at any level will find something useful in here. A tenacious beginner will find everything they need in here but will have to work at it, the book does little hand-holding and expects effort and intelligence on the part of the reader. Overall, I'd highly recommend it to anyone with some programming experience, who really wants to get their hands dirty making iPhone games.

Joel Davis is an iPhone game developer. You can check out his latest project at www.tapnik.com.