AGS engine Android port

Started by Crimson Wizard, Wed 02/02/2022 19:27:17

Previous topic - Next topic

Crimson Wizard

The old forum thread may still be found here. Please beware that it was started many years ago and may contain alot of outdated information.

This new thread is dedicated to discussing the Android port of AGS engine. Following is a brief cover of the topic.




AGS engine has an Android port that can run on most contemporary devices. [TODO] check device ranges and minimal requirements.
To run AGS games on Android you need a dedicated Android app (APK) and a game data.
We support two kinds of applications: a universal game launcher (aka "AGS Player") that can run just any random AGS game without any extra manipulations, and a single game app that you have to package along with the game data yourself into a signed APK. The latter may be then distributed by game shops, such as Google Play.

Currently the v3.x.x engine branch supports running games created with AGS 2.50 and higher.




AGS Player

"AGS Player" is a universal game launcher on Android, that displays a list of found AGS games and lets you run them.

This launcher requires games to be unpacked, placed in the internal storage or sd card, one game in its own subdirectory. You may use raw game data (*.ags files), or even games compiled for other platforms such as Windows ( Windows version of a game is usually just an engine exe with game data appended to it).

We distribute AGS Player with every release of AGS. The download link may be found in respective forum posts for each release.
Another place to find them is releases page in our repository: https://github.com/adventuregamestudio/ags/releases
In the Assets look for AGS-3.x.x.x-debug.apk and AGS-3.x.x.x-release.apk (these are same program, built with debug or release configuration).
If you'd like to build it yourself, you may do so following these instructions: https://github.com/adventuregamestudio/ags/blob/master/Android/README.md

After installing one on your Android device, run it and open the [...] menu, choose "Select game folder". Then type the path or browse to the parent folder you keep all your AGS games in (NOTE: browse button is added since v3.6.0).
You will see the list of all games that the AGS Player detected in that directory. Note that since v3.6.0 the search is recursive, displaying games also found in subfolders.
Touch the game name to run one.

KNOWN ISSUES

1. Please be aware that most AGS games are made not having touch screen in mind. We therefore cannot guarantee (or be responsible for) positive gaming experience. The port provides basic touch controls, and these may be configured to some degree, but they may not be convenient at all times. We accept suggestions for improving these controls, so long as these are universally useful (not meant for a specific game). Ideally the game should be adjusted for mobile/touch controls by their authors.

2. If the game requires engine plugins to run, these have to be included into the launcher APK. We include several plugins by default, mostly ones that were popular among AGS game authors in the past. We may probably expand the list of these plugins if there will be a demand for it.




Building games for Android in the Editor

Editor also comes with an optional feature that lets you deploy for Android using a ported engine.
To use this feature make sure you have installed the "Android build component" along with the editor. This creates a "Android" subfolder inside the Editor's program folder. After that a "Android" option will become available for selection in "Build targets" list in the General Settings of your game project.
You would also require Android Studio.

Before running the build you will have to configure paths to Android SDK and other options. This is done in File->Preferences dialog, on "Android" tab. These options will be used for all your games.
The "Android" section in General Settings is used to configure individual game's properties related to Android build, such as game name, and package format.

The compiled game will be placed into Compiled/Android folder.

For detailed information please see this dedicated forum post:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=59772.0




Building single game APK without Editor

If you'd like to have your individual game APK which you may distribute, or even sell on e.g. Google Play, you have to build one by combining following components:
- The Java/Kotlin application. We provide an project template for this: https://github.com/adventuregamestudio/ags/tree/master/Android/mygame
- The native engine module (and optionally plugins) in the form of dynamic libraries (*.so). You may either build these yourself following instructions in the README, or get prebuilt ones attached to corresponding AGS release. The archive is called AGS-3.x.x.x-android-libs.
- Your raw game's data found in Compiled/Data folder after compilation.

For building the full APK you will be also requiring Android Studio and some other tools.
The process is explained in this dedicated readme: https://github.com/adventuregamestudio/ags/tree/master/Android/mygame#readme

If you encountered bugs or have feature suggestions, you may open an issue in our tracker.




Any other useful information may be added to this post later.


eri0o

I still need to document this properly (as in put it in the AGS Manual), but in the meantime, information on how to use the Android build available in the Editor is available in this thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59772.0

