Submitting my Android patches

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
pelya
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 18 Nov 2010 19:48
Contact:

Submitting my Android patches

Post by pelya »

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.
Screenshot_2021-05-04-18-57-43-146_org.openttd.sdl.jpg
Build confirmation dialog
(1.64 MiB) Not downloaded yet
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.
Screenshot_2021-05-04-19-08-51-905_org.openttd.sdl.jpg
48px button size
(645.94 KiB) Not downloaded yet
Screenshot_2021-05-04-19-09-55-970_org.openttd.sdl.jpg
10px button size
(1.3 MiB) Not downloaded yet
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
perverted monkey
Traffic Manager
Traffic Manager
Posts: 144
Joined: 02 Mar 2009 02:07

Re: Submitting my Android patches

Post by perverted monkey »

It is not that some guys do not have style. They do.

These ornaments:
1. Mix with the text.
2. OTTD UI has 3D borders and these are flat and colorless (I am sorry, but they are quite ugly).

Since I want to be constructive:
Would be nice if the ornaments were 3D and their color matched the color of the window. But then you would have to fix 1 and they would use more space.

If you can come out with something better, I don't think the devs will reject it. :)

BTW: Please consider a different combination of colors for this:
Image
White on yellow, even with the black shadow, isn't so readable.

:bow: Thanks.
User avatar
orudge
Administrator
Administrator
Posts: 24928
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Re: Submitting my Android patches

Post by orudge »

pelya wrote: 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.
I would be quite interested to see an official Android (and in theory iOS, though in practice of course that's rather difficult for distribution) port, though have no realistic time to maintain one myself! My daughter likes playing the game on her tablet (I find it a little frustrating myself, but then I've been playing the desktop version for 23 years!)
pelya wrote: 04 May 2021 17:13 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)
I would expect using the official SDL 2 library would be the preferred route, or alternatively making use of the new OpenGL video driver (though that still uses SDL2 on Linux I think). In terms of dependencies, vcpkg may be worth investigating. Android isn't officially supported by vcpkg but it seems there's unofficial support, and patches to vcpkg are always welcome. Whether any of the libraries OpenTTD requires are supported via the vcpkg Android triplets I couldn't say; I may test it out sometime.

I can't really offer any comments on anything else I'm afraid, but perhaps the above may be of some use.
pelya
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 18 Nov 2010 19:48
Contact:

Re: Submitting my Android patches

Post by pelya »

Well yeah, I don't actually care much about the ornaments feature, it was more like a joke. I'll probably try to make ornaments 2x bigger and with two different color shades, when I'll finish with more important bugs.

Build confirmation was added to Android version five years ago, and I am getting some feedback about it only now. Did you miss that big OpenTTD on Android thread? Changing tooltip colors is trivial, I've already done it, and you'll see the fix in 1.11.2 update in a day or two.
perverted monkey
Traffic Manager
Traffic Manager
Posts: 144
Joined: 02 Mar 2009 02:07

Re: Submitting my Android patches

Post by perverted monkey »

Thanks. Had it installed in my son's previous tablet that broke. Yesteday he got a new one. Will install ASAP!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 10 guests