News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Android version

Started by prissi, March 13, 2022, 12:56:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prissi

The Android nightly is found under https://github.com/aburch/simutrans/releases/tag/Nightly This is not signed with the regular key (which only Google owns) and thus may clash with an official release in the future on the playstore.

In this thread, please discuss the Android related issues and how to improve usage.

It has been tested under bluestacks (emulator), Fire7 tablet (max speed ca. 5.5 without midi), Samsung S7,  Alcatel One
Simutrans does not start on a Huawei P9 (too little free memory?) and maybe other devices (please reports)

Known issues:
Hangs at the first start with a black screen: please wait a little.
Runs slowly, especially on high resu\olution screens (disable midi and use larger scaling in display options can help)

Yona-TYT

Quote from: prissi on March 13, 2022, 12:55:21 PM
Popup message shoudl disappear after some time. Also a popup in the wrong position may be ignored first.
Despite being temporary windows, they can be somewhat annoying since they appear right in the area of the screen where we want to build, it would be more pleasant to have them fixed in a corner away from the center of the screen, that is only on android of course.  8) 

Yona-TYT

It would be very useful to have a virtual "ctrl" key on the screen for android or better touch devices.

Only for use in combinations with tools.  :P

Vladki

I tried on Oneplus 3T (phone 6GB RAM).  It works but is practically unplayable. The UI is so small that I cannot hit the controls, e.g.  close a window. Is there any way to deal with high DPI screens? (FullHD @ 5.5")
Also I had the feeling that even if I touch the correct spot, it sometimes does not react at all. A helpful thing would be to use the "back" key as "ESC" to close current windows.

prissi

#4
Simutrans reads out the dpi setting and should adjust accordingly (but this was removed by error). r10558 should again autoscale the display. (It may be still small, depending on your dpi settings). Autoscale also force 1280 like maximum width otherwise performance may be really bad. (Under 1 simloop)

Please test again.

Vladki

Yes it is much better now. Although manual setting of the scale (dpi) is not very comfortable.

How do I do ctrl + click on touch screen?

prissi

You cannot right now. Maybe there is a control field or special tool needed for this.

The back button (if there) should close the last window.

Vladki

The back button closes all windows in my experience.

prissi

You are right, my mistake. r10586 should do the same as delete, i.e. only close the topmost window.

MobileGlotze

#9
Can't install it on my Samsung a51 and galaxy Tab S5e.

Edit: forgot it. I was to stupid. I have to remove the old app. But I lose my save game:/


Yona-TYT

Quote from: MobileGlotze on April 05, 2022, 03:13:58 PMCan't install it on my Samsung a51 and galaxy Tab S5e.

Edit: forgot it. I have to remove the old app. But I lose my save game:/


The app should update without having to delete it previously, maybe it is because it is not officially in the play store?. ???

MobileGlotze

I don't know. When I save a game I can't find it in the folder. I downloaded pakgerman large and can't find it in the folder. Only pak and pakjapanese.




Andarix

pak64.german is not bundled by offical Nightlys.

If installed from within the program, it will be installed to the user directory files.

pak64.german is also part of my Nightlys.

prissi

The user files (under data/data) are not accessible for other programs intentionally. You save games should be in the folder save.

The key and name "com.simutrans" changed since November, when the very first build were done.

Mishasama

These versions can't be upgrade from the previous nightly versions?
It looks used different signatures for every APK?  :o
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

#15
The key to the final version is held only by google, I only have an upload key. The apk is singed with a key from krosk, I think. Andarix uses his own key. We could think of a simutrans team developer key to be shared to people releasing their own versions, but the svn number in these cases will be different.

As soon as it is in the play store, it will be automatically updated by google, using the google secret key.

So indeed, we may need a simutrans team key to sign the nightly versions, or release the nightly via google, which seems possible as beta track.

Mishasama

Quote from: prissi on May 22, 2022, 12:23:56 PMThe key to the final version is held only by google, I only have an upload key. The apk is singed with a key from krosk, I think. Andarix uses his own key. We could think of a simutrans team developer key to be shared to people releasing their own versions, but the svn number in these cases will be different.

As soon as it is in the play store, it will be automatically updated by google, using the google secret key.

So indeed, we may need a simutrans team key to sign the nightly versions, or release the nightly via google, which seems possible as beta track.
I think you should share key first. Google's review speed is very slow that not suitable for fast version iterations.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

I cannot share the final key, since ONLY google has it. I only have a self signed upload key. It is their policy since 2020 or so. Before, you could upload apks with you own key, but this is not accepted for new projects any more.

Mishasama

Quote from: prissi on May 30, 2022, 12:31:10 PMI cannot share the final key, since ONLY google has it. I only have a self signed upload key. It is their policy since 2020 or so. Before, you could upload apks with you own key, but this is not accepted for new projects any more.
I mean, first use a shared key among the development team to avoid signature conflicts when installing updates. Do as you say.
Doing so will also test for errors after installing the update.

Otherwise we have to uninstall and reinstall every time.
This makes it impossible to test the actual situation of the average user when installing the upgrade.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

As soon as Google finishes reviewing (they complain about the data privacy, even though Simutrans does not harvest any data and the privacy policy says explicitly so) there will be a beta track in the play store with the nightlies.

The github built script cannot use secrets since nobody of the development team has write access to github.com/aburch, which is just updated through a third party server. We could only sign it afterwards after upload to sourceforge.

prissi

A recent nightly is now available on the google play store:
https://play.google.com/store/apps/details?id=com.simutrans

Yona-TYT


I would like to have in android a "single window mode" for objects such as: objects ground, trees, buildings, ways objects...

It is more practical to have only 1 active window at a time for this type of objects, but this is only for android versions!.  8)