Note: the feature is fairly recent so any questions is better to ask. There's a FAQ in the linked thread, so I recommend checking it, as questions appears I will try to summup things and add there until a manual page is written.

Amir

I have a question. As far as I remember I tried android launcher back then and it worked fine, but in my new game there are a lot of "strings" fields where you have to type something. Will this also work with the android launcher? Will the keyboard appear on mobile phones, so that you type something?
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

Crimson Wizard

Quote from: Amir on Sun 03/07/2022 09:33:04
I have a question. As far as I remember I tried android launcher back then and it worked fine, but in my new game there are a lot of "strings" fields where you have to type something. Will this also work with the android launcher? Will the keyboard appear on mobile phones, so that you type something?

There's a built in keyboard, which you may bring by holding "back" key and choosing "keyboard" from the menu. But that is meant mostly for games which were not specifically designed for touch screen. If that does not suit your game you could script your own on-screen keyboard.

Amir

#4
Quote from: Crimson Wizard on Sun 03/07/2022 12:07:03
Quote from: Amir on Sun 03/07/2022 09:33:04
I have a question. As far as I remember I tried android launcher back then and it worked fine, but in my new game there are a lot of "strings" fields where you have to type something. Will this also work with the android launcher? Will the keyboard appear on mobile phones, so that you type something?

There's a built in keyboard, which you may bring by holding "back" key and choosing "keyboard" from the menu. But that is meant mostly for games which were not specifically designed for touch screen. If that does not suit your game you could script your own on-screen keyboard.

Ah cool, this works on my old iPad. But you can't delete what you wrote. Delete doesn't work  :-\  Is it possible to make the keyboard appear on the touchscreen? You know, the newer ones don't have a "back" key anymore.

QuoteIf that does not suit your game you could script your own on-screen keyboard.

Has anyone ever made a module for a keyboard?

Edit: I just tried with Galaxy tab s6. I was able to delete and use the touch button "Back" to bring up the keyboard. With my old Galaxy tab a6 (Android version 5 I guess) I was not able to delete what I wrote, I think it's the old version. It doesn't matter. Now my friends who don't have PC can play my game. Thank u.

Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

tservo

Hello I am hoping this is the correct forum for AGS 3.60 Android port problems. I am using android 11 and ags 3.51 patch 13 and it works really well. I also Installed ags 3.60 beta 13 but there seems to be no mouse-touch support. no matter what i do there is no mouse cursor or any response to touch in any game (tried lots of them). like i said it works great with 3.51. any help would be welcomed. thank you.

Athanor

#6
Hi

I'm running the latest version of the APK (3.6.0.39) on my Samsung Tab A (2019). Every game runs without problems, but there seems to be an issue with the touch-to-mouse emulation. The only option that allows the imitation of a right click (by taping with both fingers on the screen) is the "Two Fingers (tap to click)" option. The "One Finger" option doesn't seem to allow for a right click. Now whenever I restart the AGS app I have to configure it again even though "Two Fingers" is selected in the preferences: In order for it to work again I have to first select one of the other options (either "One Finger" or "off") and then immediately re-select "Two Finger". Then I can start the game and use right click. If I don't reconfigure it this way everytime I start the AGS app, I'm unable to use right click.

Thank you for your help.

Crimson Wizard

Quote from: Athanor on Tue 27/12/2022 15:12:11I'm running the latest version of the APK (3.6.0.39) on my Samsung Tab A (2019). Every game runs without problems, but there seems to be an issue with the touch-to-mouse emulation. The only option that allows the imitation of a right click (by taping with both fingers on the screen) is the "Two Fingers (tap to click)" option. The "One Finger" option doesn't seem to allow for a right click. Now whenever I restart the AGS app I have to configure it again even though "Two Fingers" is selected in the preferences: In order for it to work again I have to first select one of the other options (either "One Finger" or "off") and then immediately re-select "Two Finger". Then I can start the game and use right click. If I don't reconfigure it this way everytime I start the AGS app, I'm unable to use right click.

Hmm, so, this sounds like preferences (or certain option) are not applied after you start again?

Athanor

