SuperTuxKart for Android?

SuperTuxKart for Android?

Postby Menasheh » 25 Jan 2015, 01:51

I was wondering if anyone else would be interested in the possibility of an android port of SuperTuxKart.

How complicated would this be? How much new code would be required, as opposed to using the current code?
Menasheh
 
Posts: 5
Joined: 25 Jan 2015, 01:46

Re: SuperTuxKart for Android?

Postby Tiger » 25 Jan 2015, 15:28

This would be nice. :)
My tablet runs Android Jelly Bean. The major issue (for us, users) will be the drain of the battery. :(
User avatar
Tiger
 
Posts: 46
Joined: 24 Oct 2014, 20:54

Re: SuperTuxKart for Android?

Postby XGhost » 25 Jan 2015, 15:34

This should basically be possible with an old STK-Version...
Last edited by XGhost on 11 Jul 2018, 02:28, edited 1 time in total.
User avatar
XGhost
 
Posts: 147
Joined: 02 Jan 2014, 15:49
Location: Zurich (Switzerland)

Re: SuperTuxKart for Android?

Postby Menasheh » 25 Jan 2015, 22:44

I don't think there's anything particularly unfeasable about having the latest stk work on android. True, it might be a battery drain, and it may be slow on older phones, but there should be potential. I just don't know where to start.
Menasheh
 
Posts: 5
Joined: 25 Jan 2015, 01:46

Re: SuperTuxKart for Android?

Postby vlj » 25 Jan 2015, 23:47

In theory (and only in theory...) everything required by the opengGL 3.1 mode of the engine does exists in GLES 3.0. And we can port shadowmap generation so that it works without geometry shader. So STK could fit gles 3.0 device without any change in the engine logic (but I think gles does not use gl function, everything will need to be renamed using the gles prefix which is tedious...).

In theory again the only other thing is modify CIrrDeviceLinux.cpp so that the glx context creation would be replaced by egl one's and X API calls by the Android windowing system's one.
I'm in favor of adding egl support even without Android support so that we can get STK to run on Egl platforms natively (eg Wayland). It would allow to create GLES context for Xorg too.
Basically these glx callbacks chain : glXChooseFBConfig, glXGetVisualFromFBConfig, glXCreateContextAttribsARB , glMakeCurrent
By this one : eglGetDisplay, eglInitialize, eglChooseConfig, eglCreateContext, eglCreateWindowSurface, eglMakeCurrent

and replace all call to X API by the one used by Android. I didn't spend time on this but I think there is way to sharethe egl context creation and have Platform dependent code for the rest of the windowing system.
vlj
 
Posts: 58
Joined: 27 Dec 2013, 04:22

Re: SuperTuxKart for Android?

Postby hiker » 27 Jan 2015, 06:32

Hi,

I had stk running on an Android tablet ... a while ago (one year +), and iirc there's also a github repo and a youtube video about this.

Main issue is stk is atm focused on improving the graphics, while on an android tablet you would need lower graphics (e.g. smaller textures, less vertices, ...). So in order to have a really playable game a fair amount of work on assets would be required. Out team is too small to do that atm.

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: SuperTuxKart for Android?

Postby Anon » 27 Jan 2015, 20:26

So in order to have a really playable game a fair amount of work on assets would be required.


Maybe not... I just opened chocolate's source files and a couple library files, and most objects seem to respond fairly well to having a "Decimate" modifier (automatic vertex count reduction) added at a ratio of 0.5 (the only objects I had issues with were the road and models that were already extremely simple, like boxes). Also, textures shouldn't be too hard to imagemagick down to a smaller size (quality loss shouldn't be too noticable on smaller screens). IDK. it feels to me as if this might be feasible, especially if the game is run at a lower resolution when on mobile devices.

Of course, as an user, I'd much rather see development work focused on improving the core game. But if anyone wants to try this, I'd be willing to quickly convert tracks to lower resolutions for them to use as tests.

Also, wouldn't it be great if a version STK could be sold on Google Play, to support the developers and ensure continued development of the core game? As I understand it, the open-source nature of STK prevents this from being practical ATM. But if it turns out that the current tracks are too processor-intensive to run on mobile platforms, then the creation of some new, lighter weight but proprietary tracks might make it possible to make a commercial and mobile version of the game consisting of open-source code and proprietary assets.

IIRC, the commercial game Lugaru is licensed this way, with open source code but proprietary assets. There's also some precedent for opensource projects selling their product on an another marketplace to fund development; I think Krita is sold on Steam for a fair amount.
Anon
 
Posts: 208
Joined: 03 Jul 2014, 16:30

Re: SuperTuxKart for Android?

Postby deve » 27 Jan 2015, 21:31

I successfully run STK on Android using these instructions:
http://supertuxkart.sourceforge.net/Use ... tu/Android

I only needed to make two changes in Android.mk file:
- add "-frtti -fexceptions" compiler flags
- modify -DSUPERTUXKART_DATADIR definition

I have 15 fps and it is quite playable (well, controller could be more comfortable...)

It's not full-featured STK, but I think that it is good start.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Auria » 28 Jan 2015, 00:57

deve {l Wrote}:I successfully run STK on Android using these instructions:
http://supertuxkart.sourceforge.net/Use ... tu/Android

I only needed to make two changes in Android.mk file:
- add "-frtti -fexceptions" compiler flags
- modify -DSUPERTUXKART_DATADIR definition

I have 15 fps and it is quite playable (well, controller could be more comfortable...)

It's not full-featured STK, but I think that it is good start.


If I understand correctly, this is based on an older version of STK, right?
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: SuperTuxKart for Android?

Postby deve » 28 Jan 2015, 06:59

@Auria, yes, this is probably based on 0.8 version.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby vlj » 28 Jan 2015, 18:45

FWIW I opened a branch "egl" to create an egl context instead of a glx one on X11.
Currently it crashes because of GLEW, which is calling glx callback instead of egl ones...
vlj
 
Posts: 58
Joined: 27 Dec 2013, 04:22

Re: SuperTuxKart for Android?

Postby vlj » 28 Jan 2015, 19:00

I (badly) hacked things and now it looks like it sortof work with egl on mesa.
vlj
 
Posts: 58
Joined: 27 Dec 2013, 04:22

Re: SuperTuxKart for Android?

Postby Menasheh » 07 Apr 2015, 19:06

So, is anything being done about this?

Assuming not, Is anyone able to guide me in working toward this goal? I don't have very much experience in the area, but I'd really want to try if I knew what to do.

EDIT: What is mesa? And how do I get to the point where I can see these errors and try to work on them?
Menasheh
 
Posts: 5
Joined: 25 Jan 2015, 01:46

Re: SuperTuxKart for Android?

Postby deve » 08 Apr 2015, 08:38

@Menasheh

GLES 3.0 is supported on Android 4.3 and higher, so in theory "egl" branch should work (if you have it in your local repository, because it has been removed upstream).

You need to create whole build environment with a lot of dependencies (openal, curl, etc...) and probably add in code a lot of '#ifdef ANDROID' to for example support file manager functions, to support steering and many more. Ideally also add multitouch support to Irrlicht (you can look how it has been done in SDL2). Generally it is A LOT of work ;)

If you want to make old-gen Supertuxkart fully working on Android (irrlicht-based version 0.8.1 and older), here are some instructions:
http://supertuxkart.sourceforge.net/Use ... tu/Android
It works quite good. The only thing is to make proper multitouch steering and maybe enable sounds. Other things are less important.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby sst » 14 Apr 2015, 14:24

i have an Android Tablet, ... [Samsung Galaxy NotePro 12.2 (4.4.2)]
i will "test and try to compile", the Android version.
(sst)
sst
 
Posts: 99
Joined: 14 Jan 2010, 21:55

Re: SuperTuxKart for Android?

Postby Menasheh » 20 Apr 2015, 22:57

deve {l Wrote}:@Menasheh

GLES 3.0 is supported on Android 4.3 and higher, so in theory "egl" branch should work (if you have it in your local repository, because it has been removed upstream).

You need to create whole build environment with a lot of dependencies (openal, curl, etc...) and probably add in code a lot of '#ifdef ANDROID' to for example support file manager functions, to support steering and many more. Ideally also add multitouch support to Irrlicht (you can look how it has been done in SDL2). Generally it is A LOT of work ;)

