libgdx 0.9.8 released – Hello iOS!

I just released libgdx 0.9.8. Here’s a list of things that were added/changed/fixed:

  • Minor changes to the Livewallpaper API. Note that the LWP support is still a little buggy. It’s a contribution, and while i did quite a bit of clean-up it’s still not entirely where it should be. I’d be super happy if someone took on that backend!
  • If you want to deploy to HTML5 you now need to use GWT 2.5!
  • We have rudimentary Maven support. Thanks a ton to Team Gemserk for libgdx mavenizer and all their help with this!.
  • Android Daydream support, a contribution by talklittle! This one is stable.
  • Gdx controllers extension, for Android/Ouya and desktop. HTML5 could be an option too! Volunteers? (looking at you Nex) Some notes on the current stub backend for HTML5
  • The gdx-net API is now part of core. Fetching things via HTTP should work on all backends. Here’s a little test. Big thanks to Noblemaster and Gemserk who led this effort!
  • Not exactly part of the release, but here’s a quick rundown on how to make your libgdx game work with Ouya!
  • Again, not exactly part of the release, but here’s an awesome guide by Swarm on how to integrate Swarm with your libgdx app! Note that you should probably interface the Swarm API so your desktop project continues to work.
  • First release of the iOS backend, read below :D

iOS Backend Notes

After many months we finally release the iOS backend to the general public today! I updated all our sites to indicate that we now run on iOS as well (e.g. Project Setup. I recorded a new getting started video that walks you through the setup and how to run/debug your iOS project.

The iOS backend has been made possible through the work of a lot of folks. Michael Bayne of PlayN and Threerings Fame created the IVKM port that let’s you run Java on iOS via MonoTouch. I added JNI support, as we rely on that for various things like box2d. I also created the initial backend code which was then modified and made tons better by Noblemaster Games, Team Gemserk (now part of Ironhide Game Studios) and Gushiku Studios.

All of these folks have released games with libgdx on iOS already (except for Michael which sticks to PlayN). Go check them out and support them!

What you need in addition to your current setup (JDK, Eclipse, Android SDK, GWT):

  • A Mac, sorry, there’s simply no way to deploy to iOS without Mac OS X. I totally don’t know about Hackintosh’, you don’t either, right?
  • Xcode, you can get that from the Mac OS X app store. It’s what’s commonly used to develop iOS apps.
  • A MonoTouch license. You have 3 options:
    • If you just want to test your stuff in the simulator, get the evaluation license. I would strongly suggest getting this and test your app before shelling out money.
    • If you want to deploy to a real device or app store and you are a student, get the student license for 79$
    • If you want to deploy to a real device or app store and you are not a student, get the normal license for 399$
  • Ant. Download and extract the zip to say /Users/you/ant, then create a symlink via ln -s /Users/you/ant/bin/ant /usr/bin/ant
  • Make sure both javac and ant can be executed from the command line!

Once all that is installed, you can use the gdx-setup-ui to create the core, desktop, android, html5 and ios projects. Here’s a video running you through the process, including running and debugging your app on the various platforms (if you want the textual description, read this):

How it works

Here’s the high-level view on how the iOS backend works for you as an end-user:

  • Your iOS project contains a libs folder. In that folder there are various native libs, dlls and jar files as well as IKVM
  • In the root folder of your iOS project, there’s an ant script called convert.xml and a properties file specifying the parameters for your project
  • When you build your iOS project in MonoTouch, the ant script is invoked as a pre-build step. It will compile the Java files in your core project’s src/ folder, and transpile them to a .Net assembly (.dll file) via IKVM. MonoTouch can then compile the actual MonoTouch project, refercing the core project dll as well as the libgdx dlls among other assemblies.
  • The assets are linked from the Android asset folder, just like it’s the case for the desktop and html5 project

You can run and debug your iOS project like any other MonoTouch application. You can even debug the Java source directly. Just open up any Java file from your core project in MonoTouch and set a breakpoint!

There are a few caveats:

  • Classpath resources can not be loaded on iOS. This means the default BitmapFont constructor without arguments will not work!
  • Some Java runtime classes are not available, this mostly concerns the java.net and crypto packages. We have a replacement for most of java.net’s functionality in the new gdx-net API which is part of core
  • You need to link any new asset files you add to the Android project’s asset folder manually in MonoTouch. Right click in the project view, then select Add Files or something similar and link your new assets. After this is done, you have to right click your linked assets again and set their Build Action to “Content”. If you don’t do that, your app will crash as the assets won’t be included in the final build output.
  • You must clean and rebuild your MonoTouch project before you run/debug everytime you modify your Java source code in Eclipse! MonoTouch does not pick up changes to those files and will hence assume the last build is up-to-date.
  • Compile times for the device are rather long. Stay on the simulator most of the time. Note however that some things will only fail on the device.
  • The extensions have not been ported to iOS yet, just a matter of cross compiling the natives
  • OpenGL ES 1.x is not supported. We may add support in the future, but it’s not a priority. GLES 2.0 all the way

There are a few more things to consider. We have a temporary Wiki article that summarizes all our findings so far. We’ll clean that up soon to make the content more accessible.

Thanks again to everyone who’s involved, and have fun with your new shiny toys :)

