Open Source Software Review: libgdx

 libgdx logo white bgIn the first of what I hope will be a series of posts on Open Source Software development, I am reviewing libgdx. The goal of this post is to review libgdx to see if it satisfies the three prime directives of open source software.

If it does satisfy the three prime directives of open source software there is a greater chance that the project will be shared, continue to be supported, and a vibrant community will remain active in maintaining it.

Libgdx is “a game-development application framework written in the Java programming language with some C and C++ components for performance dependent code. It allows for the development of desktop and mobile games by using the same code base. It is cross-platform, supporting Windows, Linux, Mac OS X, Android, iOS, and web browsers with WebGL support.

libGDX allows the developer to write, test, and debug their application on their own desktop PC and use the same code on Android. It abstracts away the differences between a common Windows/Linux application and an Android application. The usual development cycle consists of staying on the desktop PC as much as possible while periodically verifying that the project still works on Android. Its main goal is to provide total compatibility between desktop and mobile devices, the main difference being speed and processing power.

libGDX uses some third-party libraries to provide its functionality, these include Lightweight Java Game Library, OpenGL, FreeType, mpg123, Vorbis, SoundTouch Audio Processing Library, Box2D, OpenAL, and Kiss FFT.

– Wikipedia

Let me explain something

I’ve been making video games for the iPhone for 6 years. When I started I did not want to learn OpenGL to create animations in my games. It took too much programming to do a simple animation. I needed help. I wanted to create a game quickly. I needed a game framework or an engine.

Frameworks are code libraries that add functionality to existing code. Engines impose too many restrictions to make them useful for “riffing” on new games. I needed a framework. I needed something fast. Enter Cocos2d.

Cocos2d has fantastic documentation and a thriving online community that answered my questions quickly. Cocos2d was so good Zynga, makers of the fantastically popular game Farmville, bought the company and the framework. Thankfully they kept the code opensource.

The only problem with Cocos2d is that it only builds to the iOS platform. There is no support for porting your game to Android, Desktop, Linux, or HTML. When I ported Mathogen to run in the browser, I had to convert each function in Objective-C to a corresponding function in ActionScript 3.0. This took too much time. This was the opposite of “riffing.”

Enter libgdx.

Making it easy to understand libgdx

Thankfully the steps described in the README.md on the libgdx github project page tells developers exactly what they need to do to get started using libgdx.

  1. Set up the IDE to run libgdx.
  2. Create a new project.
  3. Link to the wiki that explains how the application framework works, how to contribute, and the contributor licensing agreement.

Reviewing libgdx

I will be reviewing libgdx according to the three principles of open source software by attempting to install, run, and contribute to the framework.

Three prime directives of open source software:

1. The system successfully accomplishes a useful task.

Libgdx allows the developer to write their code in Java. Libgdx takes advantage of the Java Virtual Machine and its ability to run on multiple platforms. When I write a game in Java with libgdx I will never have to rewrite it for different platforms.

Libgdx allows developers to write once and deliver everywhere. I am excited to have found this new framework. It may take a little time to learn the new animation methods but the cross-platform compatibility of the resulting code will make learning the new framework all worth it.

2. An external user can successfully install and use the system.

I downloaded the zip file from the libgdx github page. I will be using Eclipse to create games with libdx. I followed the guide for Setting up your Development Environment (Eclipse, IntelliJ, and NetBeans) that was linked for the project’s main github page.

According to the guide, the first thing I needed to do was ensure that I had Java 7. I was able to update this on my mac by navigating to ‘System Preferences’ -> “Java.” The installer took care of updating Java on my computer. First step down, five more to go.

I already had Eclipse 4.4 Luna installed on my mac so I could skip the step about installing Eclipse on my mac.

Next, the guide says to install the Android Development Tools for Eclipse. I believe the wording on this page could be much clearer. As a developer who is relatively new to using the Eclipse IDE, the wording on this step, “Use this update site:” could and should be updated to make the step more understandable.

I would suggest they update the instructions to something more understandable like RoboVM has on their page for installing the RoboVM Eclipse plugin. This step would be clearer if they updated the instructions to read:

Install the Android SDK for Eclipse plugin from the following update site under Help → Install New Software in Eclipse:

https://dl-ssl.google.com/android/eclipse/

I wasted 2 hours fiddling with the Android SDK installer only to find out that I could install the Android SDK from within Eclipse:

Screen Shot 2015-01-23 at 8.05.28 PM

Next I installed “Eclipse Integration Gradle” and the RoboVM plugin with the supplied links with no problems.

Before I move on to creating a new project, I wanted to comment on how this guide can be updated to prevent other developers from getting confused.

Now that all the tools can be installed within Eclipse 4.4 Luna, I believe the maintainers of the Setting up your Development Environment (Eclipse, IntelliJ, and NetBeans) page should update the section on “Setting up Eclipse” to make the instructions clearer. Users need to know that they don’t need to navigate outside of Eclipse to get the code they need to make libgdx compile and work.

Finally I was ready to create a project. Exporting the libgdx project to all supported platforms took about 5 minutes. I followed the instructions, opened the existing project in Eclipse and ran it as a Java Application.

Screen Shot 2015-01-23 at 8.49.03 PM

3. An external developer can successfully understand and enhance the system.

The included wiki explains how the application framework works, how to contribute, and the contributor licensing agreement.

Screenshots showing my progress

This slideshow requires JavaScript.

Final Review:

libgdx fulfills all three of the prime directives of open source software. My suggestion to the maintainers of the guide for setting up libgdx in eclipse would be to update the installation guide to show that all the tools necessary for creating games with libgdx can be installed from within Eclipse.

Other than that, I am very happy to have found this game development framework. I can’t wait to start coding once and deploying to multiple platforms.

Resources:

Author: David Neely

Professional Software Developer. Technology and Web Coordinator at the University of Hawaii's Manoa Career Center.