News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

New Android build

Started by Roboron, May 22, 2023, 09:17:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roboron

I have finished* working on the new Android build which will allow us to compile Simutrans for Android on our own and is easier to understand (or so I think). The Android project was done from scratch and makes use of the CMake build system alongside gradle.

- The Android project itself is on https://github.com/simutrans/simutrans-android-project. Brief instructions to compile are there, but you can also check the pipeline.
- The changes to the Simutrans source code and the GitHub pipeline are here: https://github.com/aburch/simutrans/pull/17/files (Do not merge, commit history is dirty, I just opened the PR to generate the patch file)
- *IMPORTANT: Note that there is one thing left to do: signing. Since I don't have they key for signing, nor access to simutrans/simutrans repository, I have left this part commented (line 100+ of nightly-android.yml). Please do complete this process, it shouldn't require many changes.

Key points:
- The project builds Simutrans and its libraries for any architecture. The exception is fluidsynth, which was more difficult to setup, and since they offer pre-compiled Android libraries it is not worth the effort.
- Because of the fluidsynth dependency, the minimum SDK level is 24 (Android 7).
- I had to write some Java code to manage unpacking assets at first run/update. Although reading assets directly from the APK is possible, this would require us to write new code and will probably not work with third party libraries.
- Changed Simutrans base directory to internal storage (so other programs can't access it).
- I am not particularly proud of the process of finding libraries for Android, which is so tedious I had to write a new SimutransFindDependencies.cmake file to split it, but I don't know any better. Feel free to improve.
- Redesigned icon, you'll like it.
- I have not tested every combination of architecture / package, only armv8 apk builds. Testing is greatly appreciated.

Diff file: https://patch-diff.githubusercontent.com/raw/aburch/simutrans/pull/17.diff

prissi

Great work! (Also I should invite you to simutrans, I thought you were already a member!)

To push it into the play store, we need target API level 33! (Yes, Android 13 for updates). The current build was 29 and hence it was rejected. Also the build must actually build all packages or Google will refuse it. But if ARM works, intel should work too.

When I get this working (and I think I should with your contribution) then we can finally release a new version among all architectures and network play on phones and desktop alike.

The one thing I am not sure is using internal storage. Because it means that a player cannot download maps or install addons himself and also makes SD card use more difficult.

Thanks again.

Roboron

I am a member of simutrans (that's why I can use it for the simutrans-android-project repository), but I don't have any permission on simutrans/simutrans repository. It seems it is set up so only members of the team "Simutrans Dev" (which I'm not part of) have access to it.

Upgrading to API level 33 is easy. It's just a matter of bumping the number on simutrans/build.gradle and updating the tools. Done already!

The change to internal storage was for the base_dir, not for the user_dir (that's still on external storage). However, since base_dir = install_dir on Android, this also means that install_dir is now also on the internal storage. It would make more sense for install_dir to be on the external storage (so one can install paksets without the installer), but that would require to decouple both of them. In this attached patch I tried to do that on top of the previous patch. Moved some logic from simmain to simsys in the process since it is yet more platform-specific.

prissi

I will try to commit you patch to SVN which will automatically update the simutrans/simutrans. YOu are now also a member of simutrans/simutrans though.

prissi

I could not apply the patch file to the current trunk. Maybe because it is based on Abruch. But Aburch's history is broken.

The versions of the respective files were different. Since I am not versed in git commandline magic, I have no idea how to get this right.

Roboron

I have forked simutrans/simutrans repository and applied my changes upon it (I actually forked prissi/simutrans the first time) using the secret technique of "copy changed files".

Quote from: prissi on May 26, 2023, 08:29:48 AMYOu are now also a member of simutrans/simutrans though.

Doesn't seem like I have any new permission on simutrans/simutrans. I was probably wrong and it is not "Simutrans Dev" the team that has access. Are you the only one with access?