Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
September 21, 2014
arrowPress Releases
September 21, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
First Steps with Cocos2d-x
by Nelly Uzuki on 03/05/13 05:40:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutraís community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 
(originally posted on my blog)

It took me some time to realize that the "x" in "
cocos2d-x" was standing for "cross", as it's a cross platform engine. Anyway, it's too long to read, I usually go with "cocos x", but maybe I should start reading it"cocos cross" ? ...

At first I thought the toughest part would be learning how to use cocos while learning C++, but I was wrong. In fact, as I was already quite familiar with C and very fluent in Java, learning C++ was really easy; of course I can't say I master it yet, I can see it is a very rich and complex language that has a lot to offer, but for my current needs, I'm good to go. I thought I should be able to catch cocos quickly since the API ref is available on their website, and that's generally all that is needed to catch up any api, but I was wrong. Also, setting up cocos2d-x didn't go as smoothly as I expected it.

Setting up the environment

Since cocosx is a game engine that allows you to build games for several platforms, it also has to be usable on as many platforms. It means there are countless configurations possible to develop with cocosx (mac + xcode, mac + eclipse, windows + visual studio, windows + eclipse, linux + eclipse, ... and these are just the obvious ones), and this leaves a lot of documentation to be done. These guys are doing their best, their faq is regularly updated, their forum support is very reactive, but for a little team, it's still too much to handle.
So while cocos website seems well furnished with tutorials about how to set up your environment, it isn't enough to guide you through every step of the process : some pages are left blank (with the mention "tbd"), some others haven't been updated for a while (either referring to deprecated methods, or displaying incorrect screenshots,...), and sometimes all the info you need is there but it's just muddled (just look at the Android Environment Setup section). When following their tutorials, some unexpected issues will eventually arise. Fortunately, with some help from their forum and Google, you should be able to manage most of them quite easily and run the various test projects they put in the package.
Here's my experience : I'm running under windows 7, so as an IDE I took Visual Studio Express because this configuration is detailed on cocos website. I tried VS 2012 Express but it isn't supported, the current version (cocos2d-2.0-x-2.0.4 @ Nov 02 2012) only supports full editions of VS 2012, even with the tweak suggested on the forum, I still get an error at run time. So I ended up installing VS 2010 Express, which I knew would be well supported and easy to configure. Now it's working fine, but as soon as they support it, I'm switching for VS 2012 Express, I like to be up-to-date and I appreciate the new look.
Anyway, for an open source project, they have managed to put up a great documentation, there's nothing to complain about, it just takes a bit of time to get to what you want, but at least you get there, and that's what's most important.
And finally, there's one thing that should be made clear for total beginners : even if your code is cross platform, you have to build your game independently for each platform you're aiming, which necessarily leads to further configurations. For instance, in my case, after setting up VS + cocos2Dx, in order to build an android project, I also had to configure eclipse for c++, add the android NDK, install cygwin, etc... altogether it takes a lot of time, but the bright side is you only have to do this once.

Getting started with cocosx api

That's where, personally, I was really disappointed. There are a lot of tutorials, examples, and even books about cocos-x, but they are always centered around ios development : they are adapted from existing cocos documentation, or written for mac users,... Anyway you always end up having to read and translate objective-c code, and while I was ok to learn a new langage (c++), I've never been willing to learn objective-c which I don't intend to use anytime soon! And the official api reference is very incomplete : the descriptions are either missing or too concise, so it doesn't help much. But this is bound to get better, afterall, cocosx is still very young, and it is a really powerful and promising engine.

Related Jobs

Infinity Ward / Activision
Infinity Ward / Activision — Woodland Hills, California, United States
[09.20.14]

Senior AI Engineer
Infinity Ward / Activision
Infinity Ward / Activision — Woodland Hills, California, United States
[09.20.14]

Lead Tools Engineer - Infinity Ward
Insomniac Games
Insomniac Games — Burbank , California, United States
[09.19.14]

Senior Engine Programmer
Nexon America, Inc.
Nexon America, Inc. — El Segundo , California, United States
[09.19.14]

Front-End Developer






Comments



none
 
Comment: