Cocos2D-iPhone is a popular game-development framework for 2D games on the iPhone and iPad. This framework powers many top games currently on the market and this book; Learning Cocos2D: A Hands-on Guide to Building IOSGames with Cocos2D, Box2D, and Chipmunk sets out to teach you how to make use of Cocos2D, as well as teaching you a number of the principles of game development, by walking you through the steps of developing a fully-featured game from start to finish.
Good Bits: Well written; Accessible yet comprehensive; Strong code samples; You build a full game from start to finish; Covers all of the core skills.
Bad Bits: A couple of bugs in the code excerpts; Examples will become less accurate as Cocos2d, included libraries and tools evolve.
What topics does the Learn Cocos2D book cover?
Learning Cocos2D brings a wide variety of topics to the table. If you work through the book from start to finish you’ll leave with basic knowledge of each of the main core skills you need to develop an App with Cocos2D. On top of this, the book will also teach you some of the core principles of game development in general. The main topics covered in this book are; Installing Cocos2D, sprite animation, simple game AI, state machines, building a game interface, using the Cocos2D scheduler, using tile maps, adding sound effects and background music, using Box2D or Chipmunk for physics and collision detection, 2D particle systems and adding Game Centre support.
How well is the book written?
Learning Cocos2D is, in essence, a continuous tutorial series that will take you by the hand as you develop Space Viking. From installing Cocos2D into your Xcode environment to integrating Apple’s Game Centre to include Leaderboards and Achievements prior to release, Learning Cocos2D explains each step in a friendly and comprehensive manner. I found the book a pleasure to read and it serves as a strong basis for anyone who has ever wanted to try their hand at developing a game. Learning Cocos2D is an accessible introduction to Cocos2D and game development and could easily serve as the basis for an interesting and useful module of a college course on the topic.
A reasonable amount of the book is made up of code excerpts from the game that you will make if you follow the book from beginning to end (Space Viking), which helps to give you real-life examples of Cocos2D. All code-blocks are formatted using the familiar Xcode formatting style, which is a really nice touch and goes to show how much thought has gone into the book. As with any first-edition programming book, there are a number of minor errors in the code excerpts which could cause some headaches for beginners with Objective-C. While no errata has been published to date, there is an active forum that exists to support the book if you run into any problems.
The speed at which both iPhone Development and Cocos2D is evolving is both a blessing and a curse; while Xcode and the Cocos2D framework are always improving, it does mean that books such as this are relevant only to a specific snapshot in their life-cycles. I haven’t really noticed this to be a problem yet, but having recently read that Cocos2D version 2 is in development (it’s a long way off at the moment, but it’s on the way), it could be that many of the code excerpts in this book ‘break’ as changes are made to the framework classes and structure in the future. If you’re reading this in a year’s time and noticing this to be a problem, you might want to consider downloading Cocos2D v1.0.1 from the Cocos2D iPhone Code Archives and working through the book with that. Once you’ve worked through the book, iterating your knowledge to a different version of Cocos2D should then be a doddle.
How much do I need to know about programming before reading Learning Cocos2D?
Learning Cocos2D assumes that you have some basic knowledge of the Xcode environment and, most importantly, Objective-C. If you’re coming from a different programming language then coding using Objective-C can be a little strange at first. If you’re a programming veteran then you might just like to read through a few webpages about Objective-C to get a grasp of the language constructs and environment, for example, Learn Objective-C on Cocoa Dev Central. If you’re new to programming in general, that it would be a good idea to get yourself a good book to Learn Objective-C and/or a book on iPhone development. While you will be developing for the iPhone, you won’t be interacting much with the core iOS libraries much, so as long as you’ve built and compiled a couple of test apps for either OSX or iOS and got them running with Xcode – you should be good to go.
On the game development front, you really don’t need any prior knowledge at all. Naturally, it helps if you’ve played a few iPhone games before, but if you’re looking at this book – I’m sure you already have that under your belt!
Who should buy this book?
If you’re an Objective-C programmer and have, at some point in your life been intrigued by the concept of building games, then download this book now and start reading – you definitely won’t regret it. If you’ve got your heart set on developing 2D games for the iPhone / iPad then you really cannot miss out on this book. However, if you’re also new to programming for the iPhone in general, then you’ll want to order a couple of other books at the same time. Even in this case, it won’t be long before you’ll be able to dig in as Cocos2D does such a great job of hiding the complexities of the game engine that you won’t need to worry much at all about maths and OpenGL throughout this project.
I personally purchased this book while half way through my first Cocos2D game project. Having dabbled with Cocos2D for some months, I wanted to make sure that I was on the right tracks and Learning Cocos2D performed admirably at bolstering my confidence in areas where my logic matched that of Rod Strougo and Ray Wenderlich. Where we had taken differing approaches, it was interesting to see why – and being able to compare and contrast proved to be a great learning experience.
At the end of the day, there’s never been a better time for those of you with a programming mindset to fulfil your childhood dreams of building your own game. It’s time to start putting those crazy game ideas you’ve always had into reality and you could do a lot worse that starting out by purchasing this book.