Quote from: Crimson Wizard on Tue 27/12/2022 16:05:41
Quote from: Athanor on Tue 27/12/2022 15:12:11I'm running the latest version of the APK (3.6.0.39) on my Samsung Tab A (2019). Every game runs without problems, but there seems to be an issue with the touch-to-mouse emulation. The only option that allows the imitation of a right click (by taping with both fingers on the screen) is the "Two Fingers (tap to click)" option. The "One Finger" option doesn't seem to allow for a right click. Now whenever I restart the AGS app I have to configure it again even though "Two Fingers" is selected in the preferences: In order for it to work again I have to first select one of the other options (either "One Finger" or "off") and then immediately re-select "Two Finger". Then I can start the game and use right click. If I don't reconfigure it this way everytime I start the AGS app, I'm unable to use right click.

Hmm, so, this sounds like preferences (or certain option) are not applied after you start again?

It seems like that, yes. But something is rather strange: "Two Fingers" is still selected if I enter Preferences. After some more trying I now noticed that it's enough to just enter the "touch-to-mouse" part of preferences and leave it again. I don't even have to change anything on the configuration (contrary to what I wrote above). Just entering "touch-to-mouse" seems to be enough to (re-)activate it. So what I basically have to do is to enter "touch-to-mouse" everytime I start the AGS app.
It's no big deal, but I thought I still post it here.

Crimson Wizard

I opened a bug ticket in regards to this problem.

eri0o

@Athanor , do you kill the app between sessions? Meaning, using the button/gesture that shows things loaded in Android, and swiping to kill the app.

Like, if you kill the app, does it fix for you?

Also, are there other configurations that "resurrect"/"reset", or only the touch method resets for you?

Athanor

Quote from: eri0o on Tue 27/12/2022 18:51:51@Athanor , do you kill the app between sessions? Meaning, using the button/gesture that shows things loaded in Android, and swiping to kill the app.

Like, if you kill the app, does it fix for you?

Also, are there other configurations that "resurrect"/"reset", or only the touch method resets for you?
I did both - quitting the app via the device's back button and tapping "exit game" and killing the app by swiping. There is no difference.

I'm not even sure if it really resets the configuration. The mouse setting doesn't seem to be resetted when I quit the app because it's still enabled when I start the app again and enter the touch-to-mouse settings. So it seems to be enabled but will not do its job until I enter the settings for touch-to-mouse and leave them again before starting a game. Strange.

eri0o

Sorry to ask again, but, is there any other setting that resets or ignores the config in some way? Or this happens only with the setting for the touch method?

This will help me figure out what is happening - I am not sure if I am doing something wrong, but I haven't been able to reproduce this yet.

Crimson Wizard

#13
I remember now that I had the same problem a while ago, but probably forgot about it.

EDIT: right, this also happens with "Lock screen orientation" setting. It keeps resetting to default "Portrait".

eri0o

@Athanor , hi, I need to ask again, because I have a complete different behavior.

The global settings, the one on top of preferences, none of them are working for me, they don't save, presumably because they aren't found in the first place. But the individual game settings all work correctly.

Can you confirm that you have this behavior or do you have the behavior reported above?

Vincent

#15
Hello I am trying to convert a game from Ags to Android, I'm sorry in advance if this question has been asked already. It seems that when I change setting 'Touch To Mouse Emulation' to be 'Two Fingers' nothing change, basically I'd like to perform a 'right click' but there is no way I am able to do that, I've been trying a lot but still nothing. Is this just me or can you perform a right click?

Quote from: Crimson Wizard on Tue 27/12/2022 19:44:48EDIT: right, this also happens with "Lock screen orientation" setting. It keeps resetting to default "Portrait".

Also this option 'Rotation Mode' is set to 'Unlocked' which should do both (Portrait and Landscape) but the game is always set to be in a Portrait Mode if you select the 'Unlocked' option (I also made sure the phone option regarding rotation was unlocked) but if you select 'Landscape' then the game run properly in Landscape Mode.

Crimson Wizard

Quote from: Vincent on Wed 18/01/2023 10:05:58Hello I am trying to convert a game from Ags to Android, I'm sorry in advance if this question has been asked already. It seems that when I change setting 'Touch To Mouse Emulation' to be 'Two Fingers' nothing change, basically I'd like to perform a 'right click' but there is no way I am able to do that, I've been trying a lot but still nothing. Is this just me or can you perform a right click?

Please clarify, do you build your game as a proper APK, or running a AGS Player (universal launcher)? Where exactly do you set these options?

Vincent