If you want to make old-gen Supertuxkart fully working on Android (irrlicht-based version 0.8.1 and older), here are some instructions:
http://supertuxkart.sourceforge.net/Use ... tu/Android
It works quite good. The only thing is to make proper multitouch steering and maybe enable sounds. Other things are less important.


I want to get a current version of SuperTuxKart up and running on Android. I also want to get it to the point where not very much is required to update the android version with desktop version updates. I'm willing to put a decent amount of work in to it, but I really don't know where to start. I can clone the repository and revert to the egl branch, but if its been removed upstream, my branch would be outdated. I need to get to the point where individual things don't work so I can look to fix those things in order to get to the next step.

Once I have a repository cloned on my computer, how do I start building?

Will attempting that break and give useful messages like "you need to install software x" or "line x in file y will not work"?
Menasheh
 
Posts: 5
Joined: 25 Jan 2015, 01:46

Re: SuperTuxKart for Android?

Postby deve » 08 Jul 2015, 14:07

I was thinking about STK on android a bit. And there is quite a lot of work.

- Create a project for android
- Create a wrapper in java to support mouse/touch events, window events etc (we can partially use SDL2 code).
- Compile Supertuxkart dependencies for android
* ogg, vorbis, zlib, png and jpeg libraries are used in SDL2 and can be compiled without problems, so we could use their android.mk files
* openal has been ported for android, for example here: git://repo.or.cz/openal-soft/android.git but I didn't test it yet
* fribidi can be probably compiled, but if there are problems, it can be simply disabled for now
* I don't know what about libcurl and its dependencies. We should check what we actually need because there is a lot of flags to enable/disable some features. And first check if this can be used on android at all.
* I also don't know if angelscript will work on android. Debian maintainers had some problems to make it working on arm devices.
- Create CIrrDeviceAndroid.cpp file which should basically do the same as other CIrrDevice files (handle events, create window etc...)
- If we decide to put assets in apk file, we should also add some functions in file manager to allow to read these files. It's not that hard, just pass a pointer to assets manager from java to our native appilcation, and then use assets manager library from android ndk.
- Port GL engine to GLES. I remember that vlj said that it's not that hard because GL 3.x is quite similar to GLES 3.0. But some work must be done. Creating egl context is already done by vlj in egl branch (I can upload it if someone needs it). Glew library should be probably removed/modified or replaced by something other because it requires GLX.
- Write nice multitouch steering
- Make smaller version of assets because nobody will install 1GB game on smartphone/tablet

