The history of Cocos2d in a glimpse

Cocos2d (Python)

In February 2008, at Los Cocos, Córdoba, Argentina, we started the “Los Cocos” Python game engine. We later renamed it Cocos2d. The idea was to create a game engine for the games we were creating for PyWeek.

PyCamp 2008. Centro Allen Gardiner, Los Cocos, Córdoba, Argentina

We started the game engine with Lucio Torre, Daniel Moisset, Rayentray Tappa, and I, with the help of Alejandro Cura and other members of PyAr.

We announced a beta (or was it alpha?) version in a lightning talk at PyCon Chicago in March 2008.

PyCon March 2008, Chicago. We announced Cocos2d in a lightning talk.

In July 2008, Lucio and I went to Euro Python to present Cocos2d (was it v0.3?).

With Lucio Torre at Euro Python 2008 presenting Cocos2d. Vilnius, Lithuania, July 2008

In addition, Lucio and I presented Cocos2d at PyCon Ar 2008 and 2009.

In 2010 Claudio Canepa became the new Cocos2d developer/maintainer.

Cocos2d-iPhone

Somewhere around the beginning of 2008, Apple announced that the iPhone would have a store. Apple would only take 30% of the revenue (back then, carriers were taking around 90%). Furthermore, the iPhone was powered by OpenGL ES and the OS was UNIX based.

Also, around that time, I wanted to create commercial games. I had previously considered the Web (Flash) and feature phones (J2ME) as possible markets. But after Apple’s announcement, I decided to develop games exclusively for iPhone.

I needed a game engine for my iPhone games, so I re-wrote Cocos2d in Objective-C. The high level design remained the same, but I had to make substantial changes to make it work on the iPhone…  and that is how “cocos2d-iphone” was born. The  first cocos2d-iphone version (v0.1) was released in June 2008.

In March 2008, I applied to get my iPhone Developers license, and finally got it in July 2008 (it took me 4 months to get one, whereas today you can get one in a few minutes). It was not possible to publish games on the iPhone App without a license. While waiting for my license, I did some contract work, developing some games for 3rd parties using cocos2d-iphone.

Having gotten my iPhone Developers license, I created my first (and only) game for the iPhone: Sapus Tongue. However, I realized that creating commercial games was not that fun for me; neither did I find it easy. Since cocos2d-iphone was already popular, I decided to work full time on it. The reason I could do this is that I was actually making a living by selling two commercial tools for cocos2d-iphone: LevelSVG: a sort of editor + physics on top of cocos2d, and Sapus Tongue source code.

At the beginning of 2009 there were already more than 100 games using cocos2d-iphone. The first one to reach #1 at the iPhone App Store was Stick Wars.

Stick Wars: The first cocos2d-iphone game to reach #1 at the iPhone App Store

After that, many other cocos2d-iphone games reached #1. And most of the time, there was at least one cocos2d-iphone game in the Top #10. I believe this was the case from 2009 until the end of 2011.

Not only games were created with cocos2d-iphone, but also animated books, photo applications, and more. Some cocos2d-iphone games and applications were featured at WWDC 2010. Even games that Apple proudly announced as “built using Apple libraries”, were actually built with cocos2d-iphone.

WWDC 2010. Steve Jobs presenting Elements, a cocos2d-iphone application

Many cocos2d-iphone forks/ports/bindings were created as well, such as:

In July 2011, after working on cocos2d-iphone for more than 3 years, and with the help of the community, I released cocos2d-iphone v1.0.  Some stats: ~140 contributors, ~2600 commits and 63 internal releases.

cocos2d-iphone v1.0 was released in July 2011

The community was very healthy, with many people helping each other, opening bug reports, sending pull requests, suggesting features, etc. The ecosystem around cocos2d-iphone was also very healthy: many cocos2d-iphone books were published, and many editors/tools (both commercial and free/open source) supported cocos2d-iphone, many job positions were looking for cocos2d-iphone developers.

In May 2011, I joined Zynga. At Zynga we used cocos2d-iphone for some iOS games. To port them to Android, some of them were rewritten using AndEngine, and others were ported using AppPortable‘s Objective-C/UIKit stack.

In 2012, Android was already very strong. I wanted to support Android natively (and other platforms as well). I had three options:

  1. Stop working on cocos2d-iphone, and work on Cocos2d-x (the C++ fork)
  2. Keep developing cocos2d-iphone, and use 3rd party commercial Objective-C stack (like StellaSDK, NoodleCake or AppPortable) to port cocos2d-iphone to Android
  3. Keep developing cocos2d-iphone, and develop an open source Objective-C stack to port cocos2d-iphone to Android.

I didn’t want to depend on 3rd party commercial tools, and I didn’t have the time to write my own Objective-C stack, and Cococs2d-x was already popular. So I decided to help the Cocos2d-x team. We started using Cocos2d-x at Zynga as well.

