Streamside thought long and hard before choosing the vehicle for our next game. After my first app, I didn’t think I’d create another native iOS app.
I had tried my hand at Unity 3D and found it to be one of the most pleasant programming experiences ever. This is not an exaggeration.
Then Along Came the Apple Watch
The Apple Watch shook up my plans. Unity 3D did not embrace the Apple Watch right away. It seemed like it should be a simple option to add a watch extension target to the code Unity generates, but this did not work.
I had to move forward with my project, so I felt I had two options, SpriteKit, the Apple framework, or Cocos2D-Swift, an open source project that has been commandeered be Aportable. (Note you don’t have to program in Swift to use Cocos2D-Swift.)
I could have easily chosen the SpriteKit option. Last I’d checked Cocos2D use seemed to be in decline.
Then Aportable came along and breathed new life into the project in the following ways:
- They took over development of a killer IDE — Spritebuilder. Spritebuilder provides a great tool for creating and testing timeline animations as well as physic’s based levels. It also handles device resolution issues quite well.
- They created a great route for cross platform migration. Aportable’s main mission is to provide tools for migrating your app to the Android platform. I’m not interested in this, but it’s great to know it’s there if I should ever revisit this.
- Aportable coordinates the release cycle of Cocos2D with SpriteKit and provides updates of both through the Mac App Store. This is convenient, but alas there are currently issues with the App Store version, which I will get to in a moment.
Platform Pro’s
- Free/Open Source
- Timeline animations
- Seemless sprite atlas creation and compression
- Integrated Chipmunk physics engine support
- Particle effects
- Several books available on Cocos2D-Swift (or 3.0) and SpriteBuilder
In my mind the killer feature of Cocos2D/Spritebuilder is timeline animation support.
Games today contain a lot of animations. A tool like Spritebuilder speeds up the process of creating these animations by an order of magnitude. What’s more, animations can be nested, which makes them even more powerful
Animations are able to keyframe animate sprite/image opacity, visibility, scale, position, rotation, skew, color and even a normal map. There are tools for stretching out an animation frames over time or compressing them.
Standard easing functions are supported as well.
In my game this ability to create an animation in an editor has turned into a huge win.
Animations can also call callbacks. This also is incredibly powerful.
Lastly animations can play sounds.
I don’t have time to go into the specifics of how Spritebuilder creates and integrates with an Xcode project, but suffice it to say, it’s seamless.
Platform Cons
- No support for ParticleDesigner plist imports
- Bugginess when selecting colors
- Broken compression
- No quick way to duplicate projects
Currently both Cocos2D and Spritebuilder are both open source projects. This is both a good and a bad thing. The upside is the same upside that any open source project has.
The downside is that there are bugs, and they are somewhat slow to fix them. None of the bugs make this unsuitable for creating a production application. They are more annoyances than deal breakers.
Currently sprite atlas compression is broken in the Mac App Store version. My guess is that this is a sandbox issue, since the same version works if compiled from source.
Compression is a must, so if you want to use Spritebuilder for a production application you MUST compile from source. When this is fixed, I will update this paragraph.
Cocos2D was once fully compatible with plists generated by the ParticleDesigner application. This made creating particle effects quite easy. I had hoped SpriteBuilder would support the importing of ParticleDesigner plists, but alas it does not.
Final Words
It’s impossible to do justice to both SpriteBuilder and Cocos2D in a short post. They are awesome tools.
Yes, it would be preferable to use SpriteKit, since it’s one of Apple’s frameworks, but until Apple adds timeline animations to Xcode, it’s just not as easy to do what I need to do.