I probably forgot about a lot of other things ;)

Basically I think that it is too much of work if you don't do it 8 hours a day, 5 days a week, but only in your free time.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Menasheh » 18 Jul 2016, 01:56

I can work on this now, where should I start?
Menasheh
 
Posts: 5
Joined: 25 Jan 2015, 01:46

Re: SuperTuxKart for Android?

Postby rondnelson99 » 20 Jan 2017, 23:56

I have an odroid c2 (similar to raspberry pi) and I play stk on it using this: it says it converts stk's opengl calls into opengl es. I know nothing about this, but It appears that some of the work has already been done for a completely different reason. Odroids do not support opengl only opengl es. http://forum.odroid.com/viewtopic.php?f=91&t=5938
rondnelson99
 
Posts: 2
Joined: 20 Jan 2017, 23:42

Re: SuperTuxKart for Android?

Postby deve » 25 Jan 2017, 09:17

rondnelson99 {l Wrote}:I have an odroid c2 (similar to raspberry pi) and I play stk on it using this: it says it converts stk's opengl calls into opengl es. I know nothing about this, but It appears that some of the work has already been done for a completely different reason. Odroids do not support opengl only opengl es. http://forum.odroid.com/viewtopic.php?f=91&t=5938


A lot of work has been already done for Android port (TODO is outdated ;) ). In this topic you can see some screenshots/videos:
viewtopic.php?f=17&t=7122