2012, at Zynga. With Rolando Abarca and Zhe Wang discussing Cocos2d-x’s and cocos2d-iphone’s roadmaps.

At Zynga, with the help of the Cocos2d-x team, we created a very attractive tooling:

  • Cocos2d-x and cocos2d-iphone were feature compatible. The API was almost the same (of course, one in C++ and one in Objective-C)
  • CocosBuilder (created by Viktor Lidholt) included many good features: Scene editor, key-frame animation editor, JavaScript scripting and more.
  • Scenes exported by CocosBuilder were supported both by cocos2d-iphone and Cocos2d-x.
CocosBuilder editor

The only drawback was that keeping feature-compatibility between Cocos2d-x and cocos2d-iphone was expensive: we had to write the features twice. And also CocosBuilder was built on top of cocos2d-iphone which meant it was only available for Mac (no Windows version), and also required writing the features twice. Supporting Windows was important for many Cocos2d-x users.

I kept developing cocos2d-iphone until June 2013, and then I passed the torch to Lars Birkemose (who in 2016 passed it again to Andrei Volodin). In August 2013 I joined Chukong.

Cocos2d-x

Note: Chukong, the company behind Cocos2d-x and Cocos Studio, is a Chinese company with its headquarters in Beijing. Cocos Studio was developed at Beijing. Cocos2d-x is being developed in Xiamen (south of China), and I joined their California office were we did a bit of everything.

Cocos2d-x was started by Zhe Wang in July 2010. It was a clone of cocos2d-iphone, but coded in C++ instead of Objective-C. His goal was to create an SDK to facilitate porting cocos2d-iphone games to the uPhone (a phone project that was later cancelled). In order to facilitate the porting, Cocos2d-x included all the Objective-C patterns that were found in cocos2d-iphone. Somewhere in 2012 (or was it 2011?) the Cocos2d-x team joined Chukong.

Chukong had the resources, the willing, and the position to make Cocos2d-x a world class game engine / tooling. Cocos2d-x, back in 2013, had about between 70%~80% of the Chinese market share.

At Chukong, we started by designing Cocos2d-x v3, which included the removal of Objective-C patterns from its code, the use of modern C++ APIs, the update of the renderer (Nite), the addition of 3d features (Tony and Harrison) and the writing of a Programmers Guide (Jason).

But the most important thing was the editor: We needed one. Chukong had invested a lot of resources in Cocos Studio. It had many features, but its UX wasn’t appealing for the US/Western market, and it was Windows only.

So, in the US office, we (Justin, Nite and Kai) started working from scratch on an editor for Cocos2d-x both for the Chinese and US/Western markets (something similar to CocosBuilder, but built on top of Cocos2d-x and compatible with Windows and Mac. Qt was used for this).

At Beijing, with Hao Wu, Shun Lin, Harrison, Zhe Wang, Nite Luo, Justin Graham.

Unfortunately the new editor was cancelled. As hard as we tried to improve Cocos Studio’s UX, it failed to attract the US/Western market.

Mac version of Cocos Studio with an improved UX

Other projects were cancelled as well, such as Cocos2d-HTML5 v4, Cocos2d-x v4 renderer + HAL, Cocos2d-x launcher, Cocos IDE. Even Cocos Studio got cancelled.

At Xiamen, with Zhe Wang, Ibon Tolosana and Kai Zhao. November 2014

Cancelling projects, specially when they are almost ready, can be frustrating. But our main challenge was finding a good business model. We tried different things, but we couldn’t find a good one.

In hindsight, this is what I think we should have done:

  • Work on just one editor: the Qt editor that was supposed to be the Cocos Studio replacement.
  • Offer services within the editor: SDKBOX, and other services.
  • Focus: Only work on casual/mid-core features (no VR or other distracting features). Try to be the best ones in that category.

After working 9 years on Cocos2d, and due to the development of recent events, the time has come for me to work on something else. What should I do next? Some people say that the future is IoT, others say it is Machine Learning, while the rest say it is VR/AR. They are all wrong: The future is the Commodore 64. See you soon.

Advertisements

3 thoughts on “The history of Cocos2d in a glimpse

  1. Lot of time without knowing where you are, and casually see your tweet about this history.
    Hard to accept the end of Cocos 2d, but I’m sure you will go for something interesting. I will be waiting for news.
    A big huge from Cordoba (near Los Cocos)

  2. It’s really great to see how people from our country manage to do so much with so less. We have great people overall and great engineers.
    I hope you keep around the gaming industry and just embrace change. Now you know that you have (even though you may not thought about it) change the world a little bit directly or indirectly and feel proud about it.

  3. Cocos2d was the best, a great community and a very friendly and informative forum. The very first project I released for the iPhone ‘Super Turbo Action Pig’ was built on it and that same version is still running today on the App Store 7 years later!
    I was hunting through the code just yesterday for something I needed for the new version of Sketchshare.

    Great work, looking forward to your next project 😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s