fheroes2
fheroes2 copied to clipboard
Android release preparations
Preliminary checks
- [X] I've checked that there aren't other open issues on the same topic.
Describe the problem requiring a solution
Even having a very basic Android build we are far away from a proper release for this platform. We need to make multiple changes and adjustments in order to make it user-friendly and ready to be published in App Store.
Describe the possible solution
- [x] lock the application in landscape mode. Right now it is possible to rotate the view.
- [x] add compilation flags which are present in other builds, especially for warnings.
- [x] make
files/data
directory and compiled translations to be a part of the package to avoid extra resource copying even by developers. - [x] Android filesystem is case-sensitive. Right now the code does not handle it properly. The logic present for case-sensitive filesystems is not applicable for Android due to a fact that an Android application has access (even for reading) only to certain directories.
- [x] add proper support of internal and external storages.
- [x] evaluate the need of permissions needed for the application.
- [ ] add Java code to verify the presence of files and possibly download a demo version and unzip the downloaded archive into the specific location.
- [x] add a script to setup Android build for developer. Include needed paths to
.gitignore
file (looks like it is done). - [x] fix MIDI music for Android. Android has native support of it.
- [x] fix resolution detection. In the Android devices the height is bigger than width.
- [x] add package signing as a part of CI/CD pipeline.
- [x] finalize minimum Android version requirements for the application.
- [x] right mouse click simulation
- [x] add a UI element to toggle between full-screen and windowed modes
- [x] connect system audio level to game's level of music or audio or both
- [ ] add code to open keyboard for typing words like it is done for Switch and Vita
Additional info
No response
Android filesystem is case-sensitive. Right now the code does not handle it properly. The logic present for case-sensitive filesystems is not applicable for Android due to a fact that an Android application has access (even for reading) only to certain directories.
If we are going to distribute APK via direct download, we can just use the MANAGE_EXTERNAL_STORAGE permission and screw the Google "best practices".
Android has native support of it.
I'm not sure about that. SDL_Mixer
has support for native MIDI on MacOS X and Windows, but not on Android. It can be built with TiMidity though (just like I did for our Android package), but in this case it requires additional files (GUS patches, i.e. soundfonts).
Hi @oleg-derevenetz , I see no issues not to follow "best practices" but make the application more user-friendly in general.
I see no issues not to follow "best practices" but make the application more user-friendly in general.
The problem is that in this case app becomes less suitable for Google Play :) So we have to choose between Google Play and ease of use ("just copy the data files to your SD card") in this case. Also people are often scared by permission requests.
Let's come to this issue at the very last moment once we fix other 12+ issues. Once the time comes we can decide which approach is the best to move forward.
We should enable software cursor rendering but we need to fix #5778 in order to make it work.
@ihhub
We should enable software cursor rendering
Why? What's the purpose of the mouse cursor on the touchscreen?
@oleg-derevenetz , we need to choose one of the way to control the game on Android devices:
- full touchscreen. In this case we need to add extra touch actions as now it is easy to miss a button or a cell in a battle
- emulation of cursor and clicks in the game. Showing a visible cursor to have high precision clicks.
I was thinking to try the second approach but looks like we have no choice but to stick to the first one. We can add some touch actions to avoid difficulties of controlling the game.
@ihhub
emulation of cursor and clicks in the game. Showing a visible cursor to have high precision clicks.
Never seen this :) How does this work? Does it emulate "right mouse button" on the touch screen? If this works fine, then maybe we should try this.
My artistic skills are not up to date but:
I've seen such games being played by other people. Of course it doesn't need to be black background and etc. but many games use this concept. If we stick to it we don't need to change much code in the game regarding controls.
@ihhub Well, looks promising. Does SDL have some built-in support for this mode?
@oleg-derevenetz , I do not know. We need to investigate this🙂
@ihhub
left click simulation
I suppose you mean RIGHT click simulation :) Left click is simulated just fine using the single touch.
@oleg-derevenetz , yes! I need more sleep :)
Any idea why copying the map files fails? I got the game up and running, but android refuses to copy the map files and shows some strange java error and the .MP2 files end up as 0 byte .MP2.mpeg files in the folder I need to copy them to.
Hi @poVoq how exactly are you trying to copy them? I usually use either Total Commander on the Android device itself or Windows Explorer when the device is attached to Windows machine using USB cable. It seems that the program you are using perceives the map files as multimedia files because of their MP2 extension. You can try to pack them into the ZIP archive, copy this ZIP archive to the device and then extract these files to the MAPS
directory using Total Commander.
I tried using the SimpleFiles app from f-droid. Other Apps do not seem to allow accessing the /android/data/ folder at all. I will try over a usb connection, but I think that system folder is not easily accessible that way either? Edit: seems to be possible to access via USB.
@poVoq this is Android/data/..
on the shared storage, i.e. full path from the phone filesystem root is /sdcard/Android/data/...
. This is not a system folder at all, any file manager, including the Android preinstalled "Files" app is able to access it and write to it:
In the standard files app from LinageOS it is totally inaccessible and the SimpleFiles app needs to ask special permission to access it. Copying via usb seems to work, but it is super slow and breaks down every new few minutes. Normally that does not happen when copying files to normal directories like the /downloads folder.
Copying via usb seems to work, but it is super slow and breaks down every new few minutes. Normally that does not happen when copying files to normal directories like the /downloads folder.
This probably happens because the device has been inactive for a moment and therefore goes into somekind of a rest mode. I transferred each directory separately.
@poVoq It's strange that interaction with this folder is broken on the LineageOS , because the main purpose of this folder is to allow user to exchange files with the installed apps.
My impression is that this folder is meant for storing app specific configuration files etc. and is not mean to be accessed manually at all.
@poVoq Nope, there is separate folder for this - /data/data/org.fheroes2
, so-called "private app folder". This folder is not accessible from outside (if phone is not in developer mode).
@poVoq Maybe this problem? https://www.reddit.com/r/Android/comments/j3zgmm/managing_files_in_the_androiddata_folder_on/
@oleg-derevenetz Is it possible to run the app in immersive mode?
@Laserlicht
Is it possible to run the app in immersive mode?
Yes, of course. Just replace fullscreen = off
by fullscreen = on
in fheroes2.cfg
.
P.S. Hi @ihhub maybe there is some way to integrate this setting into the GUI in addition to using hotkeys? It is unlikely that users on mobile systems will bother with manually editing the configuration file.
Hi @oleg-derevenetz , I am thinking we need to make full screen for Android devices by default. However, having a special option for this is in my to-do list.
I also found a crash: use drag and drop to split a stack and when you press okay, the application crashes.
Hi @ihhub
I also found a crash: use drag and drop to split a stack and when you press okay, the application crashes.
This crash is not related to Android, it is due to an assertion failure:
Assertion failed: (0), function addNewTroopsToFreeSlots, file army.cpp, line 813.
I am thinking we need to make full screen for Android devices by default
As for me personally, I'd like to have a choice, because I'm used to seeing the clock in the top bar to keep track of time. But this is a matter of taste.
https://www.reddit.com/r/Android/comments/j3zgmm/managing_files_in_the_androiddata_folder_on/
OMG, WTF. Another shitty design decision from Google under the sauce of "security". It looks like that they want to have only messengers, Facebook and Instagram on the platform. Apps that work with files? Meh.
Let's stick for Android 10-12 for now. All fancy Android 13 devices won't come up so quickly.