SuperTuxKart for Android?

Re: SuperTuxKart for Android?

Postby deve » 06 Feb 2017, 12:38

Hi jymis,

It looks great, thanks a lot! I sent you an email with few questions.

Btw. I already improved the fire button, so that now it displays the powerup icon and the "+" character if there is more than 1 item. And it's not displayed at all when there is no powerup, as you suggested.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby jymis » 07 Feb 2017, 23:46

Here are the files :)
Attachments
android_ui.zip
(292.98 KiB) Downloaded 63 times
User avatar
jymis
 
Posts: 137
Joined: 28 May 2012, 12:00

Re: SuperTuxKart for Android?

Postby deve » 11 Feb 2017, 01:38

I already added your icons to the game. Here are the screenshots:
screenshot.png

screenshot-nopowerup.png


Btw. turning left/right using accelerometer is already done either. Though at this stage you need to manually enable it in options, because it's not possible to get default device orientation using NDK functions. So it's unknown if we should use X or Y axis, and thus user must choose if he needs "phone" or "tablet" accelerometer. Most probably the only way for fully working solution is to use java code.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby QwertyChouskie » 11 Feb 2017, 01:49

Get default device orientation using NDK functions: http://irrlicht.sourceforge.net/forum/v ... =9&t=50206
User avatar
QwertyChouskie
 
Posts: 144
Joined: 29 Jun 2016, 14:57

Re: SuperTuxKart for Android?

Postby Worldblender » 11 Feb 2017, 19:01

Pushed a newer build compiled on 2/10/2017, replacing the previous one. See my Dropbox link for the new build.
User avatar
Worldblender
 
Posts: 34
Joined: 15 Aug 2014, 18:46

Re: SuperTuxKart for Android?

Postby Worldblender » 24 Feb 2017, 21:28

I pushed another build from 2/24/2017, replacing the 2/10/17 build. New in this build are updated icons in the race screen, accelerometer support (it comes disabled by default, but can be enabled in the config screen for the touchscreen. I also included all of the assets, including the karts, tracks, challenges, and grand prixes, like as if it was the desktop distribution (save for a few experimental tracks), so the file size is somewhat larger. I hope the new changes here bring a better experience for all of you!
User avatar
Worldblender
 
Posts: 34
Joined: 15 Aug 2014, 18:46

Re: SuperTuxKart for Android?

Postby deve » 25 Feb 2017, 00:35

The current version should also look much more similar to the original OpenGL 3.x renderer. It's not too dark anymore. There are also other minor fixes such as fixed a square below a kart when the kart shadow texture is missing, fixed a nitro gauge misplacement in multiplayer games etc...

If you have some crashes, it would be nice to get a backtrace, so that I can look at this and maybe fix some things before a release. The easiest way to get complete log is to connect a device to usb port and run command:
adb logcat | grep "SuperTux\|Irrlicht\|DEBUG"
The Adb is available in ubuntu repositories.

One known issue is that legacy pipeline (GLES 2.0) is currently broken. It at least doesn't work anymore on my tablet and on android emulator. I will see if it can be easily fixed, but the legacy pipeline is not officially supported anyway.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby GreenMonkeyGames » 26 Feb 2017, 08:02

Its, a very fun Mario-ish game with its own style, there are many users created worlds available. my only issue is with the performance.
GreenMonkeyGames
 
Posts: 1
Joined: 26 Feb 2017, 07:53

Re: SuperTuxKart for Android?

Postby QwertyChouskie » 28 Feb 2017, 00:21

Yes, I think the APK might be being built in debug mode. @Worldbender can you compile an APK using "RelWithDebInfo"?
User avatar
QwertyChouskie
 
Posts: 144
Joined: 29 Jun 2016, 14:57

Re: SuperTuxKart for Android?

Postby Worldblender » 28 Feb 2017, 00:26

QwertyChouskie {l Wrote}:Yes, I think the APK might be being built in debug mode. @Worldbender can you compile an APK using "RelWithDebInfo"?

I haven't learned how to compile APKs in release mode yet, as I don't have a lot of experience with creating Android packages yet, but I'm open to learning more. I did only what I could figure out without requiring a lot of time to be spent learning things.
User avatar
Worldblender
 
Posts: 34
Joined: 15 Aug 2014, 18:46

Re: SuperTuxKart for Android?

Postby QwertyChouskie » 28 Feb 2017, 00:38

@deve maybe that should be added to the Android readme.md?
User avatar
QwertyChouskie
 
Posts: 144
Joined: 29 Jun 2016, 14:57

Re: SuperTuxKart for Android?

Postby deve » 28 Feb 2017, 06:32

Ok, some good news. I made some fixes for legacy pipeline, so that people with Android >= 4.4 that have only GLES 2.0 GPU can still play the game.

I also made a version that should work on older android versions (tested with 4.2) by commenting out a lot of GLES 3.0 code:
https://github.com/deveee/stk-code/tree/android-4.2
I needed it to see how STK works on a phone, but you can compile it for your own use if you want :)

