Current state of game development for mobile, specifically Android, looks optimistic. A new or an experienced game dev has a handful of options to pick from, ranging from their skill level, project size, game complexity and other factors.

Two different worlds

For easier comparison, I divided tools into two categories. First one are Java frameworks like libGDX (and AndEngine) and second one are complete game engines like Unity (and Unreal Engine). In this article I will compare libGDX and Unity as they are the biggest game making tools for Android platform.

libGDX and Unity are both tools for making a complete game, for sure, but essentially quite different. On the one side we have libGDX, which is a framework and not a game engine. On the other side, there is Unity, which is a game engine. Both of these tools have their benefits and limitations. So, to choose between them you need to determine your requirements.

Like:

  • Which platforms do you want to support – both Unity and LibGDX provide a way to make a game for Android and iOS or desktop
  • 2D or 3D – both tools support 2D and 3D but libGDX is for 2D mainly and Unity for 3D
  • Primarily code or GUI creator – do you want to code in IDE like Android Studio/Eclipse/.. or you want to have a user interface where you can drag and drop objects and write code on the side
  • Programming language – libGDX utilizes Java, Unity utilizes C# or Javascript
  • Pay for professional tools or use open source – libGDX is free, repo on Github while Unity has a free version with some shortcomings and paid full version
  • App size (minimal Unity Android project is about 8MB, while libGDX is about 200kB)

LibGDX

LibGDX is an open source framework maintained by BadLogicGames and contributed by many (at the time of writing this article it currently has 270 contributors on GitHub repo). You can read about history of LibGDX here.

As libGDX is a Java based it is well-suited for Android developers to start building games with. libGDX is cross platform tool so you can make games for Windows, Linux, OS X, HTML, Android and iOS (running Java code in RoboVM). iOS is a bit delicate but I managed to get it working and deploy a game to an iPhone device. Some parts of the engine won’t work on iOS but in my experience they were not detrimental in making a game.

In making a mobile game, you probably won’t target desktops to support your game but there is a nice benefit for developers. If you have spent some time in making apps or games for Android you have found that deploying a build to Android device or emulator can be slow. And I mean painfully slow. Genymotion is a great Android emulator but with libGDX you can deploy your builds to a desktop and debug or iterate your game almost instantly.

Structure of libGDX project 

In libGDX you get complete freedom to do anything as you like. Structure of a game is strictly up to you, for better or worse. If you want to get down to low level, you can always use openGL, as it is exposed and you can manipulate it as you want.

On the other side, numerious APIs which can handle inputs, graphics, audio, networking, assets managing (and others) will solve a lot of technical problems you could run into.

One of the things I like most is how easy is to combine it with native Android code. If you want you can add a libGDX as a view into your game/application and write rest of the code in Android – like networking, ads, Google Play Services and else.

Unity

Unity is a full featured game engine developed by Unity Technologies. It beginnings are somewhere in the early 2000s, started by three programmers. You can find a nice summary of the history of Unity here.

As opposed to libGDX, Unity is a closed source project  which is understandable as licensing Unity is their core business.

But also, being a proprietary software has its ups and downs. All the features can be costly for a small indie studio but even for a decent game a free version of Unity can make wonders too. Positive side is that it’s heavily developed on and the Unity team is constantly adding new features.

GUI editor with drag’n’drop

First difference you will notice when starting Unity is that its main feature is a GUI editor, opposite to libGDX which is mainly code based.

A lot of game making is done by dragging and dropping things, like game objects, interactions between them and other. One creator of Unity said that you could make a game without writing any code. My guess is it would be possible but for adding a bit of complexity to game design, you will need to code some. Languages that you can choose are C# or Javascript.

Free version of Unity will be enough to make a multiplatform game targeting iOS, Android, Windows, OS X and many more (whole list here). Like I written before, Pro version can end up being quite expensive. I wouldn’t worry about getting a Pro version of Unity unless you are quite sure in choosing Unity and have experience with it.

How to choose?

libGDX and Unity are ones of many tools that exist for building mobile games. Like libGDX there are AndEngine, cocos2d-x or PlayN and Alternatives to Unity are Unreal Engine, CryEngine or GameMaker. With simple Google search you could find many more.

My personal rule of thumb is to use libGDX for 2D and Unity for 3D. For mobile games it would be: libGDX for Flappy Bird, Angry Birds or Candy Crush Saga type of games and Unity for Fruit Ninja (orthographic camera with 3D models) or Temple Run-like games.

Conclusion

Both of these tools are here to stay. libGDX is  becoming the biggest framework of its kind and Unity is by far the largest indie game making tool. You can’t go wrong with either of them.

Making a good game is not risked by choosing a wrong engine. They are just a tool for the job. If you didn’t choose an engine you want to develop your game with, try them both out. The best way to find what you like or don’t like is playing around with the tool.

Finishing a game, no matter what the outcome is, is a great feeling. But just an act of building a game can be fulfilling and fun, so choose a game engine that will cater to your needs.

