Sunday, January 16, 2011

Cocos2d's Android flavors

You don't know cocos2d?

Cocos2d started as a python game framework to be used on a competition called PyWeek. The name comes from a city in Córdoba, Argentina called "Los cocos". Cocos2d was born there in a PyCamp by PyAR during 2008.

You will notice that all coocos' tests have a character named Grossini. AFAIK it comes from the PyWeek game: Grossini's Hell.

Afterwards, Ricardo Quesada, one of the creators of cocos2d, ported cocos2d to objective-c and cocos2d-iphone was born. Cocos2d-iphone is far more known that the python version and it's used in a whole bunch of top10 games in the AppStore.

Hey, what does this have to do with Android?
Well, it's just an introduction :).
For android we have two flavors.

* Cocos2d-android (Java version)
* cocos2d-x (c++ version)

I have been testing both trying to decide which one to use to build a game so I will provide some sort of pros/cons of each one.
Both versions are coded by Chinese people so it was difficult to get in touch because of the different timezones.

Android version:

* Coded in Java.
* Excellent support. I sent an email to ZhouWeikuan with an issue and he fixed it right away.

* Tested on my gf's ldpi device and the scrolling feels slower. I guess there is an issue with density.
* Didn't feel stable.

C++ version:

* Multiplatform.
* Organized development with a Roadmap

* C++ (Perhaps it's not a cons for you but my C++ skills are a bit rusty)
* Tested on my gf's ldpi device and although it said 50fps it "flickered" a lot. EDIT: This generated an issue in cocos2d-x issue tracker.
* Didn't feel stable.

My conclusions:

Both versions felt unstable. I feel that if I need to do a game I will need to look into the framework src code and fix stuff to make it work correctly but If you are doing a game...

...which does not require a good amount of FPS => java version.
...from the scratch and you will port to different platforms => c++ version.

Also, I would totally recommend to clone both versions repos and play a little with them.
It has been a fun experience for me!



  1. What do you mean by "didn't feel stable"? Does it crash often? Do engine updates often require changes to your project?

    For what it's worth I see Cocos2D-X as the stronger contender for the simple reason that it has financial backing by China Unicom and it's progressing fast. The choice of language is largely irrelevant, as a programmer you can learn any other language. It may not feel as comfortable as the one's you're used to but in the mid term language really doesn't matter.

    From what I understand the cocos2d-android is a voluntary effort. The previous version of cocos2d-android suddenly stopped being developed in summer 2010, which is where the new branch cocos2d-android-1 is coming from.

    For me choosing an engine is always a matter of how much I trust a voluntary effort to remain in active development. As soon as there's someone making money off it, there's a higher certainty that development will progress. Case in point is Cocos2D-iPhone but any other commercially backed engine, like Corona and of course Cocos2D-X with China Unicom behind it has a much higher probability of being continuously improved.

  2. really need some supports to make cocos2d-android-1 stable. I hate to buy all the android matchines to have a good knowledge of the current code.