Cocos2d for iPhone 1 Game Development Cookbook Review

Alex SikoraMar 02, 2012

Overview

I have yet another Cocos2d book to review! Probably one of the (if not the most) popular 2d game engines for iOS development. Cocos2d is a free engine anyone can use to make 2d games. This book was not designed for those new to development, or those new to development on the iPhone. It assumes a bit of experience with Objective-C and Cocoa, and some minor familiarity with the Xcode IDE. It is a cookbook style (as the title states) introduction to using Cocos2d in your future iOS games. You can download the source code found in the book on the publisher’s website.

The Good

Coverage

This book covers everything you need to know to use Cocos2d in your games. It starts off right away with drawing sprites to the screen, perhaps the most important of recipes in the book. It also covers how to take user input in a variety of fashions, from on-screen d-pads and “analog” sticks, to accelerometer controls.

Good Recipes

The recipes in this book are well written and structured, easy to understand. The recipes follow a simple format of explaining what they are going to do, usually with some screenshot to illustrate their point. This is followed by the source code to implement it. The code is commented and step-by-step descriptions follow the code describing what new methods and classes do. Methods and their parameters are clearly explained, as well as value ranges and typical choices.

Extra Content

These recipes also extend past just Cocos2d features. The chapters “Physics” and “AI and Logic” cover topics that are useful to any game developer. The Box2D physics system is explained with useful techniques, A* pathfinding is explained, and even Lua scripting. These extra tidbits are very useful for any developers looking to make better games.

The Bad

Ugly Code

Strange for a development book to mess this one up as it’s probably the most important part of the book, but the code formatting is just a bit ugly. I’m not sure what font they chose but it seems like it got stretched a bit. Also some code lines wrap on to a new line with no special formatting at all. Perhaps it was simply the review ebook version I received, and I assume they will fix it in a future version.

Depth

This is a cookbook style development guide, so it can’t cover everything, but there are occasions where you want to know more information that you will have to figure out yourself. This can be a good thing though! The best way to learn is through your own experimentation.

Chapter List

  1. Graphics
  2. User Input
  3. Files and Data
  4. Physics
  5. Scenes and Menus
  6. Audio
  7. AI and Logic
  8. Tips, Tools and Ports

About the Author

Alex Sikora has been a member of iDevGames since 2003. He is a student at the University of Illinois, currently majoring in Computer Science. He works at a startup in Chicago making iOS applications, and makes games in his spare time.

uDevGames 2011

Convergence — Best Gameplay
Kung Fu Killforce — Best Overall Game, Best Audio, Best Presentation
Flying Sweeden — Best Graphics, Most Original
Time Goat — Best Story