Here is a link to start developing with libGDX: https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

or if you want to go the other way, here is a link to download a free version of Unity: http://unity3d.com/unity/download

  • max

    Nice article but it seems that I have to try both of them to make my own opinion :)

    • Dario Penic

      Thank you Max. :)
      Please get back to me when you try them, I’m interested in what others think about which engine is better.

      • I made a 3D Android game using libgdx back in 2011. I actually contributed a little to improve 3D skinning animation performance and model loading. Overall it was a great experience, I shipped my game thanks to libgdx being a nice framework to work with.

        I’ve also made quite a few smaller games with Unity3D (as a day job!). Again a great experience but in a different way.

        I think the 2D / 3D thing is a bit deceptive; for me it’s more about tooling. Unity’s editor and IDE, with the debugging and profiling power it gives you, can be extremely useful. But libgdx has a big ecosystem too, things like Spine have given it a big boost for doing 2D graphics. So maybe tooling-wise, libgdx just has more available in the 2D space. But for actually writing code, it’s got decent 3D support.

        Try to choose the best tool for the job! IMHO these are both top in class tools for indie game devs.

        • GamerzX

          I have just started with Unity, I needed to make a game for a project in a few days and it has excellent tutorials up online. I also bought the book about Libgdx so that I can start making better games with more powerful tools :)

  • micabyte

    But which to choose for a heavily GUI + text based pprojec?

    • Dario Penic

      I would probably go with native experience here and use Android SDK with it’s own views and lifecycle.

      • micabyte

        Makes sense, I guess. Would love to move to one of these frameworks, but they still seem a little bit lacking when it comes to this sort of thing. Hoping to one day see a framework that makes building 2D applications with complex GUIs as simple as the native Android SDK for cross-platform. I’ve seen Mario (the libGDX guy) talk a bit about creating a 2D framework, and there’s Overlap2D in the works as well, so I’ll keep hoping. :)

        • Dario Penic

          I would also like to see something like that. Cross-platform, when it’s done right, will be the next big thing. Did not know for Overlap2D, I’ll check it out, seems pretty cool, thanks!

  • Adwaith S

    Awesome content dario! Thanks for that.
    My current doubt is, can I make a smooth side scroller game with decent graphics using libgdx? All the games which I found in Google play and libgdx forums lack the quality (game flow wise and graphic wise) which I’m expecting.

    • Dario Penic

      Thank you for kind words Adwaith. :)
      It really depends on what is your definition of decent graphics. If you want a side scroller with 2d player/enemy sprites and parallax background but which are drawn amazingly – that can be done with libGDX. Also you can make it look smooth, responsive and great. But if you want some 3d models in a side scroller with a lot of animations, then I would suggest something else. Not saying that it can’t be done with libGDX. It can, but it could be a bit tricky.

  • Pingback: Unity vs. Libgdx | Melloland Games()

  • Camilo José Ortegón Barajas

    You tell everything any needs to know to have a brief description of what can we face to in both tools.

  • tian

    I think the overlap2d has so much bug. and libgdx just need a ui editor!!!

  • MaelStrom Reigi

    If you don’t mind, how about stuff some of the engine’s game.

  • Julien Villegas

    I am personally a big fan of LibGDX (Although I have mostly used it for 2D games).
    The Java framework is mature and the community very helpful. There are many tutorials and people will answer your question on stackOverflow, very quickly.

    That said, it is true that Unity is massive and has far more resources available.
    There are arguments against starting with such head start (This blog post is quite interesting: http://gamkedo.com/how-to-program-games/ ).

    In my personal opinion, one of the drawback from LibGDX is that it is mostly used by Java developers, such profile is not particularly good with graphics, and there are a lot of Java developers out there. What it means: many games with chunky graphics are being published and give an impression that it is hard to produce a polished looking game. The point is: your game will be as good looking as you make it.

    Some tutorials on getting started on LibGDX here https://libgdx.info/

    Game Engine ranking: https://www.slant.co/topics/1476/~2d-game-engines-for-android

  • luzan

    Very nice read!

  • Ladik Jechů

    Hi Dario, I am working on some experimental project which outputs models as voxels in .obj (triangles or quadrilaterals). Now imagine I would like to start building some universe where I would like to manipulate/animate these models/objects. The number of objects could be quite hi (thousands and more). What framework with Java support (if any) would you recommend? My high expectations were at libGDX, but more I read I get impression about it more focus on 2 dimensions only/mostly. Thanks for great article.

  • Thanks for sharing the information. It is very useful for my future. keep sharing

  • Ric868

    Nice article dario, I have one question for LibGdx, is it possible to make gui with drag n drop in a simply way?

  • Theresa Moore

    Thanks for compiling such nicest information in your blogs. Articles are very informative and hope again I’ll find more like that from your blog.
    Stardew Valley Abigail

  • Mohit Singh Rawat

    Amazing blog man… it cleared my mind which platform or engine to choose for making games. Thank you for this article.