Home and Blog button

Pages

Introduction

Welcome To my Blog !!
This is a blog where you can get some knowledge that i have learned and been using. Sharing is gaining pals. So Happy Sharing and don't forget to follow and link my blog with yours! Thanks.
Happy Programming!!

Thursday, February 17, 2011

Developing iPhone 2D Game With Cocos2d !!

Hi all,

In my last post for iphone development, I have written about the options that you can choose while developing for the iPhone. In this post, I am going to write about free, open source game engine for iphone : "Cocos2d" for iphone.

Cocos2d

Cocos2d is an open source framework (Game Engine) for building 2d Games. Cocos2d can be found in  windows, linux, mac platforms for developing 2d games. It was first written in Python. Being an open source, it is developed and extended by many programmers. Such one extension is "Cocos2d for iphone".

Cocos2d For iPhone

"Ricardo Quesada" is a lead developer, who is working full time on cocos2d project, and his current income consists of solely of donations and the sale of Sapus Tongue & LevelSVG Source code. He has helped many fellow iphone game developers to create a 2d games for iphone. If you want to give back some respect to the Ricardo, you can donate or buy his, 2d level map editors or source codes from above link. 

Since cocos2d is Free, it is famous and extended by many developers as they require. You can also submit your code for extending cocos2d. It has huge community support also. And now there are couple of books also available in market to learn cocos2d. If you choose to use cocos2d for iphone game, welcome to cocos2d family :) .

Cocos2d is very easy to learn and creating simple 2d game in it will not take more than a couples of months. Before developing any game, you need to understand the basics of game very clearly (game loops, sprites, game engine etc). Then you can start game developing with cocos2d.  

It is easy to get interested in developing and creating your own games. But understanding and creating it is not as easy as it seems. You need to understand game development cycles  (concept) which I will write in my next post if required. But for now lets go for cocos2d for iphone.

Downloading And Installing Cocos2d for iphone

Note that Cocos2d is very good and recommended game engine for beginner iphone game developers. There is one game Trainyard which was developed by only one developer "Matt Rix" in his spare time, who got his app, the nice rating in appstore. Read his full success story, it is really encouraging.

  1. You can download cocos2d latest version from here. Always go for stable version if you don't want any incompatibility issues. 
  2. After you have downloaded the .zip file from above link. Unzip it.
  3. After you unzip it, you need to execute the "install-templates.sh" shell script file. It will install the cocos2d templates in your Xcode.
  4. Now you can create a new cocos2d project by selecting it from Xcode template. Your new cocos2d templates should look like the following image.
Note that in above templates there are "cocos2d Box2d Application" and "cocos2d Chipmunk Application". The Box2d  is an open source physics engine and Chipmunk is also the physics engine which are compatible with the cocos2d. You can use them if your game needs physics.

Hello World Cocos2d

After you create a new project in the cocos2d template, you can build and run the current project. By default,  Hello World Label will be shown in the screen after a cocos2d splash screen. By default you get the Hello World program. You can over write the Helloworld class or add new class to create your own application.

And Yes, there is offline documentation called doxgyen integration and online documentations from where you can learn cocos2d libraries and classes. And if you stuck in any point, there is always a community forum support to help you on this.

Now What?

Now if you want to create some basic games in cocos2d, you better go to How to make basic iphone game post by Ray Wenderlich. It is excellent start up for the iphone game beginner with cocos2d.


Finally, thanks for reading and hope it would help someone who is trying to get started with cocos2d and try to figuring out what it might be. Leave comments if you want something more, or feels not right :).

Happy sharing and learning! Thanks.

2 comments:

  1. wish I knew mobile programming as well! but you are doing good. Keep it up! Great to know an iPhone developer from Nepal.

    ReplyDelete
  2. Thanks man, thanks for the comment. If you have programming C++ or C# (OOP) concepts then i bet you can easily learn developing for mobile. You are also doing ur blog great. Keep it up.

    ReplyDelete

Search This Blog