makie

fine
I can search and find simutrans in the playstore
ok first entry in the search list is "Train Station 2" but the second is Simutrans
this is fine
now we and all other can install it easy  :D 

ok it is too much for my old tablet but it works

prissi

I will try to release the nightlys automatically to the beta track. Then only the windows store is left, which should be easier. Finally, I will do a new release with the much more responsive GUI and the improved sync_step, so one can also do a new online games from all platforms.

tuxianer

Hey folks,

I love the version running on Android so far - admittedly playing is rarely on the Tablet/Phone but still I can. One question or point of consideration would it be worthwhile to see if we can create an Fdroid Repo where nightlies (and stable builds) would be automatically released to?

The Play Store of Google can be a prime choice for most but has its limitations on frequent updates, so I was thinking about the FDroid store?

prissi

Fdroid requires all compiled ourselves, but we use some precompiled stuff from Pelya. So far, we have no version which compiles standalone, only on github. Compiling for Android means to compile all needed libraries too so the build process is very long and tedious.

For Fdroid, we would need a standalone compiling version on gitlab. If you want to do this, go ahead.
Moreover, the Android version will only update with a stable on the stable branch for th eplaystore, and only testing will get nightly. Otherwise networkgames will nto work. Unfortunately, there is no really good stable Android version in sight right npw. Maybe for a Christmas release ...

tuxianer

Hi,

OK was not aware of all the processes associated to it, how could I. Thus the question around fdroid, where would I find the doc on compiling an android version if I want to try my luck out on gitlab?

Cheers

prissi

There is a script on the Pelya server which builds simutrans after we patch it. We would need to implement something like that ourselves, i.e. downloading the latest stable SDL2, bz2lib, zstd, freefonts6 and probably others as well, and then move the sources into the right subdirectory and finally first build the libs and then simutrans. That would be entirely a scripting exercise.

Such a package should be able to get uploaded to gitlab and build there. It would also greatly facilitate Android development for Simutrans, to be able to build it outside of github CI.

If one is decently fluent with Android, one could rather make an interface to the native code and use the Android libraries for midi, freefonts, https downloads etc, saving compile time, and hassle with keeping so many libraries working.

Roboron

#28
I've been reworking the build system for Android. I took prissi's advice of starting from scratch, and followed SDL's guide for Android project here.

Using gradle + CMake (+ clang) I have succeeded in compiling a Simutrans package, including its libraries.

However, when I try to run it, Simutrans crash with 
Scudo ERROR: misaligned pointer when deallocating address 0x00746f465ec0
Specifically, this is thrown very early at simsys.cc#L1124
char buffer[PATH_MAX];
ssize_t const length = readlink("/proc/self/exe", buffer, lengthof(buffer) - 1);
if (length != -1) {
buffer[length] = '\0'; /* readlink() does not NUL-terminate */
argv[0] = buffer; // CRASH

I guess that this may be happening because I'm missing some compilation flags (because it doesn't make much sense that this code is running without issue in the current build). Did some research and the only suggestion I found pointed that the -Oz/-O3 flag may be causing this - however it is not being applied, and if applied the error changes to:

