[OLD-1] AGS engine Android port

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

Previous topic - Next topic

eri0o

Ok, I have the same error using acwin.exe from 3.4.12 in a folder with the GameName.ags I got from the Compiled/Data folder... I will try to obb the .exe file and see if it works...

Crimson Wizard

Quote from: eri0o on Wed 28/02/2018 02:24:09
Ok, I have the same error using acwin.exe from 3.4.12 in a folder with the GameName.ags I got from the Compiled/Data folder...

Now, this is most interesting. This means there is a general engine and/or Editor issue.
Is this *ags produced by same version of an Editor (if not, which one)?
I will try to debug this out on desktop system bit later today.

eri0o

#762
Hey CW! It's the version AGS Editor .NET (Build 3.4.1.12) - v3.4.1, January 2018. Now this is really weird. The DungeonHands.exe (my game name) didn't work too with android. The .ags game file from Compiled/Data wasn't actually from Compiled/Data... I got it from there, placed it in a obb file using :

Code: bash
cd Compiled
mkdir obb
cp Data/DungeonHands.ags obb/
~/Android/Sdk/tools/bin/jobb -d ./obb/ -o main.3.com.mythsuntold.dungeonhands.obb -pn com.mythsuntold.dungeonhands -pv 3


And later I dumped the content of the obb.

Code: bash
~/Android/Sdk/tools/bin/jobb -dump main.3.com.mythsuntold.dungeonhands.obb -d out/


Aaaand.. Get this... The md5sum of the file isn't the same.

Text files remain unaltered by the jobb tool. But binary, be .ags or .exe, are modified by it. I don't know yet what's modified though. I will later test with 3.4.0 if acwin can read unobbed ags files.

Edit: No it can't too... It gives a different error though. By running the dumped exe from the obb with acwin.exe it gives the error:
This game requires a different version of AGS (16.0.0.0). It cannot be run.

If it worked I would guess something... Since it doesn't, my next idea is to try the jobb tool from Monkey.... But this is weird because it does work with the prebuilt Ags Androd 3.4.0 ... I guess my next shot is trying to build 3.4.0 to see if my binary is the same as the prebuilt ones - it probably won't be...

Edit2: looking online I can find posts until 2017 of people complaining Google Jobb tool generates corrupted obb files for random combination of files...

Edit3: Ok, I will try to first load a game without using obb, and later test some alternatives jobb tools. I will only do this tomorrow... For some reason I am currently unable to generate non corrupted obb files with google jobb tool :/

Crimson Wizard

Quote from: eri0o on Wed 28/02/2018 02:49:50
Edit3: Ok, I will try to first load a game without using obb, and later test some alternatives jobb tools. I will only do this tomorrow... For some reason I am currently unable to generate non corrupted obb files with google jobb tool :/

This is a very good idea, and should have been the first to try. There are too many variables here. If it is possible we need to cut some out, like don't use obb tool for starters and test engine APK against a "raw" Game.ags.

Joseph DiPerla

Would Monkey's updated Jobbifier work for your needs? https://github.com/monkey0506/jobbifier
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Nemethon


Hi,
I have a project to make a game on android galaxy S8 phone. I do not understand how to run the game on Android. I thank you for the answers.

Need to download something? What is the process?

Crimson Wizard

#766
Quote from: Nemethon on Fri 09/03/2018 00:36:48
I have a project to make a game on android galaxy S8 phone. I do not understand how to run the game on Android. I thank you for the answers.

Need to download something? What is the process?

What version of AGS do you use? Currently latest version that supports running games on Android is AGS 3.4.0. We are in process of making AGS 3.4.1 support running games on Android too, but it's not done yet.

Crimson Wizard

#767
So, is there any progress here?

I still could not understand whether it is possible work with Android studio's emulator without create a studio project.
So, I tried to install my own APK on BlueStacks emulator. The error I got is : INSTALL_PARSE_FAILED_NO_CERTIFICATES.
So, apparently, the problem is that APK is not signed properly?
Right now I am searching for possible reasons and solutions.

@eri0o, you said that you managed to somehow build and install APK on your own (with Android Studio?). Is there a raw APK (without game data) in the output at some point? If so, could you maybe upload it here for other people to try?

Crimson Wizard

