libgdx RoboVM backend

I started working on the libgdx RoboVM backend yesterday. RoboVM is an ahead-of-time compiler for JVM bytecode, that targets iOS. It’s completely free for commercial usage, supports the entire JRE (through Android’s runtime class library), has super easy integration with Eclipse and soon Maven, and is all-around fantastics. Development is really fast, compile times are in the seconds range for the simulator (once the JRE has been compiled).

I’m doing this mostly because i want to offer a free alternative for the Xamarin/Monotouch based backend. Xamarin has been super supportive of our efforts in the past, but there are some technical hurdles that we can’t seem to overcome, e.g full JRE support, JNI performance, high compile times etc.

I got all our demo games to work in an hour. Niklas Therning, the guy behind RoboVM, supplied us with an initial RoboVM backend. I had to fix up a minor issues with ApplicationListener initialization order, and things just started to work.

It’s still early days. There’s a lot that needs to be done, but i have high hopes that this will become our new defacto iOS backend.

What’s currently missing in the backend:

  • touch coords are incorrect
  • no audio yet
  • Preferences are broken
  • some missing implementations

What’s currently missing in RoboVM:

  • Debugging
  • More optimizations. Performance seems to be good enough already, JNI calls seem to be a lot cheaper than with IKVM/Monotouch. I’m not sure if RoboVM uses LLVM’s full optimization pipeline yet.
  • A few bugs here and there, which we want to help to discover. RoboVM is tested against Android’s class library test suite, and pretty much all the tests pass.

One downside to RoboVM, apart from missing debugging support, is the use of the Boehm GC. Now, Mono (and hence Unity et al.) have been using that for quite a while, and with a little care, one can work around it’s issues (stop-the-world pauses).

My plan is to focus on this backend in the future, and only do maintenance on the Monotouch backend. If you feel to be able to help with the RoboVM backend, i’d welcome your contributions!

You can currently test the thing by

The backend source can be found on the master branch on github. It’s just like any other libgdx backend, single Java project that links to the core API and RoboVM runtime classes. Creating a new libgdx robovm project is as simple as linking to gdx/gdx-backend-robovm, and modifying the robovm.xml, robovm.properties, and info.plist files to meet your project’s requirements. See the demo game projects for examples.

I’ll package up the robovm backend in the nightlies asap for you to consume. For now you’ll have to work from source as outlined above.

And here’s a screeny:

32 thoughts on “libgdx RoboVM backend

  1. No, but will go into maintenance mode. We want to focus on RoboVM, as it’s free and OSS 🙂

  2. That is excellent news. I’ve been working on Scala + iOS support, and having two semi black boxes (ikvm -> monotouch) in between my code made finding and fixing issues almost impossible.

  3. ok, I hope it works fine. It would be the holy grail of the developers that using LibGDX.

  4. I was close to reimplementing my game’s framework in C so I could put it on iOS, but this looks like a much better alternative, eventually.

    If you’re looking for any help at all (code/testing/etc), let me know! — louis dot acresti at gmail dot com

  5. I’ll have to try publishing my games on ios when it’s finished – I don’t really want to support the platform, but at least friends that’s don’t know how to use computers and have iphones will be able to try out the games.

    Awesome work! Next blackberry and windows phone 7, no 8, no 9 😉

  6. /opt/llvm/bin/llc -mtriple=i386-unknown-macosx -ffunction-sections -fdata-sections -disable-fp-elim -o=/Users/wanghj/.robovm/cache/macosx/x86/default/Users/wanghj/Desktop/classes/HelloWorld.class.s /Users/wanghj/.robovm/cache/macosx/x86/default/Users/wanghj/Desktop/classes/HelloWorld.class.bc

    Assembling HelloWorld

    clang -c -o /Users/wanghj/.robovm/cache/macosx/x86/default/Users/wanghj/Desktop/classes/HelloWorld.class.o -g -arch i386 /Users/wanghj/.robovm/cache/macosx/x86/default/Users/wanghj/Desktop/classes/HelloWorld.class.s

    java.io.IOException: Cannot run program “clang”: error=2, No such file or directory

    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)

    at java.lang.Runtime.exec(Runtime.java:615)

    at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)

    at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:246)

    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:302)

    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)

    at org.robovm.compiler.util.Executor.exec(Executor.java:336)

    at org.robovm.compiler.util.ToolchainUtil.assemble(ToolchainUtil.java:102)

    at org.robovm.compiler.ClassCompiler.compile(ClassCompiler.java:283)

    at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:217)

    at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:233)

    at org.robovm.compiler.AppCompiler.main(AppCompiler.java:423)

    Caused by: java.io.IOException: error=2, No such file or directory

    at java.lang.UNIXProcess.forkAndExec(Native Method)

    at java.lang.UNIXProcess.(UNIXProcess.java:135)

    at java.lang.ProcessImpl.start(ProcessImpl.java:130)

    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)

    … 11 more

    robovm: Cannot run program “clang”: error=2, No such file or directory

  7. Hi! Mario!I run the project as IOS Simulator,but Build failed!

    13-6-8 11:29:28: [ERROR] ld: file not found: /Users/wanghj/Desktop/Test/superjumper/superjumper-iosrobovm/../../../gdx/libs/ios32/libgdx.a

    13-6-8 11:29:28: [ERROR] clang: error: linker command failed with exit code 1 (use -v to see invocation)

    13-6-8 11:29:28: [ERROR] Build failed

    I add /gdx/libs/ios32/libgdx.a,but build failed too.
    How shoud i do?

  8. I load the libgdx.so,but it also build faild,can you tell me why,this is my blog,http://blog.csdn.net/zlqqhs/article/details/9086071

  9. Thank you so much. I’m currently using Xamarin, but I really hope libGDX team to focus on open source Robovm

  10. Any plans for java.net class implementation with RoboVM?
    I would literally father your children if I was able to use libraries such as KryoNet on iOS.

  11. RoboVM’s standard classes (including java.net) is based on Android. So if KryoNet works on Android (the web page says it does) and it doesn’t use any classes in android.* it should work on RoboVM.

  12. RoboVM uses the same bouncycastle as Android. If you cryptography code works on Android it will likely work on RoboVM as well.

  13. Hi
    I’ve already tried this thing, compiled the Space Invaders demo ant it worked great!
    Thank you!

  14. Tried it and works great! However, will this approach not make it very difficult to combine this with using some iOS specific features? E.g. Admob or Game Center? If I release a free game for iOS having Admob available is really important for me.

  15. Hi,Why I used RoboVM for iOS, The TextInputListener can’t receive the input message? Thank you!

  16. I too had this problem.

    It was caused by the way I imported the test projects into Eclipse (copied projects into workspace). The robovm.xml files are configured for the filesystem layout as contained in the GIT repository. When you import via copy, this folder layout gets lost.

    Amending each of the entries in robovm.xml file contained in the corresponding robovm project to match your filesystem (in my case ../gdx/libs/ios32/libgdx.a) worked for me.

  17. are there any updates to this? is sound/touch in sim/networkinh implemented and working? where can i kerp up to date with the dev status? thanks!

  18. You can’t build for i386, it’s not supported on your phone. You need to use arm64, armv7, and/or armv7s.

Leave a Reply

Your email address will not be published.