jME3 is back to iOS

Hi guys,

It’s been a long time since last time I was really active in the forum and I wanted to post a contribution related to one of the latest I did in the past.

During the last month I’ve been working in getting current jME3 running on iOS back again and finally I got it to work using MOE (multi os engine). I’ve published all the required stuff in a github repo for you to have a look at it: GitHub - joliver82/jme3-ios-2024: Attempt to make jMonkeyEngine to run on iOS again at 2024

I’ll set a proper Readme.md file but in the meanwhile, the repository includes the following:

  • info.txt → more information about this all
  • jme3.6.1.patch → patch to apply over the jme3 master branch if you want to compile the jme3-ios from there
  • jme3-ios-lib → copy of 3.6.1 jme3-ios path + patches
  • jme3-ios-native-lib → copy of previous ios native code included in jme3-sdk + patches
  • jME_for_iOS → gradle project including all platforms (desktop, android and ios). It’s a project got from jme website project initializator plus the ios side which is mostly based on libgdx for moe (Berstanio’s libgdx fork)

Working: As of today, I’ve not tested every single jme3 functitonality but I’ve tested effects, PBR, niftygui, shadows and instancing working flawlessly, so I’m assuming that if not everything, at least 90% of jme3 will work.

Not working: Other native stuff (like physics) won’t be working till there’s a proper native ios library compiled.

Not fully working: The screen is not properly initialized, the jme3 app is not using the whole screen. May be related to how I’m setting the UI or the gl context or something. I have to look into it but should be easy to address.

I hope anyone having an iPhone could test it and give me some feedback about it. The simulator is slow as hell…

In the next few days I’ll be trying to get Minie to work on ios and maybe in the long future try to support also roboVM like default libgdx does

Note I also tried minijvm but it lacks a lot of base java classes that are required for jme3 to work

21 Likes

This is very good news and thanks for taking the time to get this working.

That is why I love this community.

Thanks @joliver82

1 Like

Hi!

I just got current Minie working on iOS also. Latest commit adds support for it and includes a simple physics test from jme3-examples apart from some minor changes (not solved the screen filling issue still).

Thanks @ndebruyn for your comment :wink:

8 Likes

I just got current Minie working on iOS also

So let me get this straight: the Multi-OS engine allows applications to load native libraries compiled and linked for Android?

If so, that’s awesome!

I’m sorry to tell you that it’s not that easy. The natives for iOS have to be compiled by themselves as xcframeworks to be included in the xcode project. Have a look at jme3-ios-2024/libbulletjme-ios-native-lib at main · joliver82/jme3-ios-2024 · GitHub

When building the final binary, MOE will statically link it all together

1 Like

Quick update. I just fixed the screen not filled issue

4 Likes

Added WIP roboVM support to the project (robovm-support branch). Sadly there’re missing classes in roboVM, so jme3 won’t work at least untill this PR is merged

2 Likes

Good day @joliver82 ,

Please can you help to explain to me how I should work with this repo in order to get my app to run on iphone?

I know I need an mac with MacOS and I know I need xcode.
What I do not understand is, is this repo an xcode project?

Also, do I need some sort of java sdk or jvm for it to compile?

1 Like

Hi @ndebruyn !

First of all, sorry for not answering before.

The repo structure is explained in the first post in this thread, each folder is a project by itself. I added later the folder libbulletjme-ios-native-lib which has a copy of the code from sgold’s Libbulletjme having a xcode project to compile it as xcframework

The relevant path for your question is jME3_for_iOS which has the game project. It’s based on the jme3 initializer from the website.

Inside it, you have the usual folders plus the ios specific one:

  • assets
  • game → the game code
  • desktop → specific desktop code
  • app → specific android code
  • ios-moe → specific ios code using MultiOsEngine (roboVM is not supported still)

As this is a java project mainly, you need jdk and gradle installed in your OSX (also having xcode of course).

To use this for your app, and assuming you’re already using gradle and a similar project structure (also based on the initializer), I would include the ios-moe path in your project and modify it according to your needs

ios-moe includes both the build.gradle, java sources, a xcode project and C++ main file

Note the xcode project depends on the xcframeworks located at both jme3-ios-native-lib and libbulletjme-ios-native-lib, so if you are not keeping all the folder structure, you will need to modify the xcode project to include those xcframeworks from elsewhere.

Also note I’m using a local build of jme3-ios based on 3.6.1, so if you’re using other jme release you may face issues or you’ll need to apply the patch to your release and build jme3-ios jar.

To build or launch the ios port of your game, you’ll need to use moe specific gradle targets like moeLaunch (I don’t remember all the targets but you can get them from gradlew ios-moe:tasks). If you’re using android studio or IDEA it’s a good idea to install the MOE plugin as explained here it will simplify everything.

Also, please change the gradle.properties file to use latest MOE release (1.10.1) instead.

I was working on improving this and my idea is to create some PRs (at least jme, minie and the initializer) to add proper and simpler iOS support, but I’ve not had enough spare time to do so.

I hope this helps you to get your game building and running properly on iOS. If you have any doubts ask me :wink:

Also… which game are you working on? I mean, has it already been published in any platform? I’m just curious about it

4 Likes