Last week I was lucky enough to receive an early review copy of Cocos2d for iPhone 0.99 Beginner’s Guide from Packt Publishing.
http://link.packtpub.com/PFN5lH
If you are new to the Cocos2d community you would be doing yourself a favor by using Cocos2d for iPhone Beginners Guide as a jumping off point.
The book was written by Pablo Ruiz, a regular in the Cocos2d-iPhone community, and weighs in at a whopping 368 pages. This seems long until you actually start going through the book. Ruiz has done an admirable job walking the reader through each section carefully. He introduces the various features of both Cocos2d and XCode gradually until the reader begins to gain a firm grasp of both. Also contained within each chapter are small pop quizzes. Though these can be superfluous, they often reinforce some of the finer points learned within the chapter.
Keep in mind, this book is not for the non-programmer. Basic understanding of programming is highly recommended. The book is also not a reference, but, a walkthrough. If followed carefully, it gives the reader a deep understanding of this powerful 2D game development framework.
The first chapter, Getting Started with Cocos2d, walks the reader through downloading Cocos2d source, installing templates, and running examples. It also gives a brief walkthrough of the structure of a Cocos2d game. The chapter is also filled with helpful tips that explain things like managing template versions, Objective-C memory management and other basic Cocos2d concepts. As an introductory chapter, this covers a lot of ground and really gives the reader a good understanding of the basic tools to be used throughout the rest of the book.
The next chapter covers what is often the crux of Cocos2d development: the sprite. It does this by walking the user through the creation of a simple puzzle game. From experience I know this is the best way to introduce basic concepts as it allows the reader some room for creativity. Once again Ruiz walks the reader through all there is to know about drawing sprites. This includes file types, pixel formats, spritesheets, batching, etc. He then moves on to some basic game structure including game objects with pointers back to the main game layer. Its good to see this kind of example code as object-oriented programming 101 can sometimes elude the beginning game programmer. User touch input is also covered here including some useful tips like, for example, the somewhat complex process of canceling a touch. The chapter also contains a very interesting analysis of the logic of the puzzle game. Very cool stuff.
In Chapter 3, Let’s Do Some Actions, Ruiz ratchets up the complexity. The asynchronicity of actions can often be daunting to a game programmer coming from a purely thread-safe procedural programming environment, much less a beginning game programmer. Luckily, the author keeps things simple and practical. By only emphasizing a few discrete actions he sidesteps the larger issues of logic and thread safety. These are rightfully outside the scope of a introductory book. After describing virtually all the common actions and action related techniques, he briefly discusses the basics of animating sprites.
Chapter 4 gives us an in depth look at writing text to the screen in Cocos2d. This ranges from the basics of using CCLabel to more complex examples using CCLabel, CCLabelAtlas, BitmapFontAtlas and various bitmap font generators. Although this is a very short chapter it gives you everything you need to know about efficiently displaying text in your game.
The next chapter, Surfing through Scenes, introduces the reader to more complex game structure involving scenes, layers, pausing the game and where to place your game logic code. It accomplishes this by walking the reader through the creation of a top-down flying shooter game. This is also an easy way to introduce accelerometer input. Like the first chapter, Ruiz guides the reader through the creation of the project all the way to the final touches of the game. Although a number of topics are covered here, Ruiz is careful not to overload the reader with information. For example, he keeps collision detection and handling simple as he plans to introduce physics engines in a later chapter.
Continuing with his rhythm of alternating short and long chapters, Chapter 6 focuses on designing Menus. This includes a number of examples including a some cool menu animations. He then delves into the crucial topic of persisting data using NSUserDefaults. Saving data, loading data and data serialization are often difficult topics to find information on.
Chapter 7 explains the Cocos2d particle engine system. This includes stock particle effects as well as manipulating particle system properties to create custom particle effects. Like the rest of the book Ruiz walks the reader through this process in an easy to follow fashion. After placing the customized effect into our newly created shooter game, Ruiz explains how to use the Particle Designer tool to help speed up the effect creation process.
The next chapter introduces Tilemaps. This is a complex topic with a number of separate tools which could be used. Ruiz choses to use the easy to understanding editor Tiled. The reader is walked through a small introduction of Tiled through to the final creation of a tilemap file (TMX file). This is then loaded in using CCTMXTiledMap and instances of CCTMXLayer. He also explains how to run actions on layers and how to place layer objects.
Chapter 9 introduces playing sounds using both SimpleAudioEngine and CDSoundEngine as well as the use of CDAudioManager. Like the other chapters, Ruiz carefully walks the reader through the ins and outs of audio playback.
Chapter 10 focuses on a limited introduction to physics engines. In such a chapter it can be easy to betray the word ‘Beginner’ on the book’s cover. So, Ruiz tries to keep things simple. He opts for the C based Chipmunk engine without any Objective-C wrapper classes. Once again Ruiz structures the example code around a small game project.
In the final chapter the reader is introduced to high scores, leaderboards, achievements and other common social gaming functions found in the OpenFeint SDK. Not only is this a primer on integrating OpenFeint, but, is a good working example of how to integrate a third party framework in general and should apply to many others. Adding high score and achievement pop-ups really can add a touch of class to your game.
In conclusion, this book provides a working overview of Cocos2d as well as tools and libraries which hook into Cocos2d like Chipmunk, OpenFeint and Tiled. For someone who is looking for a structured walkthrough of developing a 2D iOS game, this book strikes a good balance between breadth and depth. Highly recommended.
Last week I was lucky enough to receive an early review copy of Cocos2d for iPhone 0.99 Beginner’s Guide from Packt Publishing.
http://link.packtpub.com/PFN5lH
If you are new to the Cocos2d community you would be doing yourself a favor by using Cocos2d for iPhone Beginners Guide as a jumping off point.
The book was written by Pablo Ruiz, a regular in the Cocos2d-iPhone community, and weighs in at a whopping 368 pages. This seems long until you actually start going through the book. Ruiz has done an admirable job walking the reader through each section carefully. He introduces the various features of both Cocos2d and XCode gradually until the reader begins to gain a firm grasp of both. Also contained within each chapter are small pop quizzes. Though these can be superfluous, they often reinforce some of the finer points learned within the chapter.
Keep in mind, this book is not for the non-programmer. Basic understanding of programming is highly recommended. The book is also not a reference, but, a walkthrough. If followed carefully, it gives the reader a deep understanding of this powerful 2D game development framework.
The first chapter, Getting Started with Cocos2d, walks the reader through downloading Cocos2d source, installing templates, and running examples. It also gives a brief walkthrough of the structure of a Cocos2d game. The chapter is also filled with helpful tips that explain things like managing template versions, Objective-C memory management and other basic Cocos2d concepts. As an introductory chapter, this covers a lot of ground and really gives the reader a good understanding of the basic tools to be used throughout the rest of the book.
The next chapter covers what is often the crux of Cocos2d development: the sprite. It does this by walking the user through the creation of a simple puzzle game. From experience I know this is the best way to introduce basic concepts as it allows the reader some room for creativity. Once again Ruiz walks the reader through all there is to know about drawing sprites. This includes file types, pixel formats, spritesheets, batching, etc. He then moves on to some basic game structure including game objects with pointers back to the main game layer. Its good to see this kind of example code as object-oriented programming 101 can sometimes elude the beginning game programmer. User touch input is also covered here including some useful tips like, for example, the somewhat complex process of canceling a touch. The chapter also contains a very interesting analysis of the logic of the puzzle game. Very cool stuff.
In Chapter 3, Let’s Do Some Actions, Ruiz ratchets up the complexity. The asynchronicity of actions can often be daunting to a game programmer coming from a purely thread-safe procedural programming environment, much less a beginning game programmer. Luckily, the author keeps things simple and practical. By only emphasizing a few discrete actions he sidesteps the larger issues of logic and thread safety. These are rightfully outside the scope of a introductory book. After describing virtually all the common actions and action related techniques, he briefly discusses the basics of animating sprites.
Chapter 4 gives us an in depth look at writing text to the screen in Cocos2d. This ranges from the basics of using CCLabel to more complex examples using CCLabel, CCLabelAtlas, BitmapFontAtlas and various bitmap font generators. Although this is a very short chapter it gives you everything you need to know about efficiently displaying text in your game.
The next chapter, Surfing through Scenes, introduces the reader to more complex game structure involving scenes, layers, pausing the game and where to place your game logic code. It accomplishes this by walking the reader through the creation of a top-down flying shooter game. This is also an easy way to introduce accelerometer input. Like the first chapter, Ruiz guides the reader through the creation of the project all the way to the final touches of the game. Although a number of topics are covered here, Ruiz is careful not to overload the reader with information. For example, he keeps collision detection and handling simple as he plans to introduce physics engines in a later chapter.
Continuing with his rhythm of alternating short and long chapters, Chapter 6 focuses on designing Menus. This includes a number of examples including a some cool menu animations. He then delves into the crucial topic of persisting data using NSUserDefaults. Saving data, loading data and data serialization are often difficult topics to find information on.
Chapter 7 explains the Cocos2d particle engine system. This includes stock particle effects as well as manipulating particle system properties to create custom particle effects. Like the rest of the book Ruiz walks the reader through this process in an easy to follow fashion. After placing the customized effect into our newly created shooter game, Ruiz explains how to use the Particle Designer tool to help speed up the effect creation process.
The next chapter introduces Tilemaps. This is a complex topic with a number of separate tools which could be used. Ruiz choses to use the easy to understanding editor Tiled. The reader is walked through a small introduction of Tiled through to the final creation of a tilemap file (TMX file). This is then loaded in using CCTMXTiledMap and instances of CCTMXLayer. He also explains how to run actions on layers and how to place layer objects.
Chapter 9 introduces playing sounds using both SimpleAudioEngine and CDSoundEngine as well as the use of CDAudioManager. Like the other chapters, Ruiz carefully walks the reader through the ins and outs of audio playback.
Chapter 10 focuses on a limited introduction to physics engines. In such a chapter it can be easy to betray the word ‘Beginner’ on the book’s cover. So, Ruiz tries to keep things simple. He opts for the C based Chipmunk engine without any Objective-C wrapper classes. Once again Ruiz structures the example code around a small game project.
In the final chapter the reader is introduced to high scores, leaderboards, achievements and other common social gaming functions found in the OpenFeint SDK. Not only is this a primer on integrating OpenFeint, but, is a good working example of how to integrate a third party framework in general and should apply to many others. Adding high score and achievement pop-ups really can add a touch of class to your game.
In conclusion, this book provides a working overview of Cocos2d as well as tools and libraries which hook into Cocos2d like Chipmunk, OpenFeint and Tiled. For someone who is looking for a structured walkthrough of developing a 2D iOS game, this book strikes a good balance between breadth and depth. Highly recommended.