Scudo ERROR: corrupted chunk header at address 0x00746f465ec0
So I am really lost and I don't know how to continue. Any ideas?

-------------------------
I've setup a repository containing the stuff needed to compile this https://github.com/Roboron3042/simutrans-android-cmake

1) Install the android dev tools as usual (sdkmanager, ndk;25.1.8937393, cmake;3.22.1, platform-tools, build-tools;33.0.1, platforms;android-31, see the pipeline for details). openjdk17 needed.
2) Run prepareAndBuild.sh, the script will initialize git submodules (our libraries), compile them (see app/jni/build_libraries.sh for details, it is pretty simple), prepare the assets and sources, and build a debug version of Simutrans.
3) For building again just run ''./gradlew assembleDebug'' (or bundleDebug for a bundle, installDebug to directly install on a connected device, etc...)

There are only some key files to take care of:
build.gradle
app/build.gradle
app/jni/CMakeLists.txt
app/jni/build_libraries.sh
app/src/AndrodManifest.xml
Simutrans' CMakeLists.txt also needed changes to find Android libraries, so I'm using my own fork as submodule.

That's it. I find it quite simple, it is such a pity that I can't get it to run...

I tried to set up  a GitHub pipeline but it is failing at uploading the **** file ('Resource not accessible by integration'). I really don't know how actions work so I gave up on this. I made the release manually.

TODO:
- Obviously first solve the unaligned pointer error.
- libfreetype and libfluidsynth need to be set up. I intentionally left them out until I was able to continue.
- Release and non-arm builds currently disabled.
- Replace SDL's app/src/main/res (image and game name) with our own.

Dwachs

No idea, what is causing this. I compiled simutrans with clang and using this scudo-sanitizer, but got no errors.
Parsley, sage, rosemary, and maggikraut.

Combuijs

Long time ago that I've seen C++-code, but for me it's odd that you are changing the argv[0] parameter, passed on no doubt by the main function to the sysmain function. Maybe Android is protecting this parameter against writing? Why not using a local string variable instead of modifying argv[0]? Is the changed parameter used later on in the main function?
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Roboron

#31
Detective Combuijs you solved the case! Just making a local copy of argv[0] allows the program to continue :-)

Now, it doesn't go too far, because it is looking for the base_dir at /data/data/com.simutrans.simutrans/files/ but there is nothing there - so it exits. I wonder where are the assets of the apk...

But that's a problem for another day. Thank you!

EDIT: The assets stay inside the APK, and we can't get them using fopen. Solution may involve copying the assets to external storage where they are expected.


prissi

#33
Thank you for your efforts on doing that from scratch. It certainly helps that cmake is now supported ...

The base dir should have a single data dir. Having two somewhat indicated that scripts paths are all relative. Hence, the rebuild script may have been called from the wrong directory ...

I tried compiling your script on the commandline of my server. First, it does not work after downloaded you achieve, one has to clone the git. But the git submodule will not survive checking in with SVN ... I think one has to clone them manually in the preparation.

I will try again to get a built system going. SHould be easier now even under windows ...

Roboron

#34
The simutrans submodule will be replaced by cloning the SVN/git repo in the final pipeline - it doesn't make much sense to have a fixed version anyway, unlike the libraries.

Good news! I have a build working and running - and the pipeline is now also working!

List of things to do
1. :done:  Solve the unaligned pointer error.
2. :done:  Build with freetype.
3. :done:  Add command line args.
4. :done:  Unpack assets when Simutrans is opened after install.
5. :done:  Build with fluidsynth => This will be a PITA.
6. Check that non-armv8 builds work.
7. :done:  Replace SDL's app/src/main/res (image and game name) with our own.
8. :done:  Check the pakset installer (not working currently).
9. :done:  Simutrans currently crash after open IF the previous time it exited from the menu. SDL's documentation says this can happen if a call to exit() was made, which should be avoided. Apparently, it is crashing at gui_theme_t::themes_init -> pakset_manager_t::load_pak_file -> ... -> register_image.
10. :done: Unpack assets also after update. Currently I have implemented a Java method at Simutrans.java that unpack assets (as Pelya does) if the config/simuconf.tab is not found. However, this should be done not only after first install, but also after upgrading to a new version. Lowes priority for me.