Game engines are an invaluable tool for developers and in my previous article I laid out our transition from using frameworks like Cocos2d and Cocos2d-x to more robust engines for console development like Unity3d. While I love using Cocos2d-x for mobile and have used it for years, Unity3d also supports all mobile platforms. Can we commit to using just one engine for our mobile development needs? If so, which one will better suite our needs?
The biggest concern for any independent developer is pricing on tools, and while they are both free up front, Unity can get pricey if you want certain features like a customizable splash screen or source code access. Cocos2dx is free and open source so you get the ability to customize your game to the max with out spending a penny on the engine. So Cocos2dx gets the first point! As far as your budget is concerned, you may want to consider some of the external tools that both engines support. Here is where Unity3d earns its first point. While there are plenty of tools that make developing in cocos2dx easy (for example Texture Packer and Physics Editor), Unity has an entire store dedicated to assets and scripts that you can purchase to fast-track your project. As far as third party tools, they are both popular engines so you can bet most tools will have run-times to support either. On of our favorite tools here at Black Hive is Spine (for 2d skeletal animations) and yes they have run-times built in to Cocos2d-x and it is easy to use in Unity3d. So they are tied at 2-2, since I'm giving them each a point for Spine support.
Aside from pricing, my second criteria is the platforms that the engine does or will support. If you are just targeting mobile platforms, Windows, and Mac, then you have your pick here. If you are looking at porting to consoles, well Cocos2d-x just isn't there yet. Unity3d supports pretty much any platform, plus they are usually on top of new consoles (even the recently announced Nintendo Switch). Since this discussion is mostly from a mobile developer stand point I will give Cocos2d-x a point here, but also Unity gets another 1.5 points for going beyond our needs for platforms. And while Cocos2d-x (IMHO) should be focusing their efforts on supporting consoles, instead they are branching out to 3d and VR. This is great, but first off it's primarily a 2d engine and secondly Unity3d is already there. So another point for Unity3d, since you can build games in 2d or 3d with out any constraints. Also, I want to be fair so I'll give Cocos2d-x half a point for 2d with some 3d support.
Now that we have the very basics out of the way, what about actually using the engines? Well, before you can use it you have to install it and depending on your OS you may have a different experience. I've used Cocos2d-x on Mac and Windows and the installation process is just slightly different on each. If you are a beginner and just starting with the framework, dealing with Terminal or Command Prompt can be intimidating, but there are several walk throughs or you can opt for Cocos (the GUI editor). For Unity3d, there is a package installer so no need to do anything other than click through a few dialogue boxes. I'm giving Unity the point for install, cause it's basically the same on any OS and with out the need for writing any code. Once you have you engine installed, you also have to install all the Android packages if you plan to deploy to it. This is the same for both Engines, so neither get a point here.
Now that we have installation and coding language out of the way, lets get to the fun stuff…engine features! They both have animations, physics, support for external SDKs and runtimes that have ads and analytics, but how about the ease of use for all this? Both have their fair share of documentation and tutorials, but one thing I find really useful are online courses like through Lynda.com and Udemy. Unity3d and Unity 2d courses are plentiful on both these sites, so you have your pick of walking through the process with an instructor as well as sample code. And though Ray Wenderlich has plenty of Cocos2d-x tutorials, there are even more for Unity, so Unity earns another point here. Now, to be fair you pretty much HAVE to read a book or take a course to get started in Unity since the GUI is so complex and things can be tucked away in the menus. On the flip side getting started in Cocos2d-x is pretty simple. There is a sample project of all the scripts you can use and demos of the features, so you can just pick a few to paste into your Hello World project and get coding. So for it's approach-ability Cocos2d-x gets a point here!
Creating my first game scene in each engine was a stark contrast to the other. Like I mentioned, I've been using Cocos2d-x well before they had a GUI, and I've yet to dive in to it so take this with a grain of salt. Unity has pretty much always had this, so my only experience with it has been using the albeit complex editor. But after a few tutorials I had a pretty good understanding of the editor, as did my artist and hubby, Blake. Needless to say, I had to write very little code and do hardly any work to get a basic game scene going in Unity, it was all on the artist to make it look great. It was a completely different experience in Cocos2d-x since I have to place every sprite in code and make sure it is pixel perfect to mock ups. Artists don't have any creative control here, since they basically have to rely on the programmer to implement any assets, lighting and shaders. I'm giving Unity a point and a half here for having a proven editor that works well for both programmers and artist alike, as well as making things like parallaxing and lighting/shading a breeze to deal with. Cocos2d-x gets a half point for making a much needed editor, even though it's late to the party and there will be growing pains with it while they go through iterations.
Every programmers favorite thing to do is deal with version control right? Cause who doesn't like dealing with merge conflicts all day rather than coding. So how do these two engines stack up against each other when it comes to version control and collaboration? Well, anything relating to scripts is easy to deal with, so they are equals here. However, when it comes to Unity, if Blake and I are both editing the same scene it is seemingly impossible to merge the two scenes together since they are exported as an obscure .Unity file. So I'm giving Cocos2d-x the point here for keeping it simple.
Lastly, we have some smaller concerns like how easy is multi-resolution support, can it be added to an existing project, what about deploying to different platforms? First off, Unity takes the point for ease of use for multi-resolution support. No code needed, just change your build settings and maybe your camera settings and you are good to go! With Cocos2d-x you'll need to write many lines of code to effectively achieve the same result. So Unity takes another point here. On adding them each to an existing project, both get a point and both with the same complexity. As for the multi-platform concern, this can be difficult depending on the engine. Obviously, you'll need a Mac with Xcode for anything Mac OS or iOS related for either engine. But in using Unity you will not need to work in the dreaded Eclipse IDE for deploying to Android. In Cocos2d-x you'll have to work across a couple of IDEs which can be a major PITA. So for this I give Unity the point, so let's tally them up!
Price, platform support and ease of use were our three biggest criteria for choosing the right platform. Even though the tallied points put Unity in the lead by 3 points, it's hard to say that we will not continue using Cocos2d-x for some mobile projects. If we do, the determining factor will be the features and ease of use for their editor.
The biggest take away for Cocos2d-x is how easy you can jump in to the framework and start coding. On the flip side, the biggest take away from Unity3d is how you can create a visually stunning game scene with out writing a single line of code. Which do you prefer?