What is Cocos2D and Why is it One of the Best iPhone Game Engines?

Powered by Cocos2D for iPhone

Cocos2D is the leading, open-source, royalty-free smartphone game engine. It’s easy to use, community-supported, reliable, mature, and over 1500 mobile iOS games have been published using it! And now, thanks to Cocos2D-X, it’s possible to release games for Android with the same codebase.

Why is Cocos2D so easy to use? Because you can play a sound effect, animate a flipping sprite, flash some rad custom font, all with just a couple lines of simple, pure Objective C code. No knowledge of OpenGL is required! Rotating, mirroring, parallaxing, scaling, tinting, sliding, jumping, and a Halloween-sackful of other effects are quickly at your fingertips.

Cocos2D can even be used to make regular-old apps with custom graphics!

Cocos2D is Free

A lot of other high-quality game engines cost money. Some require payment on annual basis and some are a one time fee. Typically they cost hundreds of bones.

Usually you get what you pay for. If a game engine costs a lot of moola, then there is a typically a good reason. It probably saves you a lot of time and hassle. Cocos2D is the exception, being free from the get-go, and developed with the aid of a large, loyal community.

Being a free game engine makes it easy for beginners to learn the ropes. Sure, a lot of paid game engines give out trial periods, but being able to learn a free game engine with the knowledge that one will be able to release a game without having to shell out a wad of Jacksons is a good way to rest easy at night.

It’s also royalty-free. This is important. Imagine having to write a royalty-check to the developer of your game engine on a regular basis. (Kind of remind me of those annual fees.) Oh! How taxing!

Cocos2D is Supported by a Huge, Helpful Community

There are a lot of bad-to-the-bone programmers out there who know just about everything. I ain’t one of ’em. It takes me time to learn something just like anyone else.

When I’m just starting out learning a new language, framework, or engine, it’s almost inevitable that I will get stumped somewhere. That’s why having a huge, helpful community of fellow developers using the same code is so dang handy. I can nicely, intelligently ask a question in the forums and receive an answer rather quickly.

Look dubiously on any game engine without a large, active, helpful community.

Having a helpful community backing you and your game can save hours of frustration. It will keep hair on your head.

Cocos2D is Open-Source

Nothing is more annoying than a show-stopper bug in your game engine that makes your game look like animated dirt. I can hardly stress how important it is to have the entire source code to the engine. I guarantee you will need it. If not to fix some glitch, then to enhance it to do something which makes your game that much better.

I’ve had to soup up the engine a little for every game I’ve ever written. That’s why I’m loathe to invest money in game development software. I don’t want to rely on somebody else’s compiled, binary, static, unchangeable mess.

I want an un-compiled, open-source, dynamic, changeable game engine like Cocos2D.

As well, it’s pretty cool that I can submit minor codebase fixes, snippet suggestions, or other source code contributions and see them added to Cocos2D. That’s the beauty of open-source. Everybody can contribute.

Cocos2D is Simple

2D is pretty dang simple. When I started learning to make video games, I’m sure glad it wasn’t 3D that I was jumping into. 2D makes so much more sense. It’s easier on the mind. I might have turned away from making video games forever had it been dauntingly difficult to comprehend. Calculus, vectors, 3D modeling, and all the other intricacies of that extra dimension requires a lot of knowledge and experience.

Besides, I love 2D, retro games. Metroid and Zelda are two of my favorite games ever. I want to make simple games like that. Stuff that reminds me of being a kid. Thankfully we have a platform these days that encourages and thrives on simply two dimensions: smartphones.

Long live smartphones! And if you’re just starting out, save 3D for a rainy day.

Cocos2D is Mature

Even back when Cocos2D was in the 0.8 and 0.9 versions, it was robust, stable, and mature. Game companies were releasing Cocos2D-powered commercial versions of their games even then. Now that it is approaching the glorious 1.0, it seems that much more rock-solid.

Each release is backed by daily development updates and multiple release candidates which are tested by thousands of real developers with real games.

Speaking of games, over 1500 games have been published using Cocos2D. The number goes up daily!

Cocos2D is Fast

60 frames per second (FPS) is a pretty rad ideal to shoot for in game development. Heck, 30 frames per second is still nice and fast. But Cocos2D shines in this department, if you know what you are doing and keep your code optimal, you can smoothly achieve 60 FPS even on older devices.

This is a must have. Your game engine must be quick. Slowness sucks, especially in today’s day and age when patience is rare and getting to the good stuff, the fun, the pot of gold, is paramount.

Cocos2D is Well-Structured

When I was first introduced to Cocos2D’s idea of a node I was blown away at it’s simplicity and universality. Just about everything in Cocos2D is a node, which includes scenes (a great concept for organizing your overall game), layers (great for adding things on top, like a heads up display), and sprites (your basic image). This makes an interconnected hierarchy of game objects, like a tree. If you move the root of the tree, you move all the branches with it. Handy.

Scenes are sweet too. You normally structure your game into a main game scene, a main menu scene, a character scene, etc… It’s super easy to keep your game organized this way. And it makes transitions a snap. Want your main menu to sliiiiide into place? Easy as pie.

Cocos2D has Physics, Sound, and a Level Map Parser

Does your game engine include physics, sound, and a level map parser? Believe it or not, some game engines omit these all-important elements, or (more dastardly) charge you extra for them.

Check out eeeeeeverthing you’re going to need for your game before you choose a game engine.

Cocos2D is Written in 100% Objective C

Mixing languages is a hassle. Learning a new language is a hassle. Some game engines force you to learn their own quasi-custom language, which is the worst hassle of them all. Trust me, you don’t want to get stuck in a corner learning some obscure, or even “underground” language. You won’t be able to use other people’s open-source toolkits, and there won’t be very many people to help you. You’ll be at the mercy of a few random Internet avatars.

Luckily Cocos2D is written in Objective C, a common, object-oriented, C-based language that is worth learning.

Stick to ubiquitous languages.

One of the greatest things about coding in Objective C is that I get to use Xcode, my favorite integrated development environment (IDE) of all time. It auto-types long names for me so quickly and intuitively, sometimes I think it reads my mind. It highlights mistakes for me on the fly and makes packaging all the graphics, sound, code, and other files for my game a cinch. When it comes time to publish my game, Xcode shines even stronger. One command packages my game in release mode (no debug symbols) and archives it, ready for upload and sharing with the world. Xcode’s debugger is awesome too.

Cocos2D Keeps Me OpenGL-Free

I like to make games. I love effects, characters, AI, creating GUIs and all that other fun stuff. When it comes to OpenGL, I’ve never wanted to learn it. Why? Because it changes. It’s basically a fad. Back in DOS we had low-level libraries to help us do graphics at resolutions higher than 640×480. Then came Windows and DirectX. OpenGL was around at that time, but wasn’t quite as stable. Can you see the trend?

Besides, OpenGL is so — yuck — procedural (read: not object oriented).

New graphics libraries come out all the time. If you want to make your own games today, don’t bother learning the underlying graphics language.

Cocos2D is Portable to Android

Recently, Android has emerged as a popular choice of operating system for many smartphones. It would be a crying shame if you wrote your whole game in Objective C for iPhones and you couldn’t easily port it it to Android.

Luckily, there’s Cocos2D-X which allows you to compile your game with the same C++ code for a plethora of different smartphone platforms, including Android.

Cocos2D-X is fairly new. However, there have been a few commercial games released lately on the Android Marketplace which were ported from iOS to Android using Cocos2D-X, so we know it’s becoming a viable, practical and mature porting solution.

Cocos2D Can Go 3D

If you’re really craving to write 3D games, there’s Cocos3D!

Cocos2D Uses Liberal Licensing

Cocos2D is licensed under the MIT license, which is one of the most flexible and liberal licenses around (even more so than the GPL). It allows you as a game creator to write your game including Cocos2D and not have to release your game’s particular source code under the same license or even release it open-source for that matter.

Your choices are virtually unlimited. You don’t have to share your code. You can sell your code. You don’t have to pay royalties on your code. Etc…

The MIT license also makes it a great choice for companies restricted by certain legalities. Since the MIT license is so liberal, it gets around the barricade of wherefores and hithertos.

Cocos2D is Backed by a Wealthy Company

The main developer for Cocos2D, Ricardo Quesada, was recently hired by Zynga to keep on developing Cocos2D. This is a really, really, really good thing for Ricardo and Cocos2D! Being backed by an affluent company, the Cocos2D lead developer can dedicate all his time to contribute to the framework, without having to worry about securing an income at the same time.

Why is being backed by affluence a good thing? This is a good question. Most people hate the rich. It’s easy to feel envious and lash out at the entities which seem to horde that which we covet. But please, people, grow up! Entities which have learned to distinguish between the profit motive and greed can grow into powerful, positive forces for humanity. Zynga recently raised millions of dollars for Haiti after it’s terrible 2010 earthquake.

Not to mention, they can easily afford to pay Ricardo to pursue one of his passions: Cocos2D, one of the best iPhone game engines out there.

What Kind of Game Will You Make?

Will you make an RPG? Will you make a graphical app? Will you make a side-scroller? All are possible with a little bit of knowledge and experience.

The iPhone Game Kit has been created and established to give you a running start. Go download the source code to two published iPhone/iPad games, skim the 150-page manual that teaches you the basics of mobile game development, and start your game today!

Looking to discuss this blog post? Join us in our forum.


  1. jonny lever

    nice post

  2. Snehal

    Very Nice Post

  3. Hobo

    Nice post and very good points when it comes to choosing cocos2d

  4. Abhay

    Really Nice Post….Thanks .

Featured Posts

Recent Posts