And I wonder why do you need accelerometer support, because on 5" phone the on-screen buttons are still more comfortable for me :-P Maybe I just got used to it...

STK as a shared library is compiled with -O3 -g -DNDEBUG, so it's something like release mode with some basic symbols. It's just the apk itself is in debug mode, so that it will report a crash backtrace to the console. You can change 'android:debuggable="true" ' in AndroidManifest.xml and 'ant debug' to 'ant release' in make.sh. But in this case you have to manually sign the apk with your key.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby deve » 25 Mar 2017, 22:52

Cocoa Temple at highest settings (without shadows and GI). But don't ask abot fps :-P
screenshot.jpg
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby menu261 » 01 May 2017, 15:13

I've successfully installed the apk build by Worldblender. It's amazing :cool: STK for Android :-) I love it
I've tested with both OnePlus 3T (OOS) and Android TV by Sony

Every thing does work perfectly

But I have a little question:

On my Android TV I have two Logitech controller connected - how can I make them work? They work on other Apps (for example the settings app) but once I'm on the stk app they don't show any functionality

Thank you :)
menu261
 
Posts: 2
Joined: 01 May 2017, 15:06

Re: SuperTuxKart for Android?

Postby deve » 02 May 2017, 20:55

I'm glad that it works :)

Atm. there is no gamepad/joystick support. The problem is that Android C/C++ API provides only basic functionality and a lot of things are missing (i.e. no unicode characters, no auto-detection of screen orientation for accelerometer etc). It looks that some work can be done (I see some AINPUT_SOURCE_GAMEPAD or AINPUT_SOURCE_JOYSTICK in Android NDK), but I can't really check it because I don't have any controller that I could use. Maybe I will also make some work using java vm, that allows to execute java functions inside C++ application, but probably after stable release.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby QwertyChouskie » 02 May 2017, 21:24

@deve Did you see my previous post with the link to the post about how to get the default orientation? If not, here's the link again: http://irrlicht.sourceforge.net/forum/v ... =9&t=50206
User avatar
QwertyChouskie
 
Posts: 144
Joined: 29 Jun 2016, 14:57

Re: SuperTuxKart for Android?

Postby deve » 12 May 2017, 08:43

@QwertyChouskie This is what I meant by using java vm. It's not just for screen orientation. It's also for better keyboard support (detect if we have physical keyboard connected, allow to write national characters), allow to hide navigation buttons when playing, probably also get gamepad count and names, get information about android version, user name, default language etc... Maybe I will make some work after STK 0.9.3.

@menu261 Proper gamepad support is not trivial to do, but you can easily make some hacks if you have enough skills. I mean assign some key codes to irrlicht keys in CIrrDeviceAndroid.cpp. Gamepads seem to usually use AKEYCODE_BUTTON_1-16, AKEYCODE_BUTTON_A,B,C,X,Y,Z, AKEYCODE_BUTTON_START etc. So that you can assign it to for example KEY_KEY_1, KEY_KEY_2 etc. The directional pad is a bit more complicated because the events are received as mouse events. But you can just send left/right/up/down irrlicht key event using postEventFromUser() (though this will probably break mouse support).
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby menu261 » 12 May 2017, 15:13

Okay I'll try :think:
Where is the source code found (GitHub?) And where is this file you told? I'm new to stk development - sorry for this stupid question :p
First of all I need to understand how to compile the code - next I'll :!: try :!: to add the functionality :? :think:

Edit:
I've found it https://github.com/supertuxkart/stk-cod ... ndroid.cpp

I have a new idea: I like to add another "controller":
I like to write an Android app as the controller - so you can pear the device with the Game - maybe via something like a nodejs server with socket io
Can you please tell me which files I need to edit to add a new kind of controller I would need years to search all the files

Maybe I'll also add a new entry to the options/controller settings
I wonder if you could tell me where I can find all those files
menu261
 
Posts: 2
Joined: 01 May 2017, 15:06

Re: SuperTuxKart for Android?

Postby deve » 13 Jul 2017, 10:19

Someone asked me what can be done in the Android port, so here is a small TODO list:

1. Improve generate_assets script to make the apk smaller.

