Cocos2dx Migration -> Fifth update (32 hours) The meat of it

I’ve done thousands of lines of code in the last few days, and 32 hours. The main benefit I have is the speed at which I can type, moving between the languages is easy enough, the only slowdown is when you hit something platform specific (reading / writing files for example). Once you get over those hurdles things move quick. Now I’m in the much of the ‘boring bits’, this is where I’m basically just going through the code and translating it.

The benefit I have is the existing OBJ-C app has shipped on two platforms already (iOS/MAC) so I know the code all works, and when something doesn’t it’s usually something as simple as a variable not copied correctly. I wish I could say I have a real easy method of doing this that I can share with others, but the truth is, I have a single workspace and I jump from the original code to the new code and copy and paste, then re write the methods using the original code as a reference. It’s all pretty easy going, just time consuming.

I was on holiday for a few days, so I just got about 2 hours a day in, but still I’ve made a lot of progress, and have just 16 hours left to go (hopefully). Here’s the major bits I did.

Since android will be the first release, I started doing some Android specific things. First was to implement the ad networks for the app (as it’s free on mobile and ad supported). I had done this before, but anything with Android / Eclipse is always a new learning experience for me no matter how much I do it. I just never enjoy it and my brain flushes it out immediately after I do it. Regardless, after a few hours it’s all up and running. Now I’m going through and porting more of the core classes and views into the app. The good thing is about 20% of this code comes from shared classes I use on my other apps. When I do an iOS project I usually have about 25% of the code ready to go from frameworks / root classes I’ve created. Now I have these in cocos2d-x (versus obj-c cocos2d).

I’ve always prototyped in OBJC because it was easier to get started because I have so much pre-work done. But now with this project I’ve translated a bunch of shared things from OBJC->C++, so possibly (and hopefully) I’ll start doing my prototypes in C++ using cocos2d-x now, so I don’t have to revisit this exercise again! The cocos2d(x) framework is very easy to understand once you use it a while (i’ve used it exclusively for > 2 years, and have done about 130 prototypes, 8 commercial apps in it. The only thing officially missing from cocos2d-x is full MAC support, I know it’s in development, but with cocos2d I have it out of the box currently, which is why I start there. Also other platforms (aside from iOS/OSX) haven’t proven fruitful yet. But I do like the idea to grow, and is why I like the C++ work in cocos2d-x.

Anyway, so we have the core game up, we have the ad support, the main menu brings you to the game, you can play it, start a new match, all the animations works, etc. What’s missing, scoring, game over handling, other menu items, pop up notifications within the game.