What’s Next

For the 0.9.9 release i’d like to have the following things done and ready for broad testing:

Once those things are done, we’ll release 0.9.9 which should be the last release before the official 1.0 release. Between 0.9.9 and 1.0 we should focus on testing, bug fixing and documentation.

  • Meddy M

    Wonderful super Mario.

  • DATuan

    Good work !

  • Nick

    Testing it now, only problem I have had so far is that proguard config must be changed to ignore the Daydream references (I’m compiling for an earlier API).

    Adding this to the proguard config does the trick:

    -dontwarn com.badlogic.gdx.backends.android.AndroidDaydream
    -dontwarn com.badlogic.gdx.backends.android.AndroidInputThreePlus
    -dontwarn com.badlogic.gdx.backends.android.AndroidGraphicsDaydream

    Quality, looking forward to testing on ios :)

  • http://www.chrismweb.com ChrisM

    Awesome! It’s going to be weird seeing the 1.X releases in the future! :-o

    To pay for the mono license, at $.50 eCPM or so, that’s 800,000 ads, ~1min/ad, you’d need someone(s) playing your game for 13,000hours, average play time of 5 minutes/person, you’d just need 2,667 plays.

    Or you could just do a nice slot machine game, at $300/day, and be good in 2 days ;)

    Very awesome! You’ll have to keep us updated with how many LibGDX games are deployed on iOS.

  • Tomas

    Keep up the fantastic work. Looking forward to the new 3D API.

  • http://drabiter.com/ drabiter

    The trial allows you to test in unlimited time? (can’t find more info on the site)

  • http://www.noblemaster.com noblemaster

    That’s very impressive!

  • http://cesekas.lt cheskapac

    when do you plan to release 3d api (0.9.9 version)?

  • Rick

    Awesome work, thanks to Mario and everyone who contributed!

  • http://congdongandroid.vn hpit

    Very good, i like it :D

  • http://www.the7art.com Dmitry

    Mario, could you briefly outline the current problems with lwp backend?
    I’m planning to be a massive user of it, so not exactly promising to ‘take it over’, but I may be able to start with small contributions as I write code which uses this backend…

  • http://badlogicgames.com Mario
  • http://badlogicgames.com Mario

    cheskapac: when it’s done, follow the forum thread and the commits on the new3dapi branch on Github.

  • Pidroh

    Does Box2D now work with the HTML5 Backend?

    Thanks!

  • http://mattiesworld.gotdns.org mxttie

    wow, very impressive!

    Since libgdx has gone iOS too, I’m very anxious to use libgdx in a new mobile game (I’m still a noob though) but since I’ll be using basic 3d I thought I’d better wait for the new 3d api?

    Also, the irc log is very useful :)

  • ZerZer

    I am so excited about version 1.0 ^^ hurry up :)

  • Johannes

    Thanks a lot :)

  • http://www.imake-games.com IMakeGames

    Outstanding work, as always! :)

    Anyway, I tried bulding my game but I hit a roadblock because I’m also using the Freetype- and the controller extension. Any ideas on how to get that to work? Or when this will work?

  • http://badlogicgames.com Mario

    It pretty much always has Pidroh

  • http://mattiesworld.gotdns.org mxttie

    I was trying to register to the forum, but my answer to the antibot question fails every time :/
    I assumed the answer was either 0.9.0 or 0.9 and after that I tried some previous versions as well as I figured you might forget to update this now and then ;)

    can you help me out please? :)

  • http://mattiesworld.gotdns.org mxttie

    a friendly bot on irc helped me out :P it seems the answer to the question needs to be updated ;)
    thx aspic

  • Mehmet

    Real Super Mario is here :D

  • Pidroh

    Ooops, sorry Mario, I’m a little outdated, I just read it once that GWT didn’t support native code so we wouldn’t be able to use the wrapper, how did you guys get around that?