Tuesday, May 8, 2012

Mobile game development - The road so far

I've loved gaming since my first Spectrum in 86. Although I don't play as much as before I still try to find the time for some Skyrim, Battlefield, Uncharted, etc.

Anyway, that's the "consumer" side of it. Some months ago I started to delve into game development, particularly on the mobile space. As I had just bought a Mac I decided to target iOS.

Long story short, this has been the road so far:
  • Bought a Mac
  • Enrolled in a Apple Developer Program (meaning, paid 100 usd)
  • Stared at XCode and ObjectiveC scratching my head
  • Researched
  • Tried to develop a game
  • Failed miserably
  • (paused 6 months)
  • Re-Research
  • Current Time

Tools/Languages that I've used during my attempts/research (in chronological order)


When I first looked at ObjectiveC it seemed really strange. All those "[", "]" and... manual memory management. Nasty stuff.

Anyway, after a small learning curve it really became second nature. It's not that different to C++, and even the memory management stuff is very straightforward (although easy to forget).

Obviously we, the c# developers, are very spoiled. I really miss my LINQ, the garbage collector, my lambdas (albeit existing something similar in ObjectiveC), but heck, that's life. Could be worse.


XCode sucks when compared to Visual Studio and really seems a generation behind. It's better now, but still lacking. Well, at least it's free :)


After looking at ObjectiveC and XCode, and before I really gave them a chance, I looked for an alternative. Marmalade provides a cross-platform development experience in C++, with the added bonus of allowing Windows development in Visual Studio. It seemed too good to be true.

I tried it out for some time, and even started developing a game with it. It didn't turn out very well. This library is very low level, and is clearly more focused in 3D gaming. It seems perfect for those companies that already have some games in C++ and want to port them to several platforms. Also, it's not free. the trial was like 90 days so was enough for me to dismiss it.


Then I stumbled on this library. I don't really know how I didn't find it sooner, as it's the "de facto" library for 2D gaming on iOS. It's free, supported, has thousands and thousands of people using it and it really simplifies game development.

Anyway, I bought a book on Cocos2d game development and it was relatively easy to get into it.

I chose one of my gaming ideas and started developing it. I implemented some of the game logic, physics (using Box2D), and all seemed well... until I started to think on level creation. While using Cocos2D, I was placing/tweaking every object in code. It's essential to have some kind of editor to easily edit/create stuff. I looked at InkScape, a free SVG editor, and was in the process of developing some kind of SVG parser to create my levels. Anyway, seemed too much trouble at the time, so I kinda lost my motivation and gradually suspended my game developing effort.


Recently I discovered LevelHelper. It's basically two things: a really nice level editor and a bunch of helper APIs. You design the level in a separate application and code it in Cocos2D as before, with some added benefits. It's not free but costs like 20 bucks or such. A bargain if you ask me. Anyway, after trying it I'm not going back, and am decided on implementing my game using it. 


LevelHelper also supports other frameworks. One of them is Cocos2d-x. It's basically a C++ port of Cocos2d which allows it to run multiplatform. I've asked the author of LevelHelper if he plans to keep the compatibility with Cocos2D-X, which he confirmed. Thus, I'll used Cocos2d-X for my development.

Although I don't dislike ObjectiveC, I prefer C++. If I ever manage to finish my game, and eventually want to port it to Android, it will be a walk in the park, as it also supports C++.

To sum it up, this is where I stand now. Developing my game using:
  • LevelHelper
  • Cocos2D-X with Box2D (C++)
  • XCode 4.3
It's all still in a very early phase, but I plan to post some stuff on game development in the context of these tools/libraries.


  1. Indeed, Xcode is far behind from VS or NetBeans or even eclipse. And back then I had to pay 4€ (now I guess it's free)!
    Anyway I'm also trying to find some few secs in my life to dig into this iOS dev.
    If you have some good documentation, please let me know.
    BTW nice blog...
    1 Abraço do amigo Venancio