Tuesday, February 17, 2015

Getting Started With Cocos 2D using C++ on Windows, What To Install?


Cocos 2d-x is a very popular cross platform game development engine. C++ is the programming language most university/college students now right out of college, that means maybe they can create a game while studying in college! Unity 3D, another game development platform is taking the market by storm but still many professional developers prefer Cocos 2D. My friend Mudaser recommended using Cocos-2D instead of Unity, he's got several years of game development experience so I followed his advice.

Getting started with Cocos was not very easy to be honest, it took me several hours to figure out which way to go. They got documentation on their website but it was not very helpful.

Tools to install for developing Cocos 2D C++ games on Windows

  1. Cocos Studio - Download
  2. Cocos Framework - Download
  3. Python - Download
  4. Visual Studio 2012 - Download
  5. Windows Phone 8 SDK - Download
  6. Java Development Kit (JDK), for Android version of your game - Download
  7. Android SDK, or Android version of your game- Download
  8. Android Native Development Kit (NDK), for Android version of your game - Download
I compiled this list after spending some time and I believe it is going to be helpful for people.


Most of the stuff can be downloaded after installing Cocos Studio on your system through the Cocos Store tab shown below. I recommend downloading Cocos Studio first.


Are you struggling with Cocos 2D-x game engine, let's learn together!!!

Feel free to get in touch with me through the "Contact Me" form on left side, you may comment the blog post as well.

What is Cocos Studio then?

It is not the place you will write your code in. Instead, it is a place where you create scene files which are then used by a programmer.
Your project will have various folders containing projects for Win32, Android, and Windows Phone as well. You will open appropriate project folder and modify files in there.

Why Python?

Not everybody loves PowerShell, open source community has got a much older and well tested alternative i.e. Python programming language. It is used to perform various tasks like creating projects etc. You will need to install it as well, no way around it ma techie.

Where do you write the Cocos2D-X game code?

On a Windows PC, the C++ game code is written in Visual Studio 2012. On a Machintosh, XCode is used to write and edit code. Same code can be reused as it is to generate an Android and iOS version of your game. You will need to provide graphics for major size changes, but don't worry about that for now.

Is it possible to create a Cocos2D-X game without C++?

Yes, it is possible to write HTML5/JavaScript based games, the tools are not covered in this blog post.
Lua scripting language is also supported and it can be used to create Cocos2D-X games.

android-os-logoNo direct debugging on Android

Don't just freak out, that's a matter of fact. You can't debug directly from Android devices. That's why its recommended to use Windows Phone emulator on Windows.
There is a good news for Apple iOS developers, they can directly debug their game code from their device. The reason is objective C is a child of C and it supports code written in C++.
On the contrary Android uses a virtual machine to run code, and C++ code gets converted into suitable byte code and back to assembly before hitting the processor.


  1. Do you have thoughts on how Cocos compares with Unity for 2D?

    Is the design flow better, or perhaps the licensing is more flexible/cost-effective?

  2. Ben,
    I am a beginner myself, I can be wrong. I've been trying to learn Unity for a while and watched several hours of training videos, it looks like a designer focused thing to me. Cocos2D on the other hand sounds more like a developer thing. I'm feeling confident that I can create a title after couple weeks learning Cocos2D, this feeling was lacking in case of Unity.
    Unity logo in free version is also a problem in many cases, suppose if I get a project from a big local candy maker they won't like the Unity logo which is mandatory for free version on game start.
    Most important deciding factor in my case was a friend's advice and assurance that he'll guide me along the way. He's been creating games at a software house for 5 years, finding a good mentor is very important and I didn't want to miss the chance.
    Hope the answer was helpful, please feel free to ask more questions, share ideas, and get in touch.


  3. Hi Naeem,
    I am just starting out with Cocos2d myself, I found your excellent blog via a Cocos2D forum post. I installed it almost one year ago with hopes of making some Android apps, but I soon gave up because of the overwhelming complexity involved in Android development. Now with a bit of Visual Studio and C++ experience behind me I thought I would return to give it another go.

    Anyway, I just thought I would say thanks and let you know that your posts have been invaluable.


  4. Dean,

    Nothing makes a writer more happy than the readers saying "good job".

    I have been unusually busy lately, otherwise I wanted to expand the series further. I hope I will get some time to write even more six weeks from now.

    Do post the link of the forum where you saw the link to this post.


  5. Ben,

    It's been a while since you asked whether Unity is better or Cocos 2D-X. I've not done much on game development front but I have developed a feeling that Unity offers a very nice set of tools. From a business perspective I will recommend using Unity. All the tools are free if your annual revenue stays below $1 Million.

    Cocos is nice, but I feel like its a bit fussy. Maybe I am wrong, but the exploration I've done until so far makes me think Cocos-2Dx will be my second choice.

    I am playing with Unity 2D these days and I will be working on a personal game project in a couple of months.


  6. Can u make an explanation that includes Ant build and Android studio

  7. Anonymous on July 25th, I didn't get your point. Can you please rephrase? As far as I remember I didn't install ANT explicitly. Secondly, Android Studio is covered later in another post. Link is given below.

  8. This comment has been removed by the author.


Feel free to talk back...