3D API Changes & Move to Core

Bach has done some work the last few days on moving parts of the model-loader extension to core and cleaning up the 3D support in core.

This means that if you work on the 3D API on a fork, you’ll have to adapt your changes to core now. Also, we removed support for MD5. This will be remedied by a loader for (skinned) FBX models in the near future.

More updates on the 3D API soon, stay tuned.

Libgdx 2012

Time for a review of what happened in libgdx land in 2012!

It all started off with me coming back from San Francisco and having a bit off a cool down period. The first thing i did was rework the entire build system, cause i like pain, and create a way to more easily write JNI bindings manually. The end result was gdx-jnigen, a project that let’s you add C/C++ code directly to your Java source, does some parameter transformations for you (e.g. get pointers to direct Buffers, arrays and so on) and create build files for multiple platforms based on Ant instead of make or cmake. The code inlining is largely inspired by GWT’s JSNI. Here’s an example of how it looks:

Nasty, eh?

Next, i translated all our native code to gdx-jnigen and created a couple of extension projects. The first one was gdx-audio, including decoders for MP3, Ogg and Wav, to get raw PCM data, Soundtouch to do time stretching and pitch manipulation and KissFFT for fourier transforms. gdx-jnigen turned out to help tremendously with this and made working on the bindings almost effortless.

After the excourse into native land it was time to work on battery saving a little. We introduced non-continuous rendering and i reviewed the battery usage of one of my apps to give some insight into what to expect.

Rapid development was one of the biggest reasons why i started working on libgdx. Tools like texturepacker that run offline hinder me a little. Always having to start a preprocessing process before being able to view the results isn’t fun. That’s why i implemented PixmapPacker, allowing me to pack textures on the fly during runtime. This of course has a few downsides, e.g. worse packing behaviour and additional loading times, but for rapid prototyping it helps a lot.

Freetype support, to load arbitrary TTF fonts at runtime, was next on my list of things to add. With gdx-jnigen and the PixmapPacker that was a rather simple task, even though there where initial hiccups in terms of memory leaks and similar issues.

We also extended our file handling with a new file type, called local. Don’t ask…

I finally had time to work on the HTML5/WebGL backend based on GWT, triggered by PlayN’s availibility on that platform (can’t have them steal our wind! :). It took a lot of pain and tears, e.g. i had to add reflection to GWT for Nate’s fancy UI stuff to work, among other things. Ultimately it turned out to work pretty well, and there are already a couple of games running on WebGL and libgdx and few of them made it to facebook.

We didn’t discover any big Android issues this year, the platform seems to be rather stable now, safe for some device manufacturers incapability of providing working MP3 and OGG decoders. Well, and this little nasty bugger. Android counts direct Buffers against the Java heap, which means Java based games have a clear disadvantage compared to native code games when it comes to available RAM. We “fixed” that in libgdx.

We started the documentation initiative and are rather happy with it’s outcome so far. Our wiki has grown considerably and we also received quite a few pull requests for Javadoc additions. Documentation is an on-going effort, and we strive to improve it all the time.

In May we discovered that AppBrain reports us to be the #1 game development framework on Android. All of these numbers are of course to be taken with a grain of salt, but we seem to make an impact. Unity has closed the gap somewhat. I’d attribute this to the Unity guys offering the mobile licenses for free for a limited time. I guess there’s room for both.

In the light of our growing user base, i felt it necessary to overhaul our website. The end result is as good as i can make it with my limited web development skills. Not stellar, but functional. And most of all, all information is gathered in a single place, including Twitter and the blog.

In June i started working on our iOS backend. Instead of Avian, i now took the same road as PlayN, using Michael Bayne’s IKVM fork and MonoTouch. This became a real team effort, with Gemserk (Arielsan, Ruben), Noblemaster Games and others chiming in and providing tons of improvements and fixes. A couple of games have already been published to the App store. I’m currently working on getting things integrated in the gdx-setup-ui.

Nate started his great refucktoring of the scene2d API in June. A little later we had the “GREAT MERGE”, when we released 0.9.6 stable with the old scene2d, and switched our trunk to the new API. Initial reactions where mixed, but after a while the dust settled and the overall sentiment seems to be in favor of all the nice new things. Shiny wins.

In August we had our diaspora to Git/Github, much to the joy of Nate who had to correct his workflow. On the upside, we received around deprecated our Jogl backend in august. It was based on the old 1.1 release and a big maintenance burden. Given the completeness and stability of the LWJGL backend we decided to kill it. Sorry Jogl, maybe we’ll meet again in the future.

One of the biggest helpers in getting libgdx out to the people is the gdx-setup-ui. It makes setting up the multiple projects for Eclipse extremely simple. Our good soul and Swing magician Obli is constantly improving the app, showing that you can actually create nice UIs with Swing. Obli’s also been contributing other things like the box2d editor.

I was invited to Apps World 2012 to speak on HTML5 and mobile gaming, as well as my book and libgdx. It was a blast! I meet with a few libgdx folks there, including Badly Drawn Rod and Exobyte. Nate and me have been invited to Istanbul earlier next year, maybe there will be more speaking oportunities coming up. If you are an organizer, feel free to ping us. We like talking without end!

We also extended our functionality on Android by adding a Livewallpaper backend as well as a Daydream backend. Ouya is sending us a dev kit so we can get some Ouya specific things into our APIs as well. Good times.

To round things off, we (almost) finished Maven integration for libgdx. I actually prefer using Maven myself for various reasons, so this is not good for our users but good for myself as well. Stay tuned for more updates on this in the coming weeks.

Of course, there’s a lot more that happened, from new contributors joining the project, to tons of bug fixes, sleepless nights, hangouts and so on. I guess the above gives a good indication of how much we achieved this year.

Happy new year, and let’s make 2013 even more successful!

Libgdx now supports Daydream mode on Android

Thanks to contributor talklittle, you can now write Daydream apps with libgdx. Daydream apps are a new feature in Android 4.2. When idle or docked, a 4.2 device can display information like a photo album and so on.

Daydreams are pretty easy to create. Here’s the one from our test collection:

Extend from AndroidDaydream, then override the onAttachedToWindow method where you create your ApplicationListener and register it via the initialize method. Note that you have to call the super onAttachedToWindow method, just as you have to call onCreate() for a normal AndroidApplication.

You can have a separate standard Android activity that lets a user define specific settings. If you do that you also need to add an xml file in your Android project’s res/xml/ folder. Here’s an example daydream.xml:

In addition to the AndroidDaydream and the settings activity, you have to register a specific service so your daydream is available to the user. Here’s an example snippet from the AndroidManifest.xml file:

And that’s it.