Wednesday, March 11, 2020

Cross platform gaming - SpaceFX


It was planned to show the latest version of SpaceFX at JavaLand conf but unfortunately this was cancelled due to COVID-19. Well lucky us we are all connected via the internet so I decided to give you the information here on my blog...

Once I've started coding the SpaceFX game I had several things on my mind...first was would it run on the browser user jpro? Yes it does...not super fast but's JavaFX running in the browser...without a plugin :)

Then I thought why not giving it a try on mobile like iOS and Android using Gluon. Well to be honest I was more than surprised how well that worked out.
The game runs smoothly on my iPhone and Android phone...well at the moment without sound but that's just a question of time.

Now I finally have it running on...

  • OS X
  • Linux
  • Windows
  • iOS
  • Android
  • Web
...from one source!!!

Because there is no support for sound on mobile at the moment I've created a mobile branch where I simply commented out all lines related to sound. The property file management is also a bit different on mobile but the rest is the same.

Oh and before someone blame me again that it does not work on Linux blablabla...
It works on my Ubuntu 18.04 LTS machine totally fine...with sound (at least the executable jar) and yes it also works on my Windows 10 Virtual Machine. I hope I do not always have to provide screenshots to proof this, you just have to believe me :)

So I've created executable jars, native packages using JDK14 jpackage and native images using GraalVM+Substrate and because many asked for the compiled versions you can now download them here:


  • iOS app (please unzip before install)

  • Executable jar (run on JDK11 with java -jar SpaceFX-1.0-SNAPSHOT.jar)
  • Binary (GraalVM/Substrate version without sound)



Please keep in mind that I only tested the iOS and Android versions on phones (iPhone 11 Pro and Huawei P20 light). It might not work on tablets like iPads etc.

But if you are interested in the code or would like to compile/run it yourself, you can find the code as always on github.

And now another video...just for the fun of it...

That's it for keep coding... :)


  1. Very good job, thanks.

    Windows Executable jar is - verified on Windows 10 machine.

    Android apk version is ok on Huawei P20 Lite - verified on smartphone of my daughter.
    But on my smartphone Motorola Moto G5S Plus is instalation of apk failed (Android 8.1.0), chunk of log:
    Historical Broadcast foreground #13:
    BroadcastRecord{f91d41c u0} to user 0
    Intent { flg=0x10000010 (has extras) }
    extras: Bundle[{, EventResultPersister.EXTRA_ID=-2147483644,,,, Failed to extract native libraries, res=-113}] null pid=-1 uid=10042

    Important is this (in my opinion): Failed to extract native libraries

    Don't is better native development for Android?
    More range of supported Android devices.

  2. Just tried the DMG on macOS, works fine. I do wonder why it asks to be able to get key presses even when the application is not active?

  3. It works perfectly on my Linux, OpenSUSE Leap 15.1

    Though I had one problem. I think because of the following bug.
    This should be fixed I think in JavaFX 14. A workaround was to make the window resizeable, then rebuild and it worked fine.

  4. Why there is no sound support on mobile?

    1. Because the Gluon guys are too busy and did not found the time yet to implement it for mobile. So technically there is no reason not to have sound and it will come. But for standard apps sound is not that important at the moment.