Submitting my Android patches
Posted: 04 May 2021 17:13
Android port had accumulated a number of improvements compared to the main OpenTTD codebase. I'd like to push at least some of them into the upstream repository.
The problem here is that many of these changes are only useful for small-size touchscreen devices, and OpenTTD dev team only considers desktop/laptop PC with a mouse as their target hardware, so I don't want to waste my time preparing a patch that will get rejected.
So in this post I'll list the features from Android version, and I'd like for someone from the dev team to comment whether they see any of them as useful for desktop OpenTTD.
=== Android platform support.
Run OpenTTD on Chromebooks and on Android desktop environment, such as Samsung phones in DEX mode with external monitor and mouse. No changes to the user interface in this patch. This will work similarly to OpenTTD JGR version published to the Play Store.
OpenTTD Android uses my unofficial SDL 1.2 Android port. It is possible to compile OpenTTD using the official SDL2 library, which also has Android support, however you'll need to cross-compile all other libraries, such as lzma, lzo2, icu, and fontconfig (you can copypaste them from my SDL1.2 repo), and you'll also need to think up some solution for copying or unpacking game data, because you're not getting this feature with SDL2 on Android by default. Anyway, I'll only provide a patch for use with my SDL 1.2 repo.
It also includes libtimidity music backend, which was removed from OpenTTD some time ago. My SDL 1.2 repo includes Fluidsynth library, with hacked together GLIB stubs to make it compile without GLIB, so if you are firmly against libtimidity comeback, I'll switch to Fluidsynth when preparing a patch.
=== Build confirmation dialog.
Ok/Cancel dialog pops up every time you build something, and there's even a cost estimation tooltip. OK button pops right under your mouse cursor, so you can confirm your command with a double-click. Makes it easier to correct mis-placed road, you don't need to press Escape while holding the mouse button.
=== Scalable user interface.
Recent introduction of MacBooks with high-resolution displays, which made the default bitmap font unreadable and buttons too small to click even with a trackpad, had prompted the development of 2x and 4x interface size feature, which I can only see as a sloppy workaround compared to the full UI redesign of Android version, where you can select button size and font size independently and in gradual increments. It needs .TTF fonths though, you cannot resize built-in bitmap font. Strangely enough, it works well together with 2x and 4x font size option recently introduced in upstream OpenTTD. And if you set button size to 10, you will get the regular old desktop OpenTTD user interface.
This patch touches almost every game dialog, and changes several dialogs to have horizontal layout to better fit wide-screen phones.
=== Drag scrolling.
Scroll all lists by clicking on any element and dragging your mouse up/down. Windows 10 implements this in the new Control Panel. Scrollbars are still present, so you can scroll the old way too.
=== Split vertical toolbar.
Move the toolbar to the left and right edges of the screen. Frees up visual space on wide-screen phones, and makes the toolbar easier to use with your fingers.
=== Remove title bars from all dialogs.
Saves vertical space on wide-screen phones, at the expense of unfamiliar user interface. Drag any dialog beyond the edge of the screen to close it, which is more comfortable for finger input than hitting the 'X' button. Not so good for mouse input.
=== Cloud saves.
I can only provide the user interface for them, everything else is implemented by Google Play Game Services, which is available only for Android, iOS, and for the web with REST API. I've heard that Steam supports cloud saves with some kind of simple API that won't need linking to proprietary Steam libraries.
=== Tutorial.
Or at least something that looks like it. Actually a bunch of links to Youtube videos. The desktop version doesn't even have this much. Still, users on Play Store keep putting 1 star reviews with comments like 'No tutorial' or 'Too hard to understand', for some reason. I can put the links to OpenTTD wiki pages if you think that will be better.
=== 16bpp blitter.
Was implemented to make the game run faster on Galaxy Note 3. Does not support palette animation. I don't think anyone needs it at this point of time. I'll probably remove it next year or so.
=== Window ornaments.
This feature is already rejected. It was implemented for the purpose of Android version being superior to the desktop version, because it has one extra feature. Anyway, you guys have no style.
https://github.com/OpenTTD/OpenTTD/pull/8041
The problem here is that many of these changes are only useful for small-size touchscreen devices, and OpenTTD dev team only considers desktop/laptop PC with a mouse as their target hardware, so I don't want to waste my time preparing a patch that will get rejected.
So in this post I'll list the features from Android version, and I'd like for someone from the dev team to comment whether they see any of them as useful for desktop OpenTTD.
=== Android platform support.
Run OpenTTD on Chromebooks and on Android desktop environment, such as Samsung phones in DEX mode with external monitor and mouse. No changes to the user interface in this patch. This will work similarly to OpenTTD JGR version published to the Play Store.
OpenTTD Android uses my unofficial SDL 1.2 Android port. It is possible to compile OpenTTD using the official SDL2 library, which also has Android support, however you'll need to cross-compile all other libraries, such as lzma, lzo2, icu, and fontconfig (you can copypaste them from my SDL1.2 repo), and you'll also need to think up some solution for copying or unpacking game data, because you're not getting this feature with SDL2 on Android by default. Anyway, I'll only provide a patch for use with my SDL 1.2 repo.
It also includes libtimidity music backend, which was removed from OpenTTD some time ago. My SDL 1.2 repo includes Fluidsynth library, with hacked together GLIB stubs to make it compile without GLIB, so if you are firmly against libtimidity comeback, I'll switch to Fluidsynth when preparing a patch.
=== Build confirmation dialog.
Ok/Cancel dialog pops up every time you build something, and there's even a cost estimation tooltip. OK button pops right under your mouse cursor, so you can confirm your command with a double-click. Makes it easier to correct mis-placed road, you don't need to press Escape while holding the mouse button.
=== Scalable user interface.
Recent introduction of MacBooks with high-resolution displays, which made the default bitmap font unreadable and buttons too small to click even with a trackpad, had prompted the development of 2x and 4x interface size feature, which I can only see as a sloppy workaround compared to the full UI redesign of Android version, where you can select button size and font size independently and in gradual increments. It needs .TTF fonths though, you cannot resize built-in bitmap font. Strangely enough, it works well together with 2x and 4x font size option recently introduced in upstream OpenTTD. And if you set button size to 10, you will get the regular old desktop OpenTTD user interface.
This patch touches almost every game dialog, and changes several dialogs to have horizontal layout to better fit wide-screen phones.
=== Drag scrolling.
Scroll all lists by clicking on any element and dragging your mouse up/down. Windows 10 implements this in the new Control Panel. Scrollbars are still present, so you can scroll the old way too.
=== Split vertical toolbar.
Move the toolbar to the left and right edges of the screen. Frees up visual space on wide-screen phones, and makes the toolbar easier to use with your fingers.
=== Remove title bars from all dialogs.
Saves vertical space on wide-screen phones, at the expense of unfamiliar user interface. Drag any dialog beyond the edge of the screen to close it, which is more comfortable for finger input than hitting the 'X' button. Not so good for mouse input.
=== Cloud saves.
I can only provide the user interface for them, everything else is implemented by Google Play Game Services, which is available only for Android, iOS, and for the web with REST API. I've heard that Steam supports cloud saves with some kind of simple API that won't need linking to proprietary Steam libraries.
=== Tutorial.
Or at least something that looks like it. Actually a bunch of links to Youtube videos. The desktop version doesn't even have this much. Still, users on Play Store keep putting 1 star reviews with comments like 'No tutorial' or 'Too hard to understand', for some reason. I can put the links to OpenTTD wiki pages if you think that will be better.
=== 16bpp blitter.
Was implemented to make the game run faster on Galaxy Note 3. Does not support palette animation. I don't think anyone needs it at this point of time. I'll probably remove it next year or so.
=== Window ornaments.
This feature is already rejected. It was implemented for the purpose of Android version being superior to the desktop version, because it has one extra feature. Anyway, you guys have no style.
https://github.com/OpenTTD/OpenTTD/pull/8041