Author Topic: AGS engine Android port  (Read 189233 times)

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #820 on: 07 Jul 2018, 15:29 »
Hello, I updated Android engine recently with some gfx related changes. That should not have break anything in theory, but still could some people test it out to see if it works same as before?

https://www.dropbox.com/s/nkoe0to8ceqziib/AGS-3.4.1-p3prepare.apk?dl=0


It will be possible to switch the Actions between Back an Menu buttons? In this way on a tablet without menu button it will be easy to play. Now, when the menu button is pressed it shows a menu with contains an exit point as well. The back button works only like a shortcut for exit. It is not possible to get the virtual keyboard without a menu button.

Only to give some reply, I wish someone who knows how to program Android apps looked into this, but right now we do not have the right person around.

Re: AGS engine Android port
« Reply #821 on: 09 Jul 2018, 09:17 »
Hello, I updated Android engine recently with some gfx related changes. That should not have break anything in theory, but still could some people test it out to see if it works same as before?

https://www.dropbox.com/s/nkoe0to8ceqziib/AGS-3.4.1-p3prepare.apk?dl=0


It will be possible to switch the Actions between Back an Menu buttons? In this way on a tablet without menu button it will be easy to play. Now, when the menu button is pressed it shows a menu with contains an exit point as well. The back button works only like a shortcut for exit. It is not possible to get the virtual keyboard without a menu button.

Only to give some reply, I wish someone who knows how to program Android apps looked into this, but right now we do not have the right person around.

Hi Crimson Wizard,

thank you for reply.
Unfortunately I am not able to build the part myself, I think that you are using an older ndk/sdk with ant.
The change that I propose is minimal, only one line of code in a java file, :

Code: Adventure Game Studio
  1. in /Android/library/src/com/bigbluecup/android/AgsEngine.java
  2.  
  3.                 public void onBackKeyPressed(AgsEngine engine, boolean longPress)
  4.                 {
  5.                         if (longPress) engine.showExitConfirmation();
  6. -                       else engine.keyboardEvent(KeyCode.KeyBackHardKey);
  7. +                       //else engine.keyboardEvent(KeyCode.KeyBackHardKey);
  8. +                       else engine.showInGameMenu();
  9.                 }
  10.  

It will only switch the result of pressing the back button, from prompting to exit to showing the in game menu. (line taken from the previous method onMenuKeyPressed).

I am not very familiar with open source development processes and with pull requests on github, I hope that I am not against the forum rules to post it here.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #822 on: 09 Jul 2018, 09:31 »
It will only switch the result of pressing the back button, from prompting to exit to showing the in game menu. (line taken from the previous method onMenuKeyPressed).