We can automatically check textures in data/karts/*, data/tracks/*, data/library/* to make sure that there are no unused or duplicated textures. Unused textures can be checked in similar way like in the convert_b3d() function.

2. Allow to change resolution for better performance.

There are two ways to do it. Using our scale_rtts_factor or using ANativeWindow_setBuffersGeometry. The frst option works only when we have advanced lighting enabled. We can force using RTTs when advanced lighting is disabled, but in this case we have preformance boost only for very low resolutions.

The ANativeWindow_setBuffersGeometry gives much better performance and works when advanced lighting is disabled. But I saw some crashes in this function and it also affects the behaviour of ANativeWindow_getWidth/Height functions. Also our irrlicht device can be initialized multiple times, so it needs some thinking how to do it properly.

3. Automatically detect if there is external keyboard connected.

Disable multiplayer icon if there is no keyboad, and disable software keyboard if there is external keyboard available.

4. Gamepad support

It should help a lot for playing on Android TV. Multiple gamepads support is not trivial, but simulating keyboard events when gamepad event is received in irrlicht android device should be easy.

5. Better kart control

Current solution works fine on a tablet (especially that we already have buttons scaling, a possibility to move steering wheel to the right side etc.), but it chould be better on phones with small screens. Not sure how to solve it, maybe try to use some gestures.

6. Add support for current NDK

A bit more info:
https://android.googlesource.com/platfo ... Headers.md
https://github.com/android-ndk/ndk/issues/445
https://github.com/openssl/openssl/issues/3826

7. A lot of other work:
- better screen keyboard layout
- show a progress bar also when old data is removing and not only when new data is extracting
- try to detect some issues in assets manager, i.e. if user deleted some important files
- try to get system language (should be possible with AConfiguration_getLanguage)
- add support for native calling conventions in angelscript for aarch64 to make scripting working for 64-bit builds
- better progress bar screen (i.e. add a background, STK logo etc...)
- try to adjust our guiengine to high dpi screens
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Mr.XX99 » 09 Feb 2018, 19:01

Hi,
I maybe have some useful links for the android development

For gamepad support on android maybe this could help: https://developer.nvidia.com/cross-platform-gamepad-api

For the issue with packet size limit I see 3 possible solutions:
1) Use the expansion file (.obb) as zip file to include the full STK folder and read it directly from zip file
2) Use the expansion file (.obb) as zip file and unzip it after first start (but the zipped .obb file must be kept, so you would need more space)
3) download the zipped stk folder from an own server

the advantage of 1) and 2) is that no extra server is needed as the expansions files are on the google servers, but the disadvantage is that (at least officially) this expansian file can only be loaded if the app is downloaded from google play.
So those who would download the apk from e.g. sourceforge would need to download the .obb file seperatly and copy it in it's destination folder or there would be a different apk for these sources that just contains all, because afaik the packet size is not relevant if you do not download from google play.

Here are the links:
https://developer.android.com/google/pl ... files.html (documentation from google for expansion file)
https://stackoverflow.com/questions/185 ... 2#18739812 (directly read from .zip file in c++)
https://stackoverflow.com/questions/124 ... les-from-c (directly read from .zip file in c/c++)

@deve: As you may notice from my username, I'm the person with the Android TV device ;)
Last edited by Mr.XX99 on 09 Feb 2018, 21:21, edited 1 time in total.
Playing SuperTuxKart on my Windows 10 Laptop, my mobile phone and hopefully soon on my Anroid TV :)
(profile picture from John Tuggle URL: https://www.flickr.com/photos/22565768@N04/4454921691 License: https://creativecommons.org/licenses/by/2.0/ picture was edited by me)
User avatar
Mr.XX99
 
Posts: 11
Joined: 29 Dec 2017, 21:39
Location: Germany

Re: SuperTuxKart for Android?

Postby Mr.XX99 » 09 Feb 2018, 19:08

And I have one question: How do I compile for android on Windows?
Playing SuperTuxKart on my Windows 10 Laptop, my mobile phone and hopefully soon on my Anroid TV :)
(profile picture from John Tuggle URL: https://www.flickr.com/photos/22565768@N04/4454921691 License: https://creativecommons.org/licenses/by/2.0/ picture was edited by me)
User avatar
Mr.XX99
 
Posts: 11
Joined: 29 Dec 2017, 21:39
Location: Germany

Re: SuperTuxKart for Android?

Postby deve » 11 Feb 2018, 01:12

Atm. it's not possible to compile it directly on windows. It should be possible to do under cygwin, but IIRC it wasn't able to generate ndk toolchain.

Regarding to gamepads, I know it in theory, but every device and android version may work differently, so that some testing won't hurt.

And I don't like obb files, because it is specific to google play and it doesn't have much sense when you download the game from sourceforge, fdroid (if they will care), self-compile etc... In theory we can convert everything with lzma an decompress it on the first run, because we are extracting assets anyway. It can give few additional megabytes. But I have no idea if this would be fast enough.

Or in theory we can share "full data" as separate apk, so that if someone is interested in it, then he can install it.

And for Android TV, currently google complains about "Your app is missing or incorrectly using the “isGame” flag in the AndroidManifest.xml". As far as I see it's done properly and STK is properly listed in "Games" category under emulator. I hope that you will be able to install it via google play soon. Or I can share the apk on dropbox if you want to test it.
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Mr.XX99 » 11 Feb 2018, 17:06

So it only can compile on Linux? So I could try to compile it on Linux in VirtualBox?
Maybe you could include the latest version of the apk

+1 for an "full data"-apk. Don't like that the android version is stripped down. But hopefully you manage to bring the full version to google play somehow. Other games also use the expansion files so it should be possible to read from zip file fast enough for good performance.

Is there any progress regarding fdroid?

I will take a look tomorrow at the Manifest, maybe I see what's wrong.
If the new beta version is not up in google play on monday, I would be happy if you can share the file on dropbox so I can test it :)
If you want me to test anything concrete, please tell me ;)
Atm I can only test with one gamepad on android, but if you have implemented multiple controller support maybe I could borrow a second controller from friends to test on android.
Playing SuperTuxKart on my Windows 10 Laptop, my mobile phone and hopefully soon on my Anroid TV :)
(profile picture from John Tuggle URL: https://www.flickr.com/photos/22565768@N04/4454921691 License: https://creativecommons.org/licenses/by/2.0/ picture was edited by me)
User avatar
Mr.XX99
 
Posts: 11
Joined: 29 Dec 2017, 21:39
Location: Germany

Re: SuperTuxKart for Android?

Postby Mr.XX99 » 13 Feb 2018, 12:01

So I tested the newest android beta on my Android TV (NVIDIA Shield TV).

It now shows up in the game row an my device too, so I can't see a problem with the "isGame"-flag.
I can play with a gamepad but the steering is digital not analog, but I guess you know this as you wrote somewhere that you just mapped it to keyboard keys for now. And the L2 and R2 buttons are not recognized. And the B-Button feels like hardcoded to the back action as I can't remap it.
The login screen does not do anything on android TV, I can't click any button there. And btw for general android: Why isn't the native android keybord used?
I deleted the old beta version to test if I can find it on the google play store on TV, but I couldn't. Maybe this just will take same time.
Other than that I run very well on the Shield TV, much better than on my Laptop with Intel HD Graphics. Over 100 fps on standard settings and 25 to 47 fps at highest settings (assuming the first of the three values is the normal fps, always wondered why there are three values.)
Playing SuperTuxKart on my Windows 10 Laptop, my mobile phone and hopefully soon on my Anroid TV :)
(profile picture from John Tuggle URL: https://www.flickr.com/photos/22565768@N04/4454921691 License: https://creativecommons.org/licenses/by/2.0/ picture was edited by me)
User avatar
Mr.XX99
 
Posts: 11
Joined: 29 Dec 2017, 21:39
Location: Germany

Re: SuperTuxKart for Android?

Postby deve » 13 Feb 2018, 21:02

Too many questions ;)

Yes, it uses bash script for compilation and atm. it can be compiled only on linux.

Regarding to fdroid, it looks that they don't care at all and I didn't receive any answer from them for a very long time. So I don't really care either. It's possible to download the apk from sourceforge anyway. Or if you want, you can install fdroid server, fix STK compilation and make pull request, so maybe they will accept it.

The "isGame" in android manifest is not a problem anymore.

The three values in fps is min/current/max.

And the android software keyboard is very limited in ndk, so that own keyboard is easier to do. I can for example draw it on top/bottom of screen, so that the edit label is always visible. Also unicode characters atm. don't work in STK and I can just not display them. But I agree that it's far from perfect.

And yes, B-Button is atm. hardcoded to escape key, because google says that it must be possible to navigate wit A and B buttons and you can't assume that other buttons (start, select) are available. It should be better when I will send proper gamepad events, so that it won't be hardcoded as escape. And it will fix analog controls too.

Do you see button names when you assign buttons in input settings? Atm. it should give "return", "escape", "menu" and values from 2 to 9. Or you just see " ? " for all buttons? Because on my old gamepads it only detects A and B buttons (as return and escape) and all other buttons have non-typical system key codes (android doesn't recognize them).
deve
 
Posts: 205
Joined: 23 Jan 2014, 13:45

Who is online

Users browsing this forum: No registered users and 1 guest