Author Topic: AGS engine Android port  (Read 182810 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.