#768
Okay, I made a little change to the APK and managed to install it on the BlueStacks emulator without errors. Did not test it with game yet, when running it sais that I do not have any games on sdcard, although I have few, but that also may be that I did something wrong or forgot to config something, so I will continue experimenting.


The download link: https://www.dropbox.com/s/9in2vn3cci11294/AGS-3.4.1-unsigned.apk?dl=0

Could someone try if that at least installs on their device?

What did I change:
I noticed that in AndroidManifest it still sais "minSdkVersion=9", although we changed platform to "14" when building native code. So I changed minSdkVersion to 14 in the manifests too.
Additionally, I increased "versionCode" for the "library" project (which is an internal index of a program version") by 1. Not sure if that means anything in current situation.


UPDATE:
* fixed situation with games not found, now I can actually launch a game. I can know that engine begins working, because it reports classic error about DIGMID patches not found and audio not initialized.
* however, then it sais that it cannot find main game file, same error as eri0o reported before. :/

UPDATE2:
Well, this is becoming ridiculous.
1. AGS 3.4.0 APK can run games on android emulator.
2. AGS 3.4.1 APK cannot run the same games in the exactly same enviroment, saying that it cannot find the main game file.
The error it gives means that it cannot find an internal resource inside the game package for some reason. What could be the causes? Either there is a logical error or package gets corrupted somehow... But the latter is probably not the case, since 3.4.0 APK runs same games without such issue.
3. At the same time, Windows version of 3.4.1 can run these games, using exactly same data I provided for Android (game file renamed into ac2game.dat etc).
So... the problem now is in finding what causes different behavior between Windows version and Android version. That could be also difference in command line arguments. If I managed to understand java part of the android port correctly, it passes the path to ac2game.dat to the engine, not the folder.

Additional notes:
1. Android launcher has that annoying issue that it only detects ac2game.dat files AND they must be Windows EXE files renamed into ac2game.dat. You cannot use raw game data files and rename them to ac2game.dat. This is because launcher literally checks for Windows executable header in the file, or something like that. IIRC I've already opened a ticket about this on github years ago.
2. Problem with logging. In the current version the log file only begins writing when the game format is confirmed. Until then engine only prints to stdout. I know Android has "logcat" logs, but IDK if it's possible to reroute stdout into logcat. That could help.

Crimson Wizard

Ok, I found the error in the engine. There is a logical error which makes engine skip the important step of initializing game package before using it.
It was introduced somewhere during the development of AGS 3.4.1.

To be brief, prior to 3.4.1 this step was explicit, now it is done as a part of finding configuration files. But there is a flag called 'psp_ignore_acsetup_cfg_file' which forces engine to ignore default config files, and it is always 'true' on mobile ports, thus this step is skipped.

Crimson Wizard

#770
Alright, here is an updated APK: https://www.dropbox.com/s/edvkqlkny9aut4w/AGS-3.4.1-unsigned.apk?dl=0

Now it actually runs the game.

There is some other problem: it does not display anything. I suspect there may be some problem with applying new display config.
Also, when I run my racing game, it just crashes.

Now fixed.

One positive thing is that it writes log (in /sdcard/ags/ directory) if you have "log=1" in "[misc]" config category. So you can at least see how far it goes.

Will update this post if I make more fixes.

UPDATE: OpenGL shaders fail to compile on Android GLES system. Well.. one good thing engine at least manages to log compilation output, so it's "kindof" working.
This is something I was worried about, because I've recently read that GLES shaders have "stricter" syntax. Idk what would be best way to proceed: have separate sets of shaders for each port, or try to find syntax that works everywhere (if that's possible), or maybe even supply compiled shader file (Idk if that would be compatible with every system, and how to even distribute it with engine).
At least this issue is easy to observe, and in theory only consequence will be that tinting won't work on Android (but it did not work before either).

UPDATE2:
Well, damn, this was so far the stupidest bug: https://github.com/adventuregamestudio/ags/commit/41189699126447351f95d4fe3fbc0ff136e03947
Now game is running and display is working (download link is same, see beginning of the post).

New problem: the game is drawn in the small rectangular bottom-left corner of the screen. At least there is some idea where to look.

UPDATE3:
The reason is that apparently when on Android, the engine does not receive proper display resolution until certain moment. So it initializes with 320x200, but then Java side sends correct size, to which it should react. Unfortunately this is not implemented as a proper callback, but in a silly way: OpenGL renderer simply tests for some global variable in "render" function and reacts. When I was updating OpenGL, this probably got broken.