Quote from: Crimson Wizard on Wed 18/01/2023 10:29:21Please clarify, do you build your game as a proper APK, or running a AGS Player (universal launcher)? Where exactly do you set these options?

I set these options via Default setup inside Ags editor and then I build the game for Windows and Android. Then I run the game on my phone as a proper APK and it seems like I can only perform a left click, even after compiling the game with the option 'Touch to Mouse Emulation' set to Two fingers.

:Edit: I am using AGS-3.6.0.40-RC5

Iceberg

Hi gang,

Is there any way to bring up the virtual keyboard when playing AGS games?  The keyboard is needed on occasion to type the names of saved games, use arrow keys for fighting, etc. (Quest for Glory 2, Heroine's Quest, Quest for Infamy, and so on.)

There used to be a very good virtual keyboard called Hacker's Keyboard that allows you to pin a permanent keyboard icon in your notifications bar.  When you need the keyboard, you just tap the notification and it appears.  Unfortunately, this no longer works when playing AGS games on the newest Android phones, and Hacker's Keyboard appears to have been abandoned by the developer, and is no longer being updated.

Any suggestions?  Thanks!

Crimson Wizard

Quote from: Iceberg on Sun 07/05/2023 17:09:00Is there any way to bring up the virtual keyboard when playing AGS games?

It should be brought up by holding "BACK" and choosing "Show Keyboard" in the menu.

Iceberg

Quote from: Crimson Wizard on Sun 07/05/2023 18:32:13
Quote from: Iceberg on Sun 07/05/2023 17:09:00Is there any way to bring up the virtual keyboard when playing AGS games?

It should be brought up by holding "BACK" and choosing "Show Keyboard" in the menu.

Holding the back button and selecting "Toggle keyboard" does make the keyboard appear...for a split second, and then it vanishes just as quickly.  I've tried with both Hacker's Keyboard and the default Samsung keyboard.

I heard it may have something to do with restrictions on newer Android devices, but I don't know if there's anything to that.

Crimson Wizard

Quote from: Iceberg on Mon 08/05/2023 02:25:39Holding the back button and selecting "Toggle keyboard" does make the keyboard appear...for a split second, and then it vanishes just as quickly.  I've tried with both Hacker's Keyboard and the default Samsung keyboard.

I heard it may have something to do with restrictions on newer Android devices, but I don't know if there's anything to that.

I did not know that's a case. Could you tell what are your device specifics? I will open an issue in our issue tracker.

Iceberg

Quote from: Crimson Wizard on Mon 08/05/2023 10:13:14
Quote from: Iceberg on Mon 08/05/2023 02:25:39Holding the back button and selecting "Toggle keyboard" does make the keyboard appear...for a split second, and then it vanishes just as quickly.  I've tried with both Hacker's Keyboard and the default Samsung keyboard.

I heard it may have something to do with restrictions on newer Android devices, but I don't know if there's anything to that.

I did not know that's a case. Could you tell what are your device specifics? I will open an issue in our issue tracker.

Yes, absolutely.  It's a Galaxy S22, Android version 13, but you likely need more than that.  What additional info would help?

Also, in case it's in any way relevant, here's what was posted in the Hacker's Keyboard issue log.  Could the keyboard appearing and disappearing immediately have something to do with Android "restricting background processes"?

"@parkerlreed (soz for ping) said that he couldn't open Hacker's Keyboard from the persistent notification on his Samsung phone with Android 12. Android 12 continues the trend of restricting background processes and 12 must've been the one to break Hacker's Keyboard. :("

https://github.com/klausw/hackerskeyboard/issues/883

eri0o

So, since Google deleted my Android developer account along with all my Apps for an error they made I haven't had fuel to look much into Android lately. This was something that made me sad and I felt very powerless about having all just deleted without recourse and have their support answer that once they understood their error there wasn't anything they could do and I would have to create a new account with a new email - I can't use my own email since it can't be tied to a dev account anymore...


Anyway, I got a message today from elsewhere that gave me a link to some interesting (old) news for Android development

https://commonsware.com/blog/2021/11/06/about-environment-undeprecations.html

It seems this slipped under my radar at the time but I thought we would have to at some point remake the AGS Player app because of the changes of the file system they were making, but afair it kept working. It seems they changed course and undeprecated some storage things there.

SMF spam blocked by CleanTalk