This week was interesting.
I finished porting to Sprite Kit. Unfortunately I had severe performance issues in scene transitions, interrupted actions, and, most importantly, tile placement. I’m talking about a difference of a tenth of a second placing a tile in cocos vs 2 seconds in Sprite Kit!
I had a bit of a stab at correcting it but couldn’t find an obvious culprit. In fact it seemed to be many issues at play. Was it ARC causing the issue?
I decided to run a little, non-scientific, test. I converted my cocos2d 2.0 version to ARC to see what the difference was. Alas, no difference to the original game. It wasn’t slow and performed just the same.
So, who’s to blame? Well, I’d hazard a guess that its me :)
Some part of the way I’m coding the game is not playing well with Sprite Kit. Obviously when you write a game on a framework, you’re constantly running it, testing, adding more code. Issues are solved as you go. The thing is, I don’t have the appetite for, what could be, a huge rewrite.
Then I noticed that cocos2d 3.x has been released. A semantic tidy-up of the library code with some underlying changes, and a bunch of new features (that I most likely won’t use). Did I dare try it?
Yes, I did. I ported to cocos2d 3.x. It took a little time and involved replacing some elements, renaming methods, replacing the audio library etc. But it worked.
Its just as fast as the cocos2d 2.x version and I’m now using ARC which should limit memory issues.
The final piece of the puzzle was to ensure that it was universal from the start. That’s also nearly done. At least at a superficial level.
It wasn’t quite as I intended but I have a new starting point running on slightly more future-proof code along with a universal build and the benefit of ARC.
If I were to start a new game project I’d most likely still opt for Sprite Kit. For this project though, cocos2d will remain the underlying framework.
So, what’s next?
I want to get a little more of the game working on the iPad (without any layout reworking). After that I intend to review a level. I’ll list everything that is missing or needs improvement. The intention is to create a vertical slice that is as polished as possible. A yardstick for the final game.