I think I see what you mean, but this probably would require some setting, to keep KeyCode.KeyBackHardKey action for devices that have both menu and back keys?
Are you able to access Preferences when running AGS engine on Android (it's where you setup renderer, scaling, and so on)? If so, we could probably add an option like "Back key works as Menu key".

Unfortunately I am not able to build the part myself, I think that you are using an older ndk/sdk with ant.

Not an expert in this, but I thought we've recently switched to using new NDK. Eri0o was testing, perhaps he could confirm (or not).
Could you tell what github branch you are building, and which errors you get?
« Last Edit: 09 Jul 2018, 09:35 by Crimson Wizard »

Re: AGS engine Android port
« Reply #823 on: 09 Jul 2018, 10:18 »
I can access Preferences on the launcher, not in game
I tried to build master before branching the 3.4.1

Code: Adventure Game Studio
  1. [ launcher_list]$ ant
  2. Buildfile: <HOME>/ags/Android/launcher_list/build.xml
  3.  
  4. BUILD FAILED
  5. /ags/Android/launcher_list/build.xml:90: Cannot find <HOME>/android/sdk/tools/ant/build.xml imported from <HOME>/ags/Android/launcher_list/build.xml
  6.  
  7. Total time: 0 seconds
  8.  

I am using NDK r15c (not the newest but ant was removed before)

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #824 on: 09 Jul 2018, 10:27 »
I can access Preferences on the launcher, not in game
Yes, these ones. We'd need to try adding a new option there for the Back key to work like Menu.

I tried to build master before branching the 3.4.1
Yes, master is in wip state right now, better use stable release tag.

/ags/Android/launcher_list/build.xml:90: Cannot find <HOME>/android/sdk/tools/ant/build.xml imported from <HOME>/ags/Android/launcher_list/build.xml

I am using NDK r15c (not the newest but ant was removed before)

Oh right, looks like I forgot to mention this in the Readme. You need to download older SDK, then copy ant to the tools folder:
https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it

Re: AGS engine Android port
« Reply #825 on: 10 Jul 2018, 07:22 »
I can access Preferences on the launcher, not in game
Yes, these ones. We'd need to try adding a new option there for the Back key to work like Menu.

I tried to build master before branching the 3.4.1
Yes, master is in wip state right now, better use stable release tag.

/ags/Android/launcher_list/build.xml:90: Cannot find <HOME>/android/sdk/tools/ant/build.xml imported from <HOME>/ags/Android/launcher_list/build.xml

I am using NDK r15c (not the newest but ant was removed before)

Oh right, looks like I forgot to mention this in the Readme. You need to download older SDK, then copy ant to the tools folder:
https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it

ok, after copying ant folder to <SDK>/tools I get othe errors
Code: Adventure Game Studio
  1. [ launcher_list]$ ant debug
  2. Buildfile: <HOME>/ags/Android/launcher_list/build.xml
  3.   [taskdef] Could not load definitions from resource anttasks.properties. It could not be found.
  4.   [taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.
  5.  
  6. -set-mode-check:
  7.  
  8. -set-debug-files:
  9.  
  10. -check-env:
  11.  
  12. BUILD FAILED
  13. <HOME>/android/sdk/tools/ant/build.xml:396: Problem: failed to create task or type checkenv
  14. Cause: The name is undefined.
  15. Action: Check the spelling.
  16. Action: Check that any custom tasks/types have been declared.
  17. Action: Check that any <presetdef>/<macrodef> declarations have taken place.
  18.  
  19.  
  20. Total time: 0 seconds
  21.  
  22.  
I will try later to look into the problem

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #826 on: 10 Jul 2018, 10:22 »
@mim2011, have you set up ANDROID_HOME enviroment variable before running ant?

This is from the README:
Quote
e.g. (assuming the SDK is installed in /opt)

$ export ANDROID_HOME=/opt/android-sdk-linux
(If your SDK is installed in different place, of course set your own path.)
« Last Edit: 10 Jul 2018, 10:24 by Crimson Wizard »

Re: AGS engine Android port
« Reply #827 on: 12 Jul 2018, 16:10 »
@mim2011, have you set up ANDROID_HOME enviroment variable before running ant?

This is from the README:
Quote
e.g. (assuming the SDK is installed in /opt)

$ export ANDROID_HOME=/opt/android-sdk-linux
(If your SDK is installed in different place, of course set your own path.)
hi,

yes I have defined ANDROID_HOME, it works with other projects.
I don't think that the hack with copying the ant folder into a newer ndk works.
I am able to build the external libraries and the ags libraries, but for the last step, the launcher, no chance
I even tried to convert it to a gradle project for Android Studio but still nothing...


Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #828 on: 12 Jul 2018, 16:14 »
I don't think that the hack with copying the ant folder into a newer ndk works.

But this is what I and eri0o did. IIRC eri0o has installed modern Android Studio and built from there.
Could you tell what version of NDK are you using? I might try to retrace all the steps from pointer zero again.

Re: AGS engine Android port
« Reply #829 on: 12 Jul 2018, 23:42 »
I am lost in this thread. @mim2011, what exactly you did ? Which Android Studio? Which operating system? Which java file in which repository are you proposing the change?

What is showInGameMenu ? I am unfamiliar with this function.

I used very recent Android Studio and at the time I tested this on Ubuntu 16.04. I think CW did it on Windows 10 (guessing). On Android Studio just install any required tools. I just looked and I have SDK Platforms for Android 4.1, 6.0, 7.0 installed. SDK Tools 26.1.1, NDK 16.1.4479499 .

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #830 on: 13 Jul 2018, 00:04 »
Which java file in which repository are you proposing the change?

What is showInGameMenu ? I am unfamiliar with this function.

It's only few posts above.

The explanation of original problem:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=44768.msg636588597#msg636588597
The explanation of proposed changes:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=44768.msg636589972#msg636589972

But that problem is not related to problem of building launcher, which mim2011 currently has.

I think CW did it on Windows 10 (guessing).

I used Ubuntu.

Also, I'd wish we were discussing this on github issue tracker instead. This old thread should be locked, and new one created instead, with up-to-date information.
« Last Edit: 13 Jul 2018, 00:19 by Crimson Wizard »

Re: AGS engine Android port
« Reply #831 on: 13 Jul 2018, 02:38 »
created an issue on the github tracker

I wasn't making sense of anything since I didn't know either there was a menu or the possibility of showing the keyboard. On my phone pressing the home button just goes to my Android Home, and back exits, so both buttons do exit the game. I haven't played a game that requires the keyboard, so I didn't noticed it.

I still don't understand why @mim2011 wasn't able to build the port, but I can't created an environment to try to reproduce.

Edit: Also, there is one thing being mixed here! Building the libags*.so /libpe.so files and building the App. I never did this in one step. The NDK is for compiling the AGS libs and the Android Studio makes Android app that can use libs - like the AGS Android App. I see the Android port and the Android App as two different things, because the last is for playing games made for pc on Android and the first for making actual Android games from an AGS game.

What I mean is that this modification can reuse already built libs since it's only the app and this should be easier.
« Last Edit: 13 Jul 2018, 02:49 by eri0o »

Re: AGS engine Android port
« Reply #832 on: 13 Jul 2018, 08:16 »
created an issue on the github tracker

I wasn't making sense of anything since I didn't know either there was a menu or the possibility of showing the keyboard. On my phone pressing the home button just goes to my Android Home, and back exits, so both buttons do exit the game. I haven't played a game that requires the keyboard, so I didn't noticed it.

I still don't understand why @mim2011 wasn't able to build the port, but I can't created an environment to try to reproduce.

Edit: Also, there is one thing being mixed here! Building the libags*.so /libpe.so files and building the App. I never did this in one step. The NDK is for compiling the AGS libs and the Android Studio makes Android app that can use libs - like the AGS Android App. I see the Android port and the Android App as two different things, because the last is for playing games made for pc on Android and the first for making actual Android games from an AGS game.

What I mean is that this modification can reuse already built libs since it's only the app and this should be easier.

hi eri0o

as I already said, I am able to build the libraries (libags*.so /libpe.so) but not the App.
I tried to follow the Readme.me file:

Quote
## Java app

There are two parts to the Java app, one is the engine library in <SOURCE>/Android/library
and the other one is the launcher app. The default launcher which displays a list
of games from the SD-card is in <SOURCE>/Android/launcher_list.

The easiest way to build the app is to create an Android project in Eclipse. Choose the
"create from existing source" option and point Eclipse to the launcher directory.

To build from the command line, you can use the tool 'ant'.

e.g. (assuming the SDK is installed in /opt)

    $ export ANDROID_HOME=/opt/android-sdk-linux
    $ cd <SOURCE>/Android/launcher_list
    $ ant debug
    $ ant release # for release build

but it did not helped :-) I tried only the command line path, maybe I should try to install Eclipse...
I use NDK r15c and last version from Android Studio. My OS is Fedora 28, 64 bits.

Re: AGS engine Android port
« Reply #833 on: 07 Aug 2018, 20:09 »
Hey, are the Android libs here the latest ones? (Native engine libraries, for making your own signed APKs)

In android.cfg, after setting renderer = 1 under [graphics], do I need to do something else to use the hardware render? Does the Android version also requires the acsetup.cfg file?

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #834 on: 07 Aug 2018, 21:10 »
Hey, are the Android libs here the latest ones? (Native engine libraries, for making your own signed APKs)

They should be unless I messed something up (did only quick test).

In android.cfg, after setting renderer = 1 under [graphics], do I need to do something else to use the hardware render? Does the Android version also requires the acsetup.cfg file?

Android port uses "android.cfg" to override acsetup.cfg, I think only few extra options are read from acsetup.cfg.

Re: AGS engine Android port
« Reply #835 on: 07 Aug 2018, 21:52 »
Ah, ok. I seem to have the same error as Privateer Puddin' that I get black screen when using the hardware renderer, so I was wondering if the problem was in the config files.

here are both my working acsetup.cfg and android.cfg (using Software Renderer)
Add spoiler tag for Hidden:
acsetup.cfg
Code: Adventure Game Studio
  1. [sound]
  2. digiid=-1
  3. midiid=-1
  4. digiwin=-1
  5. midiwin=-1
  6. digiindx=0
  7. midiindx=0
  8. digiwinindx=0
  9. midiwinindx=0
  10. [misc]
  11. game_width=320
  12. game_height=180
  13. gamecolordepth=32
  14. titletext=FutureFlashback Setup
  15. antialias=0
  16. notruecolor=0
  17. cachemax=131072
  18. user_data_dir=
  19. shared_data_dir=
  20. [graphics]
  21. defaultdriver=D3D9
  22. driver=OGL
  23. windowed=0
  24. screen_def=max
  25. game_scale_fs=proportional
  26. game_scale_win=max_round
  27. filter=stdscale
  28. vsync=1
  29. render_at_screenres=0
  30. [language]
  31. translation=
  32. [mouse]
  33. auto_lock=0
  34. speed=1
  35.  

android.cfg
Code: Adventure Game Studio
  1. [misc]
  2. config_enabled = 1
  3. rotation = 2
  4. translation = default
  5. [controls]
  6. mouse_method = 0
  7. mouse_longclick = 0
  8. [compatibility]
  9. clear_cache_on_room_change = 0
  10. [sound]
  11. samplerate = 44100
  12. enabled = 1
  13. threaded = 1
  14. cache_size = 10
  15. [midi]
  16. enabled = 0
  17. preload_patches = 0
  18. [video]
  19. framedrop = 0
  20. [graphics]
  21. renderer = 0
  22. smoothing = 0
  23. scaling = 1
  24. super_sampling = 0
  25. smooth_sprites = 0
  26. [debug]
  27. show_fps = 0
  28. logging = 0
  29.  


« Last Edit: 07 Aug 2018, 21:55 by eri0o »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #836 on: 07 Aug 2018, 21:57 »
Ah, ok. I seem to have the same error as Privateer Puddin' that I get black screen when using the hardware renderer, so I was wondering if the problem was in the config files.

Something has to be done with this, hardware renderer seemed to work correctly with 3.4.0 APK. Both "software" and "hardware" ones use OpenGL in the end. In the first case it is initialized by Allegro's android code and only final game image is converted onto texture, in the second case OpenGL is created by the code inside AGS and every object sprite is converted to separate texture. The issue's reason should be in some of these differences.

Unfortunately I have only Android emulator, and it works well with all renderers and settings.

Re: AGS engine Android port
« Reply #837 on: 07 Aug 2018, 22:18 »
I don't know if this helps, but I caught this right before the black screen:

08-07 18:03:29.732 24951-25105/com.mythsuntold.futureflashback I/Adreno: ERROR: Invalid #version
08-07 18:03:29.733 24951-25105/com.mythsuntold.futureflashback I/Adreno: ERROR: Invalid #version

Add spoiler tag for Hidden:
(i this related to this comment on Engine/gfx/ali3dogl.cpp ?)
Code: Adventure Game Studio
  1. ...
  2. void OGLGraphicsDriver::FirstTimeInit()
  3. {
  4.   // It was told that GL_VERSION is supposed to begin with digits and may have
  5.   // custom string after, but mobile version of OpenGL seem to have different
  6.   // version string format.
  7.   String ogl_v_str = (const char*)glGetString(GL_VERSION);
  8.   String digits = "1234567890";
  9. ...
  10.  

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #838 on: 07 Aug 2018, 22:24 »
I think that's rather shader compilation failing, because apparently tinting/lighting shaders are written in non-compatible syntax.

May you try to disable shader compilation and see if renderer works then? I thought it will simply skip shader if it failed to compile, but maybe there are more serious consequences.

Regarding shaders, I am not sure what is best way to deal with them: either have them precompiled or have separate scripts for mobile.

Re: AGS engine Android port
« Reply #839 on: 07 Aug 2018, 23:00 »
Ok, I assume I have to comment/remove things and rebuild the libs for this test correct? I pointed the release 3.4.1 branch and you pointed the master branch. Which has the correct Android port to run a game built with the latest release of the editor? (AGS 3.4.1.14)

Also, a guess... Should the string version be #version 130 es\n\ instead of #version 130\n\  for EGL on Android?