Libgdx vs Cocos2D-x – Which One Should You Go With For Android Game Development?

By | October 29, 2014
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

For developing games and apps on the Android platform, Cocos2D-x and Libgdx are by far the two most popular development systems. In what follows, we do an objective comparison between the two frameworks.

 

A week or so back, we had done a comparative study between Cocos2D and Unity3D, to find out which one of them was the more user-friendly framework for game development. Many readers felt that it was not exactly fair to pit a 2D tool with a 3D system. Also, it would be more to the point if we focused on games and apps on a single platform at a time. In this piece, we will compare Mario Zechner’s Libgdx with the ever-popular Cocos2D-x, on the basis of certain select parameters. Read on to find out which one comes out to be a better tool for programmers:

 

  1. Documentation – There are online tutorials for Cocos2D-x, but newbies might struggle to find reliable learning resources. Libgdx edges ahead in this regard, since Zechner had created a full book (named ‘Beginning Android Games’, ed.2), to familiarize game and mobile app developers with the framework. Once users read the book thoroughly, they will get a hang of Libgdx, and can proceed to make their first Android game.
  2. Frames-per-second performance – This round is a close one. Cocos 2D-x offers a fairly impressive 50 FPS performance on average, and it is relatively steady too (except on certain devices). This is slightly higher than the 30-35 FPS performance that Libgdx. The only snag is, while Libgdx promises reliability across all devices, while Cocos2D-x can be vulnerable at times.
  3. Programming knowledge – Android app developers tend to be more proficient with Java than C, C++, or Objective-C. That, in turn, makes the learning curve for Cocos2D-x rather steep. With Libgdx, there is no requirement to learn up a new language. Going through all the available tutorials (and of course, the book) should suffice, along with a working knowledge of the Java language.
  4. ‘Retain-and’-Release’ vs ‘Pooling’ – Cocos2D-x has a ‘retain-and-release’ system, which is comparatively simpler to that of ‘pooling’ in Libgdx (hardcore Java fans might just disagree here!). If you have prior experience in HTML5 coding, you can write your native Javascript programs in Cocos2D-x. The APIs are much more user-oriented than the Scene2D API on Libgdx. Android app developers would need to invest much more time to become comfortable working with Scene2D.
  5. Platform optimization – For all its robust framework, Cocos2D-x remains a system that is primarily meant for iOS game and app development. It has been expanded to include the Android platform, and it works relatively fine. On the other hand, Libgdx is focused for the Android ecosystem, and can be expanded to create games on the iOS platform too. For first-time Android developers, it is always advisable to start off with Libgdx – since it was created with that platform in focus.
  6. Community support – Although the available documentation for Cocos2D and 2D-x is nothing to write home about, there are plenty of online communities and forums – where coders can interact and get their problems sorted out. The community support for Libgdx is, if anything, even better. Whenever you get stuck while coding for a game, you can seek help at the forums, and be rewarded with viable solutions from experienced Android game developers. It would be fair to say that finding online help is equally easy for either framework.
  7. Deployment – In terms of desktop deployment options, Libgdx has a slight edge over Cocos2D-x. On the former, the entire Android app/game development process can be done on a Mac/Linux/Windows system – and with a few extra lines of coding – it can be replicated on mobile devices. Cocos2D-x also supports OS X, Linux and win32 systems – but developers need to use emulators and devices as well. Using emulators is something most developers don’t look forward to. For new programmers, they can seem too complicated.
  8. Managing textures – Texture Atlas is one of the best features of Libgdx. All the textures can be loaded together at the very outset (although a memory allocation problem might crop up if you do so). Texture atlas management is possible on Cocos2D-x too, but for that you’ll have to master the inheritance program codes first. Working with textures is arguably the most critical part of mobile app or game development, and both the frameworks offer fairly optimized ways for handling the task.
  9. Speed – Not much to choose between the two game development systems here. Both Libgdx and Cocos2D-x are fast (provided that the developers are competent enough!). If one really had to pick, the stability issues with Cocos2D-x would put it at a slight backfoot in comparison with the other system. Since real-time code viewing is possible, there are minimal chances of coding errors remaining unnoticed on either system.
  10. Demo games – Finding a demo game or mobile app created entirely with Cocos2D-x can be a trifle tricky. However, for demo projects with Libgdx, all that you have to do is visit Javadocs. Over there, you will find detailed documentation of Libgdx codes. Demo games can be checked out as well. Mastering Cocos2D-x is just a tad tougher.
  11. Portability – It is a mystery why Cocos2D-x withdrew its Box2D support. With Box2D, porting game platforms to Android (although the code wasn’t particularly easy) was possible. However, with that gone, games and apps have to be created from scratch on Cocos2D-x for Android. Libgdx, of course, was always meant for Android game development. This is the main reason why mobile app companies advise first-time Android coders to start off with Libgdx.
  12. Code design environment – In terms of ease of usage while coding, both Cocos2D-x and Libgdx are at par with each other. There is not too much of data inheritance or abstraction in either (if anything, it is even lesser in Libgdx). Within 48-72 hours, you can familiarize yourself with the coding design in either of the platforms.

AndEngine is yet another Android game development tool – but it is mostly used by students, and is pegged back by extremely poor documentation and community support. There is no room for doubting the usability and efficiency of Cocos2D-x as a nice, user-friendly system for Android app and game development. However, when all the above points are considered, it would probably be outranked by Libgdx. For iOS though, Cocos2D-x is still the best.

 

If you develop games for the Android platform, do let us know which framework you use most frequently.

 

Hussain Fakhruddin
Follow me

Hussain Fakhruddin

Hussain Fakhruddin is the founder/CEO of Teknowledge mobile apps company. He heads a large team of app developers, and has overseen the creation of nearly 600 applications. Apart from app development, his interests include reading, traveling and online blogging.
Hussain Fakhruddin
Follow me

Latest posts by Hussain Fakhruddin (see all)

 

Leave a Reply

Your email address will not be published. Required fields are marked *