Also, I noticed that colors are broken for some reason too. Don't know if it's related or separate bug. The games I tried include 32-bit ones, but they also have that issue.

Chicky

Hey CW, sounds like you're making good progress. Just thought I'd mention that the link doesn't work atm.

Crimson Wizard

Quote from: Chicky on Thu 15/03/2018 14:54:36
Hey CW, sounds like you're making good progress. Just thought I'd mention that the link doesn't work atm.

New link: https://www.dropbox.com/s/edvkqlkny9aut4w/AGS-3.4.1-unsigned.apk?dl=0

To remind, there are still two issues: the game is displayed in a small rectangle in the screen corner (depends on device resolution, I guess), and colors are screwed for some reason.

Crimson Wizard

I made another build, but it is not final work, just for the test: https://www.dropbox.com/s/f62oqlis9a7zgho/AGS-3.4.1-debug.apk?dl=0

I tried to double check my fix to the certificate error I was having when installing the APK. So I built APK without fixes, and it still installed without errors. This means that the problem was more complicated or related to something different.

I found that even 3.4.0 APK causes installation error if you install it on device with 3.4.1 APK installed. If you uninstall AGS, then install new APK, it works. So maybe it was it. Maybe this error was happening because of installing an APK with the same name which had certain changes in it, unacceptable for "upgrade".

But since no one said whether new APK installs for them, I do not know this for sure.

So, in case latest APK I linked above does not install, you may try this slightly older one and see what happens: https://www.dropbox.com/s/edvkqlkny9aut4w/AGS-3.4.1-unsigned.apk?dl=0



Known issues.

The biggest visible issue right now is that the colors are broken. I have absolutely no idea what could cause this. So, will have to keep comparing with the 3.4.0 code.

Besides that, the App Preferences are partially not applied. Can't tell when it got broken, maybe in 3.4.1, or maybe earlier.
Notably does not work:
- Select renderer (always set to "Software", but software renderer does not work, so it switches to OpenGL in game)
- Scaling (always set to "stretch to whole screen").
and maybe something else.


Privateer Puddin'

Installing the new (14th March) APK (having never installed a previous one) worked fine on my Android phone (Essential phone) as far as I can tell (didn't run actual game - don't have external storage)

Crimson Wizard

Quote from: Privateer Puddin' on Tue 20/03/2018 00:27:32
Installing the new (14th March) APK (having never installed a previous one)

14th March? No, that's the old one, the new one is from 20th March.

morganw

Quote from: Crimson Wizard on Mon 19/03/2018 23:53:22
I made another build, but it is not final work, just for the test: https://www.dropbox.com/s/f62oqlis9a7zgho/AGS-3.4.1-debug.apk?dl=0

I've tried this one and didn't have any colour issues, only problem was being unable to start games where graphics filter is 'undefined'. This didn't happen with every game though, so might be related to some settings not being read correctly?

Crimson Wizard

Quote from: morganw on Tue 20/03/2018 00:45:04
I've tried this one and didn't have any colour issues, only problem was being unable to start games where graphics filter is 'undefined'. This didn't happen with every game though, so might be related to some settings not being read correctly?

Weird... color is broken in every game I tried, including 32-bit ones.

Which games did you run?
Also, could you post your config file?

Privateer Puddin'

Quote from: Crimson Wizard on Tue 20/03/2018 00:34:33
Quote from: Privateer Puddin' on Tue 20/03/2018 00:27:32
Installing the new (14th March) APK (having never installed a previous one)

14th March? No, that's the old one, the new one is from 20th March.

I was mainly just referring to:

QuoteBut since no one said whether new APK installs for them, I do not know this for sure.

Which is the one I thought you meant, since it was the most recent before your latest post. Anyway, I installed the 14th March one before the 20th one was posted - do you want me to try installing that too?

Crimson Wizard

Quote from: Privateer Puddin' on Tue 20/03/2018 00:53:40
Which is the one I thought you meant, since it was the most recent before your latest post. Anyway, I installed the 14th March one before the 20th one was posted - do you want me to try installing that too?

Yes, it would be good to know to compare how they work.

SMF spam blocked by CleanTalk