You can also compile current STK version with OpenGL ES renderer using "cmake .. -DUSE_GLES2=1". Though it requires GLES >= 3.0 for proper working (raspberry pi has only GLES 2.0, I don't know what about odroid). It should still run with GLES 2.0, but will look buggy.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Worldblender » 02 Feb 2017, 01:49

I have made an experimental build based on recent commits, with no alterations to the source code whatsoever. I will keep this build up and possibly update it occasionally until official builds are released.
http://45.21.218.32:81/supertuxkart-work/SuperTuxKart-debug-arm.apk :heart:

This build is for ARMv7 devices. I can create more builds for other architectures such as for x86* and 64-bit ARM(v8) on request.
More details:
  • A device running at least Android 4.4.2 (API level 19) is required to run this program.
  • The data files as well as the directory layout are created on the internal storage on first run.
  • There is less content in here than the regular versions. Only three karts (Nolok, Tux, and Xue) come bundled. Only most of the tracks that can be played without completing challenges are available.
  • Story mode will cause the program to crash; setting its related mode to 'false' allows it to load normally.
  • Lots of icons appear on the race screen as the primary UI, though hardware devices can be used instead. USB and Bluetooth ones work, but they will appear under the device "Keyboard 0", so it is not possible to use separate ones for multiplayer.
  • By manually copying the data from a desktop installation to the data directory, it is possible to get very close to a full-blown experience.
  • Most addons will likely work, even if they have been copied manually.
Other than these caveats listed, the Android version runs almost like the regular desktop version. Give this build a try, and tell me how well it runs! ;)
Update: Moved the APK to one of my home servers.
Last edited by Worldblender on 31 Aug 2017, 20:00, edited 1 time in total.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: SuperTuxKart for Android?

Postby deve » 02 Feb 2017, 06:38

Nice to see that build script works fine ;) Did you notice any issues with compilation?

Just few suggestions:
- at this stage arm64 build doesn't have a sense because angelscript doesn't work on this architecture and I didn't notice any performance improvements
- I suggest to not use newest NDK which uses clang by default because it causes strange crash on startup on some devices (even though it works on others). NDK 12b works fine as far as I tested.
- change the version in utils/constants.cpp and data/supertuxkart.git to something unical, for example "git20120201", so that STK will automatically extract new assets when it will detect different version

Data files can be moved to external card after extraction (i.e.from /storage/sdcard0/stk to /storage/sdcard1/stk) and the game should find it. Do you think that it should be installed by default on external storage?

The story mode works fine for me, but if you get a crash, could you connect the device to your computer and run:
{l Code}: {l Select All Code}
adb logcat | grep "SuperTux\|Irrlicht\|DEBUG"

Adb is available in ubuntu repositories. It will show some useful logs and a crash backtrace.

Also is someone able to test it on Android 4.4.2? It was tested on ~10-15 devices with Android >= 5.0 and it generally works fine, but tests for for Android 4.4 are really missing, so it's hard to say for sure if STK works on it.

And the apk is restricted to GLES >= 2.0 (just for testing), but you need at least OpenGL ES 3.0 for proper working.

I don't have a bluetooth keyboard, so I can't test it, but what is a problem with adding second keyboard configuration in options? So that one keyboard uses arrows and the second i.e. WSAD? At least on single USB keyboard it works for me :)
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby Worldblender » 02 Feb 2017, 07:03

I did my testing on Android 4.4.4, Cyanogenmod -> LineageOS variant, real hardware on a OnePlus One. I used the Android NDK r13e to build my APK.
As for me, Due to the short amount of time I usually have, I can only get involved in compilation almost vanilla.
As an extra target, can MIPS devices be included as an extra target, too, if and only if STK in its regular form can run on MIPS CPUs?
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: SuperTuxKart for Android?

Postby deve » 02 Feb 2017, 13:49

I basically meant something like this:
https://github.com/supertuxkart/stk-cod ... 486919cf6f
But it's just enough to update a version in constants.cpp and rename data/supertuxkart.git to for example data/supertuxkart.git12345.
If it won't be unical, then people will need to manually remove data directory after STK upgrade to force new data extraction.

The MIPS compilation should be possible, because it's supported by angelscript library. But are there still some devices that are based on MIPS architecture? I wouldn't care that much about it until people will request support for this architecture.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: SuperTuxKart for Android?

Postby jymis » 05 Feb 2017, 00:48

deve asked me new icons for android UI. Here they are:

(click to enlarge picture)
Image

no item possessed
Image

nitro states
Image
User avatar
jymis
 
Posts: 137
Joined: 28 May 2012, 12:00

Who is online

Users browsing this forum: No registered users and 1 guest