[OLD-1] AGS engine Android port

Started by JJS, Thu 03/11/2011 20:18:29

Previous topic - Next topic

Crimson Wizard

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


Quote from: mim2011 on Thu 21/06/2018 09:44:42
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.

mim2011

Quote from: Crimson Wizard on Sat 07/07/2018 15:29:19
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


Quote from: mim2011 on Thu 21/06/2018 09:44:42
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: ags

in /Android/library/src/com/bigbluecup/android/AgsEngine.java

                public void onBackKeyPressed(AgsEngine engine, boolean longPress)
                {
                        if (longPress) engine.showExitConfirmation();
-                       else engine.keyboardEvent(KeyCode.KeyBackHardKey);
+                       //else engine.keyboardEvent(KeyCode.KeyBackHardKey);
+                       else engine.showInGameMenu();
                }


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

#822
Quote from: mim2011 on Mon 09/07/2018 09:17:41
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".

Quote from: mim2011 on Mon 09/07/2018 09:17:41
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?

mim2011

I can access Preferences on the launcher, not in game
I tried to build master before branching the 3.4.1

Code: ags

[ launcher_list]$ ant
Buildfile: <HOME>/ags/Android/launcher_list/build.xml

BUILD FAILED
/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

Total time: 0 seconds


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

Crimson Wizard

Quote from: mim2011 on Mon 09/07/2018 10:18:53
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.

Quote from: mim2011 on Mon 09/07/2018 10:18:53
I tried to build master before branching the 3.4.1
Yes, master is in wip state right now, better use stable release tag.

Quote from: mim2011 on Mon 09/07/2018 10:18:53/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

mim2011

Quote from: Crimson Wizard on Mon 09/07/2018 10:27:31
Quote from: mim2011 on Mon 09/07/2018 10:18:53
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.

Quote from: mim2011 on Mon 09/07/2018 10:18:53
I tried to build master before branching the 3.4.1
Yes, master is in wip state right now, better use stable release tag.

Quote from: mim2011 on Mon 09/07/2018 10:18:53/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: ags

[ launcher_list]$ ant debug
Buildfile: <HOME>/ags/Android/launcher_list/build.xml
  [taskdef] Could not load definitions from resource anttasks.properties. It could not be found.
  [taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.

-set-mode-check:

-set-debug-files:

-check-env:

BUILD FAILED
<HOME>/android/sdk/tools/ant/build.xml:396: Problem: failed to create task or type checkenv
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


Total time: 0 seconds


I will try later to look into the problem

Crimson Wizard

#826
@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.)

mim2011

Quote from: Crimson Wizard on Tue 10/07/2018 10:22:23
@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

Quote from: mim2011 on Thu 12/07/2018 16:10:19
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.

eri0o

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

#830
Quote from: eri0o on Thu 12/07/2018 23:42:20Which 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.

Quote from: eri0o on Thu 12/07/2018 23:42:20I 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.

eri0o

#831
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.

mim2011

Quote from: eri0o on Fri 13/07/2018 02:38:56
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.

eri0o

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

Quote from: eri0o on Tue 07/08/2018 20:09:31
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).

Quote from: eri0o on Tue 07/08/2018 20:09:31
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.

eri0o

#835
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)
Spoiler

acsetup.cfg
Code: ags

[sound]
digiid=-1
midiid=-1
digiwin=-1
midiwin=-1
digiindx=0
midiindx=0
digiwinindx=0
midiwinindx=0
[misc]
game_width=320
game_height=180
gamecolordepth=32
titletext=FutureFlashback Setup
antialias=0
notruecolor=0
cachemax=131072
user_data_dir=
shared_data_dir=
[graphics]
defaultdriver=D3D9
driver=OGL
windowed=0
screen_def=max
game_scale_fs=proportional
game_scale_win=max_round
filter=stdscale
vsync=1
render_at_screenres=0
[language]
translation=
[mouse]
auto_lock=0
speed=1


android.cfg
Code: ags

[misc]
config_enabled = 1
rotation = 2
translation = default
[controls]
mouse_method = 0
mouse_longclick = 0
[compatibility]
clear_cache_on_room_change = 0
[sound]
samplerate = 44100
enabled = 1
threaded = 1
cache_size = 10
[midi]
enabled = 0
preload_patches = 0
[video]
framedrop = 0
[graphics]
renderer = 0
smoothing = 0
scaling = 1
super_sampling = 0
smooth_sprites = 0
[debug]
show_fps = 0
logging = 0



[close]

Crimson Wizard

Quote from: eri0o on Tue 07/08/2018 21:52:51
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.

eri0o

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

Spoiler

(i this related to this comment on Engine/gfx/ali3dogl.cpp ?)
Code: ags

...
void OGLGraphicsDriver::FirstTimeInit()
{
  // It was told that GL_VERSION is supposed to begin with digits and may have
  // custom string after, but mobile version of OpenGL seem to have different
  // version string format.
  String ogl_v_str = (const char*)glGetString(GL_VERSION);
  String digits = "1234567890";
...
[close]

Crimson Wizard

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.

eri0o

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?

SMF spam blocked by CleanTalk