Monday, December 9, 2013

LibGDX

Ok, I'm trying again to talk about LibGDX.

When I got it in my head that I was going to make a new game, I wanted to make my life easy, and actually have hope of getting it done in some reasonable amount of time, which meant using an existing game framework/library.

On Anguna, it was a lot of fun building everything from scratch, but I spent A LOT of time just doing the basics: animating sprites, building characters out of multiple sprites, getting backgrounds to scroll properly, etc.  On an device like the GBA, learning the weird tricks to do all that was a lot of fun. This time, on a modern smartphone platform, I just wanted to spend my time focusing on the game.

So I started evaluating different tools.  Unity and Marmalade (which used to be called Airplay, which I originally started using for the iPhone port of Anguna) are the two that seem to have the most use, but are also a bit expensive these days for a hobby project that might never get finished.

So then I stumbled upon LibGDX. It's a free open-source framework. You write your code in Java, and then it can be deployed to Android, Desktop, Html5, and iOS (using RoboVM). While Java has its warts, it's easier to be productive in than straight C or C++, which are often the alternatives. And doing my daily development on the JVM is really nice, as I've still never found a better platform for debugging code. Being able to hot-swap code during a debug session, then drop back to the stack frame and re-test makes some things SO much easier to get right.

Some other things I liked about LibGDX:

- It's open source, and has a pretty friendly and decent community. I like the idea of open source, particulary for hobby projects. But some open source communities and personalities are downright obnoxious. This one seems to be pretty cool. And they do a decent job of documentation.

- There's good support for existing tools (ie loaders for Tiled and other map editors), so I don't have to spend as long figuring out how to massage my assets to get them into the game.

- Like many of these other platforms, it is set up for 3d support, but has a pretty easy 2d api for people like me that just want to make a simple 2d game without worrying about 3d graphics math.

- Although most of the projects in gallery look pretty janky and homemade (like mine!), there are a few examples (Ingress) of "real" games that are using it. So at least it's mature enough for a real game.

So now that I've decided to use it for my project, I haven't really hit too many warts yet. That's a good sign. I ran into one place where the default Tiled map loader was pretty inefficient for large but sparse maps. Being open source, that was easy to fix. Overall, though, I've been pretty happy. It gets out of the way and lets me write my game.

No comments: