[MERGED] Android Build in the Editor

Started by eri0o, Tue 08/02/2022 21:44:30

Previous topic - Next topic

eri0o

Android Build in the Editor


⚠️⚠️This feature is merged and available in 3.6.0 releases⚠️⚠️


running on your computer may have visual differences ... (I am too lazy to update this gif)

Please test and report. Here's the step by step:


  • Install Android Studio, the latest version available
  • Note down the directories it is installed (probably C:\Program Files\Android\Android Studio) and where it installed the Android SDK (probably C:\Users\YOURUSERNAME\AppData\Local\Android\Sdk)
  • open AGS Editor and either create a new game or load a copy of a game you want to test. Don't use your actual game files with this editor since it will add information to your project settings that are not compatible with other 3.6.X versions.
  • On Editor preferences, Set JAVA_HOME to where your JDK is installed, if you have Android Studio, it' s probably C:\Program Files\Android\Android Studio\jre
  • On Editor Preferences, Set ANDROID_HOME to where the Android SDK was installed, it probably is C:\Users\YOURUSERNAME\AppData\Local\Android\Sdk
  • Still on Editor Preferences, set your Android Keystore information. If you don't have a keystore, use the Generate Keystore button. On the keystore generation screen, everything under Certificate is optional.
  • Go in general settings, find the Android entry there and adjust as needed(aab, APK, ...), then on build, select Android among the platforms
  • Hit Build Exe in the Editor and wait things to happen. This will take a lot of time on the first time since it needs to install a lot of things, it should be much faster afterwards

Icons!

At your project root, create a directory named icons with a directory named android inside. Then you need to add the following files ( template here):


  • icons/android/mipmap-mdpi/ic_launcher.png 48x48 pixels, RGBA png icon
  • icons/android/mipmap-hdpi/ic_launcher.png 72x72 pixels, RGBA png icon
  • icons/android/mipmap-xhdpi/ic_launcher.png 96x96 pixels, RGBA png icon
  • icons/android/mipmap-xxhdpi/ic_launcher.png 144x144 pixels, RGBA png icon
  • icons/android/mipmap-xxxhdpi/ic_launcher.png 192x192 pixels, RGBA png icon

If you want to support round icons, additionally create ic_launcher_round.png files in the same directories. If you need help creating those files, try this online AndroidAssetStudio.
FAQ






  • Q: I am missing the Android SDK!
    A: after installing Android Studio, load Android Studio and click in the top menu in Tools, and then in SDK Manager, at top, hit Edit



    In the next screen, set the adequate location and hit next.


    You can hit next here, just note down that the SDK Folder here is what is set as ANDROID_HOME in the Editor preferences, and JDK Location is the JAVA_HOME on the Editor preferences. <<<<


    And then it comes one thing you have to do, if you want to use it, you need to accept the licenses! There are two licenses you need to accept in this screen, so scroll down and hit accept, switch to the next one, scroll down again, and hit accept again.


    We are going to be using SDK 29 in here for now, so if something complains about it, make sure to comeback to the SDK managed and find and click in Android 10 (Q), API Level 29 and then proceed to installing it. If you don't, AGS Editor may try to download and install it anyway if needed when building your app for the first time, after ANDROID_HOME and JAVA_HOME are set!






  • Q: I installed Android Studio using JetBrains Toolbox! But I can't find it... What do I set in ANDROID_HOME ?
    A: OK, if you did this way, the toolbox entry of Android Studio has an entry to show it in file explorer. If you can't find it, it usually uses a directory similar to below:
    C:\Users\MYUSERNAME\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\211.A_TON_OF_NUMBERS\jre





  • Q: How do I set the screen orientation or rotate it?
    A: Screen Rotation has to be configured in Default Setup, currently there are three possible options: Unlocked (player may rotate device screen freely if he unlocks it), Portrait (game can only be vertically oriented) and Landscape (game screen is horizontally oriented). Default is Unlocked.






  • Q: Why is my app name app-mygame-release.apk? Can I change this name?
    A: You did not change the property Android App ID in General Settings. Set it to something like com.incredibleproductions.indianagame and you will get app-indianagame-release.apk.






  • Q: I got a "validateSigningRelease FAILED" message and my build did not work...
    A: It's possible that the keystore was not set, if that is the case go into Preferences, and on Android tab set the correct keystore information. If you don't have a Keystore, please generate one using the Generate Keystore button, and click OK after successfully generating one.







  • Q: Build is a bit slow, can I do anything to speed it up?
    A: In Editor Preferences, under Advanced tab, in Android, select Use Gradle Daemon and mark it true.




There is still room for improvement, but this should do the general things...

Also when possible please try these experimental versions of editors that appears in this board, the feedback given can help make ags better. After the feature is already in, some things get a lot harder to change.

Spoiler

Additionally, I recently started thinking about build matrixes in AGS, if someone has any design idea for this. It looks something like this (this is a different editor than the above):

[close]

Mehrdad

#1
Amazing. Finally Done!. Nice Job!

I can successfully get apk after 2 hours of upload and build and...

@eri0o
I tested apk on my cellphone with Android 5.1. The result was great although fps was a little low. I will test with increased speed of the game.
And my questions:
1)  How can adjust Landscape or Portrait? I only have portrait
2) Is it possible integrate with unicode editor (Latest version)? I want test it for see fonts
My official site: http://www.pershaland.com/

eri0o

#2
I haven't yet integrated the Editor to write the proper android config yet, I was interested if people would be able to install Android Studio and it, and getting this working on the computer.

As soon as I integrate the config it should be just a menu entry for rotation.

The apk is made for local testing, but I believe Cafe Bazaar uses the aab + non-embedded asset (same as Google Play), this would be the upload format.

About 2, I could make that version, yes, but I can advance that the Unicode version doesn't support font ligatures yet. Font ligatures requires the Harfbuzz library and we haven't gone there yet. If no font ligatures is fine for now I can create that build, but probably only Friday. Please test the Unicode version separately though, we are probably going to be integrating both later but knowing what works and what doesn't helps polishing the features.

Crimson Wizard

#3
Quote from: eri0o on Wed 09/02/2022 07:26:00
About 2, I could make that version, yes, but I can advance that the Unicode version doesn't support font ligatures yet. Font ligatures requires the Harfbuzz library and we haven't gone there yet.

We were discussing this on Discord just recently, and turns out Mehrdad has found a way to make it work, using some software called "ParsiNegar" which generates Persian text, which is then copied into the AGS Editor. I'm not exactly sure how it manages to do this, but visually it seems working.

Quote from: eri0o on Wed 09/02/2022 07:26:00
If no font ligatures is fine for now I can create that build, but probably only Friday. Please test the Unicode version separately though, we are probably going to be integrating both later but knowing what works and what doesn't helps polishing the features.

If you're too busy, maybe I could make a Draft PR for a test with these merged? Assuming it's enough to use your existing android branch. I'd prefer to rely on build server instead of making these by hand.

eri0o

No problem CW, go ahead!

I think after we are done with this version, we really should look into moving on from our old FreeType to a newer FreeType, so integrating Harfbuzz is easier.

Laura Hunt

I'll try to test this today and report my findings. I remember however that back when I tried out the Android wrapper for AGS 3.5.0, right clicks didn't work and I wasn't able to bring up the phone keyboard either for a section of the game in which you have to type some numbers, but I assume these issues have been dealt with in the meantime?

eri0o

No, but in detail:

1. I would much rather support touch up, touch move, and touch down events, and have multitouch in some GUI elements (buttons). I have a writeup here: https://ericonotes.blogspot.com/2020/11/a-quick-look-at-touch-handling-apis-in.html

I think adapting mouse to touch is bad, the developer should handle touch input differently.

2. Keyboard is not there, the problem is this was done through a menu, but SDL2 is done in a way that it grabs the surface and draw and it's over painting any control I throw on top. If we had something like dear imgui I could make a nice UI in c++ itself but as is I haven't yet figured any way to do in Java. I would rather have proper 1 and let people implement this in-game.

Mehrdad

Quote
We were discussing this on Discord just recently, and turns out Mehrdad has found a way to make it work, using some software called "ParsiNegar" which generates Persian text, which is then copied into the AGS Editor. I'm not exactly sure how it manages to do this, but visually it seems working.


Yes, I made a PDF guide too
https://www.dropbox.com/s/j8hwfpfzqzcprpl/Persian%20and%20Arabic%20fonts%20in%20AGS.pdf?dl=0
My official site: http://www.pershaland.com/

Crimson Wizard

#8
Quote from: eri0o on Wed 09/02/2022 08:37:38
I think adapting mouse to touch is bad, the developer should handle touch input differently.
<...>
I would rather have proper 1 and let people implement this in-game.

The problem is that we were using Android port not only to make games, but also to run existing games whose authors were not preparing for Android (this is what "universal" game launcher was meant for, as 99% of AGS games do not have proper mobile ports). This is why we need some basic controls/keyboard as a default solution for such cases.


Quote from: eri0o on Wed 09/02/2022 08:37:38
2. Keyboard is not there, the problem is this was done through a menu, but SDL2 is done in a way that it grabs the surface and draw and it's over painting any control I throw on top.

Was it done by drawing a keyboard control right on top of the game's surface in the old port? I wish i knew more about this.

Mehrdad

Suggestion: Please add "release mouse" instead "click" for control character. It's useful for mobile ports as a user touch screen for finding hotspots no walking.
My official site: http://www.pershaland.com/

eri0o

#10
Honestly the ags player as is I would rather let ScummVm take the throne there.

But still on the keyboard, what we need is support System.ShowKeyboard instead. Also a reminder, we can't use the back button anymore on Android, since it's now handled by gesture - back button is gone in latest Android versions.

We should first and foremost support developers doing their mobile ports, multitouch would allow making a GUI controls for on screen joysticks. Supporting players who have put their games there come latest in my opinion. If we switched this mode of thinking the agsplayer could be repurposed more as a companion to the Editor, similar to the original Phonegap app, where it let me type the local IP address of the PC the Editor is running, and then we can have things like debug, log, ...

But going back a bit, we need to get rid of the android.cfg and use acsetup.cfg instead, this is the first priority. And add a rotation config there, in acsetup.cfg.

Crimson Wizard

The Editor combining Android + Unicode may be downloaded from here:
https://cirrus-ci.com/task/5505374429118464

Joseph DiPerla

I tried this out. Great Work! Works like a charm. Just needs some configuration settings like loading in landscape mode, etc.. and this will be another notch in AGS' belt.
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

eri0o

I have been thinking about rotation, perhaps it could use an auto config for now. If the game has height bigger than width it sets portrait, and if not, landscape.

I would like to redo how the build process of AGS works, but I am not sure I can do it fast enough and bug free enough to be something that gets in 3.6.0, but ideally I would like to be possible so you can selectively exclude rooms or set macros and things and build different versions of game data, possibly paired with different versions of acsetup.cfg and then can choose what gets build to which system and things like that. But there's already a plan to get after 3.6.0 is done a version of the editor that uses command line tools to build AGS games so I think I would prefer to have that happen at that time. So currently there is no reasonable panel to place things like an adb interface or a gradle interface. :/

Crimson Wizard

#14
Quote from: eri0o on Thu 10/02/2022 09:02:34
I would like to redo how the build process of AGS works, but I am not sure I can do it fast enough and bug free enough to be something that gets in 3.6.0, but ideally I would like to be possible so you can selectively exclude rooms or set macros and things and build different versions of game data, possibly paired with different versions of acsetup.cfg and then can choose what gets build to which system and things like that. But there's already a plan to get after 3.6.0 is done a version of the editor that uses command line tools to build AGS games so I think I would prefer to have that happen at that time. So currently there is no reasonable panel to place things like an adb interface or a gradle interface. :/

I honestly think it's best to switch focus to ags4 soon after 3.6.0, where you can overhaul whatever you like, cutting old features if necessary. ags4 has been in development "limbo" for a long while now, and becomes stale. There's a new script compiler with lots of useful features, an open room format almost ready, and someone may eventually do open sprite format as well. I fear that pretty soon someone asks: why cannot we have these features if they are ready? Then someone will get an idea to start moving them to 3.* branch, and development will go on a new cycle of getting stuck in a 3.* again. This happened before, several times, in the last 5 or so years.

The 3.6.0 was not supposed to be as big as it became, the sole purpose of it initially was to have a SDL2-based engine that has full backward compatibility, as a backup. I'm afraid that pushing changes there further will eventually come in conflict with this concept. When I started 3.6.0 there were two major goals: SDL2 and command-line build tools. SDL2 is practically done, and tool development was unfortunately frozen at some point. But compatible tools may be added to that branch later when time permits, or even backported from ags4 if they are first done there.

[REDACTED] removed unnecessary ramblings

eri0o

I agree 100% with moving to ags4 right after. Just to clarify, we can really do the tools there and backport if needed, I think it's the better way too.

Crimson Wizard

#16
Quote from: eri0o on Thu 10/02/2022 10:28:38
I agree 100% with moving to ags4 right after. Just to clarify, we can really do the tools there and backport if needed, I think it's the better way too.

Sorry, did not mean to discourage you, or anything! I just suddenly got agitated, wondering if more things will be put on 3.6, while we already have a big list of planned but undeveloped features there.

The idea of build configurations where you may select files and compile options sounds pretty interesting. I guess right now this may already be doable to some extent by writing package scripts by hand which call agspak and compiler tools? I wish we had some kind of "feature group lists" that describe these ideas for the future, and all related tasks (e.g. "Automated game building"), so that everyone could know where we are going.

But this is offtopic here, so I will shut up.


eri0o

#17
It's already doable with agspak and scripts, you even wrote one .bat script at some point - I have it in my computer, but I can't find it on GitHub.

---

Back on Android, it appears that while the first level of a menu is drawn behind the SDL surface view no matter what I do, it seems the second level is always drawn on top. The caveat is the second level of the apparently blocks the application. So it seems the doable way is when the menu opens, open programatically an option, and then have all menu options under this one, and also delay all actions done from the selections by using timer with the action on the callback. I need to test this to verify that this really works alright on different devices...

Edit: Android is too mystical and the above didn't work. I found a way that is blowing up the game screen, drawing the menu, and picking up the game screen back after the menu is closed. It looks terrible but it worked.

Edit: done!

eri0o

@Laura Hunt, I added the keyboard toggle and extra keys on the above (updated the download on the link too), you should be able to reach it by using either the back button or the back gesture (depending of android version/config) when in game.

I hope I can get rotation working later this weekend.

Laura Hunt

Unfortunately, this did not work for me. First I got the following error:



And then on subsequent tries, this one:



This is a short extract (it was much longer) of the error message that can't be seen in the screenshot (with my Windows username redacted):

Quotesymbol:   variable key_ctrlx
  location: class id
C:\Users\xxxxx\Documents\AGS Projects\ioawn4t - Android\Compiled\Android\library\runtime\src\main\java\uk\co\adventuregamestudio\runtime\AGSRuntimeActivity.java:238: error: cannot find symbol
        } else if(id == R.id.exitgame) {
                            ^
  symbol:   variable exitgame
  location: class id
C:\Users\xxxxx\Documents\AGS Projects\ioawn4t - Android\Compiled\Android\library\runtime\src\main\java\uk\co\adventuregamestudio\runtime\AGSRuntimeActivity.java:240: error: cannot find symbol
        } else if(id == R.id.toggle_keyboard) {
                            ^
  symbol:   variable toggle_keyboard
  location: class id
C:\Users\xxxxx\Documents\AGS Projects\ioawn4t - Android\Compiled\Android\library\runtime\src\main\java\uk\co\adventuregamestudio\runtime\AGSRuntimeActivity.java:251: error: cannot find symbol
        return R.menu.default_ingame;
                ^
  symbol:   variable menu
  location: class R
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I'm not sure if this is because I was using a game with script compatibility level set to 3.4.1, but right now I don't have a game compiled with 3.6.0 to test.

Also, an interesting side effect was that in the compiled Windows version, frame-linked sounds were not playing at all. I don't know what this has to do with the changes introduced for the Android build, but I can confirm that when I compiled and ran my game with the "vanilla" AGS 3.6.0.17 Alpha 18 build, those sounds played correctly.

eri0o

This usually means that JAVA_HOME is set to directory where JDK was not installed. Did you set up Java through a separate installer or are you using the one that is provided along Android Studio? If you are the one with android Studio, can you tell me which version?

Laura Hunt

#21
I installed everything though Android Studio, the latest version 2021.1.1 Patch 1. The path is correct, C:\Program Files\Android\Android Studio\jre.

Crimson Wizard

#22
Quote from: Laura Hunt on Sat 12/02/2022 18:32:13
Also, an interesting side effect was that in the compiled Windows version, frame-linked sounds were not playing at all. I don't know what this has to do with the changes introduced for the Android build, but I can confirm that when I compiled and ran my game with the "vanilla" AGS 3.6.0.17 Alpha 18 build, those sounds played correctly.

There's something broken in the master branch after the audio refactor i did few days ago.

From my own tests, ViewFrame sounds sometimes play and sometimes don't, which seem random.

eri0o

#23
Quote from: Laura Hunt on Sat 12/02/2022 21:01:01
I installed everything though Android Studio, the latest version 2021.1.1 Patch 1. The path is correct, C:\Program Files\Android\Android Studio\jre.

Thanks, I found the error! I will upload a new version that should take care of this, just need to check if I made any more mistakes on this part. :/

Edit: actually turns out it was 3 errors. I am still checking to see if there's something more I missed.

eri0o

#24
@Laura Hunt, I think I fixed all the errors (erh, at least the reported ones, if there are more, please tell me!). Thanks for the screen caps and the error messages! They were very helpful! I setup from a new install in my PC here and it appears it's working. I updated the files on the google drive linked in the first post!

Ah, right, about the sound, what CW said. It should be fixed soon.

@Mehrdad, I added the rotation config through Default Setup and updated the main post. It should be working now. About the click, I agree there are necessary enhancements for touch input. I wrote the general gist of what I think here, but I won't be working in this just right now. For now I want to get the build working.

Laura Hunt

With the new build I'm not getting the reported errors anymore, but:

Quote> Task :app:validateSigningRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'C:\Users\xxxxx\Documents\AGS Projects\ioawn4t - Android\Compiled\Android\mygame\app\Î"?¬C:\Users\xxxxx\keystore.jks' not found for signing config 'release'.

I guess this error is on my side, but I generated my key through Android Studio itself so I have no idea what might have gone wrong (Build->Generate APK->Create new->Filled everything out->Selected 'release' as build variant.)

Mehrdad

#26
Quote
@Mehrdad, I added the rotation config through Default Setup and updated the main post. It should be working now. About the click, I agree there are necessary enhancements for touch input. I wrote the general gist of what I think here, but I won't be working in this just right now. For now I want to get the build working.

@eri0o

Great!. I tested "Lanscape" now and works perfect but with a little issue. After run, I have some multi-screen ( Below picture). But it solves itself after some clicks. (like mobile back key )

I have Android 5.1.  With Api 19 or 20 I think so. It's really old cellphone :-D

I tested back click too and works perfect for "F1,F2,..." and "show keyboard" and "exit"

As I said before we need to "release mouse" instead "press down" on mobiles. User wants search hotspots with finger moves on screen. It start to walking with "press down" and mobile users don't want it.

Thanks so much again for your hardworks

My official site: http://www.pershaland.com/

eri0o

@Laura Hunt, I will investigate, it may be something like special characters on path, spaces on a folder name or something else not related. I will try to reproduce here and see if I can figure it out.

@Mehrdad, the image is weird, I don't know what could be yet. Have you tried changing the renderer, like do you get that same image with both OGL and Software renderer? I have no idea what could be to cause that image yet.

About control scheme I don't fully understand what you mean yet, but again, multi touch or a more natural touch scheme is not something I am going to look into now. This would require touch specific events which would allow the developer to script whatever scheme they feel they want, instead of hardcoding any behavior at all.

Laura Hunt

Quote from: eri0o on Sun 13/02/2022 08:50:11
@Laura Hunt, I will investigate, it may be something like special characters on path, spaces on a folder name or something else not related. I will try to reproduce here and see if I can figure it out.

There are no special characters or spaces in the path or anything of the sort, so it's likely that I've done something wrong at some point, given that it works for Mehrdad and Joseph. If you can figure it out or provide detailed instructions as to how to create a keystore that would be great, but if not, no worries. At least Mehrdad has confirmed that it works correctly, and I'm sure somebody else will step in to test it too :)

eri0o

#29
I meant more there's an hyphen in your game dir, after a space character, I don't know if this may trigger something somewhere to think the directory may be a parameter. (Yes, I should escape characters as needed, but I am still writing the escaping code so for now it's not good :/)

Anyhow, if you set the password for the keystore and the keystore location in the AGS Editor -> Preferences -> Advanced -> the things under Android, when setting the Android Keystore path the Editor do checks to see if it's really there. There's also a very weird thing that Android Studio asks now is that the keystore and the key passwords are the same. I haven't tried using different ones to see what kinda of error message it outputs. I am out of home now, will check when I get back.

Laura Hunt

#30
Quote from: eri0o on Sun 13/02/2022 09:18:15
I meant more there's an hyphen in your game dir, after a space character, I don't know if this may trigger something somewhere to think the directory may be a parameter. (Yes, I should escape characters as needed, but I am still writing the escaping code so for now it's not good :/)

My game dir was "ioawn4t - Android", so I changed it to "ioawn4tAndroid" and moved it to a path with no spaces or hyphens whatsoever, and I'm still getting the same error.

Quote from: eri0o on Sun 13/02/2022 09:18:15
Anyhow, if you set the password for the keystore and the keystore location in the AGS Editor -> Preferences -> Advanced -> the things under Android, when setting the Android Keystore path the Editor do checks to see if it's really there. There's also a very weird thing that Android Studio asks now is that the keystore and the key passwords are the same. I haven't tried using different ones to see what kinda of error message it outputs. I am out of home now, will check when I get back.

Both passwords are the same, yes. And the .jks file is definitely there in the path that I entered (no spaces or anything there either).

btw, when I close the editor, the process OpenJDK Platform Binary keeps running hogging a ton of memory, and it keeps some files locked until I kill it from the Task Manager. Not sure if this is useful to know!


Mehrdad

#31
Quote from: eri0o on Sun 13/02/2022 08:50:11

@Mehrdad, the image is weird, I don't know what could be yet. Have you tried changing the renderer, like do you get that same image with both OGL and Software renderer? I have no idea what could be to cause that image yet.

About control scheme I don't fully understand what you mean yet, but again, multi touch or a more natural touch scheme is not something I am going to look into now. This would require touch specific events which would allow the developer to script whatever scheme they feel they want, instead of hardcoding any behavior at all.

I forgot adjust it on openGL and it's on D3D. Maybe problem is here.Also, I'll change "Fullscreen scaling style" too. I'll test it and let you know. Please if anyone has my problem let me know too maybe my Android is too old. ( Android 5.1)

For touch: My mean is please add "release mouse" to AGS system. It works on "press mouse" now and it's not suiatble for mobiles
My official site: http://www.pershaland.com/

Crimson Wizard

#32
Quote from: Mehrdad on Sun 13/02/2022 08:10:47
As I said before we need to "release mouse" instead "press down" on mobiles. User wants search hotspots with finger moves on screen. It start to walking with "press down" and mobile users don't want it.

@Mehrdad, indeed AGS currently does not have a ready event for released mouse, but you can change your script to react to the mouse state change (pressed - released) in the repeatedly_execute.

To do this:
1) have a global variable to remember last mouse button state
2) check in repeatedly_execute for the current mouse button state
3) compare to the last saved state. If button's state changed, do the action.
4) save new state in the variable.

Code: ags

bool was_mouse_down;

function repeatedly_execute()
{
     bool mouse_down = Mouse.IsButtonDown(eMouseLeft);
     if (mouse_down && !was_mouse_down)
     {
         // user just pressed the button
     }
     else if (!mouse_down && was_mouse_down)
     {
         // user just released the button
     }
     was_mouse_down = mouse_down; // remember new state
}


Also I may recommend speaking with Wadjet Eye (Dave and Janet Gilberts) and other people who ported their games to mobile, perhaps they will have some advices.

Mehrdad

@Crimson Wizard

Sorry, I didn't right understand. Do must I make global variables? And after that how can I fill your conditions?

I remember to play Gemini Rue on my cellphone and had this problem.
My official site: http://www.pershaland.com/

Crimson Wizard

#34
Quote from: Mehrdad on Sun 13/02/2022 13:12:52
Sorry, I didn't right understand. Do must I make global variables? And after that how can I fill your conditions?

You fill them with actions corresponding to the event. Just like you fill on_mouse_click now.

For a simple example:
Code: ags

     else if (!mouse_down && was_mouse_down)
     {
         // user just released the button
         // call room interaction (walking, using objects, etc)
         Room.ProcessClick(mouse.x, mouse.y);
     }


If there are more problems with this code, I suggest discussing this in the "Technical help" forum, as this is mostly a scripting question.


eri0o

#35
I just added a minor FAQ on the first post. I surely would like to automate things a bit more but I am afraid Google may change some things just too fast. I haven't yet figured the signing problem (I just blew up my install and started from scratch and it's working, so I could not reproduce it yet), if someone else hit it too, please let me know.

I also haven't yet figured what to do about the icons. This icons.zip has how they look like. I am thinking of simply asking for a directory in the project called AndroidIcons with the contents of this zip prepared for your game. Not sure on this yet. If anyone has any ideas, please share.

Mehrdad

@eri0o
I tested again with openGL and "Fill whole screen" mode. I had same problem again. It improve after a refresh screen like pressing the back button or on/off screen and so on 

Does anyone have this problem?
My official site: http://www.pershaland.com/

eri0o

Hey Mehrdad. I don't have that issue on my phones so far. I tried a few ideas but could not reproduce. In the back button, the keys entry, one of them is Ctrl+V, if you hit it, it should load a display with some information. Can you capture a screenshot of that when you have that problem? Or does it "clean" the screen as soon as you hit back button?

Mehrdad

 It "clean" the screen as soon as you hit back button or others. So I can't capture the screen   (wtf)
My official site: http://www.pershaland.com/

Crimson Wizard

#39
I'm testing this Android building now. After setting up ANDROID_HOME and JAVA_HOME, I'm getting following error in the command window:

Spoiler

Quote
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Dev\ags-games\ags-camdemo\Compiled\Android\mygame\app\build.gradl
e' line: 31

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path=''

[close]
What is this "path" variable refering to, do I need to also set it?
EDIT: Oh, looking at the code, this is keyStoreProperties not set. I wish there was some kind of error message thrown with more details.

UPDATE 1: I hate Android Studio because it looks strange and I cannot find anything it its menus.
So ended up generating keystore from command line following instructions:
https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore

UPDATE 2: next problem:

Spoiler

Quote
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.

> Failed to install the following Android SDK packages as some licences have not
been accepted.
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     build-tools;30.0.3 Android SDK Build-Tools 30.0.3
     platform-tools Android SDK Platform-Tools
     platforms;android-29 Android SDK Platform 29
     tools Android SDK Tools
  To build this project, accept the SDK license agreements and install the missi
ng components using the Android Studio SDK Manager.
[close]
So, there are missing components, but I have two questions:
- why is emulator required to build the game?
- is the SDK platform version a variable somewhere, or this is hardcoded, and we must use exactly that version?

eri0o

#40
🔐 Keystore

I can put a menu for creating the keystore, but I have no idea where to put such menu.

About the error message, I thought I had put a check for that but apparently it didn't got committed somehow. I am going to fail the build earlier if the keystore settings are empty/invalid.

Edit: there's now a Generate Keystore button in preferences to load the keystore generation dialog.




â˜'️ Requirements

About the requirements, it's:

- SDK is needed for the Android API that is accessible through Java or Native. We will always need it. It matches the compile API target. This one changes at least once per year because of Google Play policies.

- Build Tools are the tools for building. Ideally we always want these to be the latest as possible. They are not dependant of the target you are building or the SDK. The emulator it comes is probably some interface, but it doesn't download any images. We will always need it. We can change this only if there's a bug building newer SDKs.

- NDK may be needed too. We are not directly using it to build C++, but some minification of native code apparently needs it. Theoretically it should be possible to build the runtime library project to a jar and then depend of this jar elsewhere, but I could not figure out a sane way to do this (without needing to push this as a package in Maven). I don't want to pursue eliminating this now and going the jar approach. NDK is similar do build tools in being independent of target version. I also may be wrong here and we don't depend on NDK already.

These versions are all anotated in the Gradle build scripts. The Editor requests and install them.

The current minimal target is set to 29 because of SDL2 version we are using. For Play Store this needs to be 31 minimum. This requires some minor updates in the manifests which I plan to do later. See  https://developer.android.com/distribute/play-policies

I know how to ask for installation and it should ask for installation, but if it asks about license approval I could not figure out how to not use Android Studio for accepting the licenses.

Crimson Wizard

Is it possible to post a list of components that I have to check and install in the SDK Manager? Because I tried installing the ones from error message, was not able to find all of them in the list, and even after i installed some of them it kept reporting same missing components again.

eri0o

On the top post there's a FAQ, in the first entry I mentioned the SDK, it's a bit weird, but I need to have something installed to get the sdkmanager. Once the sdkmanager is in place I can use it to install other things.

It does come with a little yes script that can be used to accept following licenses, perhaps I could use and assume that everyone trying to use agrees with the licenses - just need to check the script works on Windows.

Anyway, AGS Editor above should try to install things after a sdkmanager is installed, if it's not doing that, it's a bug.

Crimson Wizard

#43
Right now I have following installed (checked in the SDK manager):

SDK Platforms:
* Android 11 (api level 30)
* Android 10 (api level 29)

SDK Tools:
* Android SDK build tools: 32.0.0, 30.0.3, 29.0.3
* NDK (side by side): 22.0... , 21.3...
* Android command line tools 6.0
* Android emulator 30.3.5
* Android SDK platform tools 30.0.5


May someone else say what do they have?

May the problem be that I set wrong path to ANDROID_HOME? Do I need to set it to the Android Studio root folder, or to one of the subfolders?

eri0o

#44
ANDROID_HOME is set to the SDK path (should be a dir named Sdk, see first post!)

JAVA_HOME should be the path to JDK, which is confusingly a directory that ends in jre (but it's not JRE!), and this one is on the Android Studio directory (again, see first post)

Question: which Android Studio you have?

I can try to come up with some heuristics to try to search and find out both above, so I can automatically fill ANDROID_HOME and JAVA_HOME but I don't know at which point I should run this.

Crimson Wizard

#45
Ok, sorry, I made a mistake. There apparently have been some older version of SDK from couple of years ago, which I thought is current one.
The directory in "...\AppData\Local\Android\Sdk" was practically empty with only 1 file inside.

I fully deleted Android Studio and SDK from my system to be certain, and resintalled again using most recent version, and double checked the new paths. Now the building is running (still waiting for result while I type this).

UPDATE: it completed successfully now, and there's app-mygame-release.apk.
Maybe a silly question, but should not it use game's name? or I missed another instruction?

eri0o

#46
You forgot to set the package name of your game in the general settings! If you did and still got that, it's a bug! :)

Edit: adjusted to get clearer error messages on wrong/missing config of ANDROID_HOME, JAVA_HOME and Keystore path. Also I had forgotten to set the app name you see when browsing apps and now it should correctly pick your game name you already use in game windows. Updated the file links on the first post.

Mehrdad

#47
@eri0o

Thanks for updates. Please integrate unicode last version (by CW) too. I tested it and the result was correct for showing symbols on Android.

@Crimson Wizard

Did you test it on the device too? If yes, Do you have my problem too?
My official site: http://www.pershaland.com/

Crimson Wizard

#48
Quote from: Mehrdad on Wed 16/02/2022 06:02:30Please integrate unicode last version (by CW) too.

Please note that we cannot integrate it with the official Android port yet, as unicode feature is not ready; I'm planning to work on it properly soon. We may only post a test version which merges unicode with Android, but it will not be guaranteed to be final, and should be used to create actual game releases.
Currently you may use the existing method of putting unicode in game - using the translations.

eri0o

I am working on a keystore generation GUI... It will be a little while before everything is rightly working but...

Spoiler
[close]

Joseph DiPerla

Wow nice! This is shaping up to be a great Android Development tool.
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

Mehrdad

Quote from: Crimson Wizard on Wed 16/02/2022 08:46:02

Please note that we cannot integrate it with the official Android port yet, as unicode feature is not ready; I'm planning to work on it properly soon. We may only post a test version which merges unicode with Android, but it will not be guaranteed to be final, and should be used to create actual game releases.
Currently you may use the existing method of putting unicode in game - using the translations.


OK. Sure. Thanks for your hardworks


@eri0o

Create keystore is so fantastic. Great feature!. Nice job!
My official site: http://www.pershaland.com/

eri0o

#52
Finally managed to add the Keystore Generation in the Editor.

I updated the links on the first post. Now in the Editor Preferences, there is a new Tab called Android!

In this tab, you can set JDK path, SDK path, and keystore information. If JDK and SDK are set correctly, test should indicate that they are found.

There is also now a button Generate Keystore where you can write your keystore information and generate one. After it's sucessfully generated, if you click OK, it will fill your preferences settings with this information, if you click cancel, then nothing happens. After you also click OK in the Preferences, settings are applied and  new builds will use the newly set keystore. I tested a bunch, but if you find something wrong, please report.

Edit: did a few improvements on this pane, updated to v4.

I think the only part missing now is getting the icons in place, once that is done, the building part should be alright and then once any merging issues are fixed I will look into touch input details. Probably in a new thread...

Edit2: finally got icons working! Updated it to v5

Now I only expect bug fixing in this. The features I meant to have at this time with Android Building are all there.

Edit3: renamed Package Name to App ID, in v6. This is to match more recent android documentation that now uses Application ID when referring to it.

I also updated the screenshots and text in the first post.

Edit4: Ok, updated it to v7, now it only keeps the cmd.exe screen if the build fails for some reason. Successful builds will automatically close and report the build success.

Edit5: disabled Gradle daemon by default, but added an option to turn it back on. I highly recommend turning it on, specially if you intend to build to android lots of times. Version is now v8

@Mehrdad, have you ACTUALLY tested with Software mode? Can you confirm by using the setting and confirming with Ctrl+v that you have the same graphical glitch with both Software and OGL renderers? I can't reproduce, but I am trying to figure out what could be the case - haven't actually figured nothing yet...

eri0o

#53
v9, probably final revision. Makes the app not require any permission at all since all the game is inside the app and assets packaged in the game itself, there's no need to external disk access.


Mehrdad

@eri0o
Android Build: ANDROID_HOME is not a valid SDK path. Can't find sdkmanager.

I hadn't this problem in previous builds. SDK path is correct
My official site: http://www.pershaland.com/

eri0o

What do you mean SDK path is correct? Which Android Studio version you are using? What's the used path? Where's your sdkmanager.bat?

Mehrdad

My SDK path is:  E:\Archive\Softwares\android-sdk-windows\android-sdk-windows
JDK: C:\Program Files\Android\Android Studio\jre

It was ok in previous versions and I got apk but I have this error now!
My official site: http://www.pershaland.com/

eri0o

#57
this is weird... Do you have a directory that looks like the one below? I need to figure out where is the sdkmanager.bat in your install.



Did you downloaded the android sdk by hand? If you can't find the sdkmanager.bat file above, do you remember the link of where you got it? (or if it's size is not too unwieldly, if it's possible to share it through some filesharing way...)

Mehrdad

#58
No I haven't this derectory.Yes, I downloaded the android sdk by hand.
I haven't sdkmanager.bat. I have SDK manager.exe in the same directory that I mentioned
My official site: http://www.pershaland.com/

eri0o

So sdkmanager.exe is at the root of that directory? Can you pass me a list of directories right in that directory? (maybe there's a cmdline-tools named directory there...)

Can you also tell me your Android Studio version?

Mehrdad

#60
Yes, it's in root directory






Android Studio 3.3.2
built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
My official site: http://www.pershaland.com/

eri0o

So this is an older version than the one I was prepared to support, this is before the version naming changes - newer is not 4, they've abandoned that version scheme for one that reflects year (of the base Intellij version or something), stable is 2021 for example.

To be honest the best thing I can think of is to avoid any error checking in ags side at build time and rely in gradle to do it's thing. But it's error reporting is often cryptical. So maybe an option to avoid sanity checking.

I am not sure yet on what to do and come up with something that works but not breaks for others. Supporting many android studios at the pace Google is updating things it's practically a full-time job, so going with only latest version of AS was the compromise I could keep up.

Mehrdad

#62
That error is in AGS editor and not when it make build.

My official site: http://www.pershaland.com/

Crimson Wizard

@Mehrdad, have you set an actual path to android sdk in the Preferences window?

Mehrdad

Quote from: Crimson Wizard on Sun 27/02/2022 06:09:59
@Mehrdad, have you set an actual path to android sdk in the Preferences window?


Yes, Actually I get apk before. It says this message in the new version
My official site: http://www.pershaland.com/

eri0o

Sorry, just to explain, this sdkmanager.exe doesn't exist anymore, this was a previous sdkmanager that had even a graphical interface. In recent versions the sdkmanager is a Java library made of libraries under the cmdline-tools/lib or tools/lib, with an entry point file named sdkmanager.bat, that partially makes up the API. The actual files behind the sdkmanager changes between command line tools and the Android Studio command line tools.

I made everything accounting for the files and SDK installed by the latest Android Studio. The command line tools and Android Studio from Mehrdad are at least three years old... And the new versions are a bit different too, because they expect now that the user will place the directories in the right place manually. It's very tricky to assemble everything by hand, I really would prefer to not support that - I can seriously spend a lot of lines describing how to glue things together, but everything will be very brittle on each update...

Mehrdad

It's sad news for me. Google doesn't support  IP Iran at all and we can't access to last updates in Android Studio. The only way was manual SDK and so on that we could get it from our sites.
Anyway, updates don't work with VPN and VPS even and google knows them!!
Actually, I can't get apk anymore. If I found any way let you know.
My official site: http://www.pershaland.com/

eri0o

for now you can create a directory named tools at the root of your android sdk, then create a directory named bin inside it and then an empty text file there called sdkmanager.bat and it will work. I am relying on sdkmanager to update/verify installation of things, so this will work as a temporary proxy. Recap, create an empty text file in ANDROID_HOME/tools/bin/sdkmanager.bat.

I am still thinking on what to do for a prettier way... My premise was to rely on current Android Studio and docs, older versions everything was very confusing... Now it's just... Confusing.

Mehrdad

#68
I had tools directory so i made "bin" and "sdkmanager.bat" : 
E:\Archive\Softwares\android-sdk-windows\android-sdk-windows\tools\bin

And the same message in AGS editor. Where is my wrong?
My official site: http://www.pershaland.com/

eri0o

Did you actually placed the sdkmanager.bat inside the bin directory? If you did that and still get the error then show me a screenshot of your preferences tab in the Editor because there's some missing information.

Crimson Wizard

#70
@eri0o,
QuoteI am relying on sdkmanager to update/verify installation of things

May these steps be simply considered optional and skipped with a warning?
If Mehrdad had apk created earlier, does not that mean that the building itself worked? Perhaps if sdkmanager is not present, or there's another problem with it, you may simply issue a warning and try continue with building?

My guess is, there may be other potential problems there, e.g. if your script wants to install things, that requires internet connection, if I understand right. What if there's no internet connection.

Maybe it's even worth adding a user preference which tells whether perform this step, as user may want to not connect to the internet or download anything while building the game.

eri0o

#71
This is what I suggested above.

Quote from: eri0o on Sat 26/02/2022 18:15:38
To be honest the best thing I can think of is to avoid any error checking in ags side at build time and rely in gradle to do it's thing. But it's error reporting is often cryptical. So maybe an option to avoid sanity checking.

The suggested fake bat script though should bypass the checking as I mentioned, if that works than adding the suggested checks as mentioned.

But full offline build is not possible, at least once Gradle has to connect and download the Java dependencies. Only after that such offline build would be possible. So instead of going for an offline check (e.g. gradle --offline %TASK%), a separate check is needed for complying with no sdkmanager.

Currently it uses the sdkmanager location to verify that the SDK is in place. So what needs to be done is:

- add a preference option that disables sanity checking, this is easily doable.
- figure a way to not use sdkmanager to check that the SDK is in place and separate dependency installation in some way. (this is harder and may take a while)
- add another preference for turning --offline flag in gradle on with a warning that at least once it needs to be run without such option to cache dependencies (we depend currently on androidx.core). This is easy to do too.

Maybe there's some way to pack the dependencies in a jar with the runtime so instead of getting the runtime as Java files get it as a jar library, but I don't know yet how to do that, when I tried it only packed the compiled Java files and the AGS native library files, not the androidx dependencies.

Mehrdad

#72
Quote from: eri0o on Mon 28/02/2022 17:39:08
Did you actually placed the sdkmanager.bat inside the bin directory? If you did that and still get the error then show me a screenshot of your preferences tab in the Editor because there's some missing information.

Yes I did
My official site: http://www.pershaland.com/

Potajito

Hey!
This looks amazing, congrats!

I managed to build without much hassle, and everything seems to work so far BUT speech. It just doesn't play. Other audio seems fine, and looking at the apk size, everything should be there.
May this be related to what Laura said some time ago?
QuoteAlso, an interesting side effect was that in the compiled Windows version, frame-linked sounds were not playing at all. I don't know what this has to do with the changes introduced for the Android build, but I can confirm that when I compiled and ran my game with the "vanilla" AGS 3.6.0.17 Alpha 18 build, those sounds played correctly.

I don't have frame linked sounds, so I can't check that one. I'm using latest one, AGS Editor .NET (Build 3.6.0.19) ** BETA VERSION **
Cheers!

eri0o

#74
Hey, I will remove the downloads from this topic, please use the new AGS 3.6.0 releases - a new one should be available soon. I will check the speech anyhow to see if there's something missing.

Curiousity, if you go into your Compiled/Android directory, is there a speech.vox somewhere there? Probably like Compiled/Android/mygame/app/src/main/assets/speech.vox or similar?

Potajito

Quote from: eri0o on Mon 14/03/2022 16:41:46
Hey, I will remove the downloads from this topic, please use the new AGS 3.6.0 releases - a new one should be available soon. I will check the speech anyhow to see if there's something missing.

Curiousity, if you go into your Compiled/Android directory, is there a speech.vox somewhere there? Probably like Compiled/Android/mygame/app/src/main/assets/speech.vox or similar?
Yep, it's there!

eri0o

#76
Hey, I reproduce... Sorta, I don't have ANY sound... Trying to figure out what's going on here.

Edit: ok, found the bug, trying to understand how to fix it

Edit2: for now, I noted down the bug here: https://github.com/adventuregamestudio/ags/issues/1577

I am still looking into this.

Edit3: found what is wrong

Edit4: making a small fix just to see it fixes on your end too.

eri0o

@Potajito Here's an editor that has this bug adjusted in the android package, it should work if you try:

AGS-3.6.0.20-Alpha21-AndroidVoxFix.exe | AGS-3.6.0.20-Alpha21-AndroidVoxFix.zip

I don't know yet the proper way to fix it, will need to think a bit.

eri0o

#78
Hey, this issue with vox packages will be fixed in the next 3.6.0 release. :)

Edit: new release appeared: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59842.0

Crimson Wizard

Quote from: eri0o on Fri 18/03/2022 11:34:18
Hey, this issue with vox packages will be fixed in the next 3.6.0 release. :)

Temp build may be downloaded here for a test: https://cirrus-ci.com/task/5385155433988096

AndreasBlack

Is this tutorial still the method to build for android in the latest AGS beta? I'm trying to make it work, but i get a failure when setting the folder for SDK. I'm probably missing some windows files or such. Windows 7 anything obvious i should have downloaded apart from android studio and all the sdk files? The Java JRE folder seems fine, but setting it to the C:\Users\Andreas\AppData\Local\Android\sdk throw's me an error: I've created a storekey using the dos prompt, i have no idea if that works either, since i get this error..

"can't find sdkmanager" it says..

Downloaded all the sdk libraries as in the tutorial, accepted the licenses unless i mispressed, but i don't think i did! Anyway to check? I've never used Android Studio. Do i need to create a sdkmanager.bat file in notepad or something? Clueless, sorry as always for being annoying  (laugh)

eri0o

Can you tell me exactly what Android Studio version you downloaded?

In the first post there's a FAQ, you need to follow the steps there to install the SDK.

Btw, I don't know if Android Studio works on Windows 7 since I never used it there and the OS is unsupported by MS, so there's that too.

Crimson Wizard

Quote from: eri0o on Sat 21/05/2022 01:12:18
Btw, I don't know if Android Studio works on Windows 7 since I never used it there and the OS is unsupported by MS, so there's that too.

It worked for me last time I tried.

AndreasBlack

#83
Quote from: eri0o on Sat 21/05/2022 01:12:18
Can you tell me exactly what Android Studio version you downloaded?


I've tried to follow your instructions. The link in the first step i've hit download on that one version! "Android Studio Chipmunk | 2021.2.1 for Windows 64-bit (929 MiB" Then i've downloaded inside the Android Studio all the SDK's i could see. Etc. Accepted the licenses, like i wrote before. So in my mind i've followed the steps, as good as i could. I got an error too btw while trying to create the keystore inside of AGS, so i had to follow a tutorial on google instead where i did it in the command prompt.  (roll)

martag

Hello, I was able to generate an APK, install it and run it on my Android. I have two questions>

1. Is this the same APK that potentially can go in the Google Store or is there another procedure for that?
2. Any tricks to remove the white arrow cursor?

I will also need to fix the portrait mode. I saw that you spoke about this in the chat, I will go through the previous messages of this conversation. Thanks in advance! ;-D

Crimson Wizard

Quote from: martag on Sun 22/05/2022 21:47:42
2. Any tricks to remove the white arrow cursor?

Is this arrow cursor a part of the game? in such case you may hide the cursor either using Mouse.Visible property, or switching cursor graphics with a transparent 1x1 sprite. This may be done under condition that the game is run on Android, for example:
Code: ags

function game_start() {
    if (System.OS == eOSAndroid) {
        Mouse.Visible = false;
    }
}

eri0o

#86
Quote from: martag on Sun 22/05/2022 21:47:42
1. Is this the same APK that potentially can go in the Google Store or is there another procedure for that?

@martag, APKs are not accepted in Google Play, you need to generate an AAB. On the AGS Editor, in General Settings, in the Android group select either AAB or AAB Embedded. Basically it goes like this:


  • If your game is up to 85 MB, you can select AAB Embedded - Game is delivered with Store generated APK.
  • If your game is bigger than that, you must select AAB - Game is delivered as an asset to the APK, it looks like APK for the player, but download works slightly different behind the scenes.

Your game top limit in size is 500MB for Google Play, so use sprite compression, reduce audio quality and overall try to stay below 500MB. There's no easy way to go to sizes bigger than this right now in Google Play using AGS Engine. AABs are not easy to test locally currently, there's a command line tool from Google, but it can only work with AAB Embedded.

Google ups the SDK API target limit around every six to twelve months, I usually keep track of this, but if Google Play Console complains the API is too low we can up the version number easily.

AndreasBlack

#87
For those who might run into the same problem as me. Here's the solution, yes it might sound dumb at first, but hear me out. You have to go "computer, c: (if that's where yoru windows user directory is)

Mine is C:\Users\Andreas\AppData\Local\Android\Sdk

This is really odd behaviour, i'm just saying. Chosing the link by clicking directly on Andreas\appdata\local\android\sdk did not work. Perhaps it's like always. Unique bug cause my brain is strange!  (laugh) Or that's "wrong" of me. It's something about the pathfinding not working correctly that way i suppose, in my mind c:\users should be automatically "recognised". You need the "c:\users" and not just "\andreas\appdata". That's my best guess to why it didn't work before!

Edit: a Question. So my game is 320x200 and i used the "render sprites at screen resolution" option, but that seems to not be happening. When my character looks like quasimodo in the face, it's quite obvious somethings gone bad  (laugh) Am i missing something? Anti-alias sprites perhaps?



Crimson Wizard

#89
Quote from: AndreasBlack on Mon 23/05/2022 21:56:33
Edit: a Question. So my game is 320x200 and i used the "render sprites at screen resolution" option, but that seems to not be happening. When my character looks like quasimodo in the face, it's quite obvious somethings gone bad  (laugh) Am i missing something? Anti-alias sprites perhaps?

Please, could you be more specific, what is "not happening"? What do you expect, what happens in reality? Does "it" happen on desktop PC? How do you set the config on android?

eri0o

I began writing the manual entry for building for Android from AGS, hope to have it finished soon, hopefully it can help anyone using it - still trying to figure out the best order to approach each subject.

AndreasBlack

#91
Quote from: Crimson Wizard on Sat 28/05/2022 22:08:11


Please, could you be more specific, what is "not happening"? What do you expect, what happens in reality? Does "it" happen on desktop PC? How do you set the config on android?

I've just tried the latest AGS 3.6 beta 6, same issue.
For the PC Version Build (Built at the same time as the Android version) "Render Sprites at Screen Resolution" it works! But Android does not work.

When the characters scale they should somewhat still be in their "high resolution look" and not get pixelated and loose details. So "Render sprites at Screen Resolution" Again. No effect on the android build. At least not my Android build! I do get some warnings when building. Perhaps they are the cause. I have no idea! These are the warnings i get inside the dosprompt window.


Maybe the android port somehow misses the feature? Here's an example of how it looks. Clearly when the characters scale he turns ugly, when he shouldn't.

Edit: The photo is ofc screenshot from my Samsung Galaxy S7 running the latest build to show how it looks. Perhaps it's the phones fault. :-D

[imgzoom]https://i.imgur.com/EjAdTM6.jpg[/imgzoom]


Edit: Here's a normal link it doesn't show the error message fully on the board, so here it is (the error/warnings when building) in it's full detail: https://i.imgur.com/9NbZuXT.jpg



eri0o

Any chance you can hit Ctrl+v (it's under Keys, at the end of the key list after you hit back) or use I believe Debug(1,0) ? It could be you are using the software renderer instead of the hardware renderer. Also I don't think that option exists in android.cfg, so you need to set it in your game through scripting.

https://adventuregamestudio.github.io/ags-manual/System.html#systemrenderatscreenresolution

AndreasBlack

#93
Quote from: eri0o on Tue 31/05/2022 14:41:07
Any chance you can hit Ctrl+v (it's under Keys, at the end of the key list after you hit back) or use I believe Debug(1,0) ? It could be you are using the software renderer instead of the hardware renderer. Also I don't think that option exists in android.cfg, so you need to set it in your game through scripting.

https://adventuregamestudio.github.io/ags-manual/System.html#systemrenderatscreenresolution

Thanks will try your idea, maybe that's what's happening! I'm using Direct3d 9 in the Default Setup btw. I have to build the game again with debugging enabled to be able to do what you ask, i suppose. Will try later and edit this post the result.

Oh, and btw pushing the back button and trying to enter a password aka using the text parser throw's me an error and game crash. I believe the error probably has to do with that i use an ä letter, not sure tho.

Edit: Just to make sure. It's the android build i'm discussing only here!

eri0o

AGS should use OGL if you specified D3D and it doesn't find it (there's no D3D in Android). So it's probably the setting itself, please try setting it like at game_start and see if it solves your problem. You can also later make a GUI in your game to config to let the player configure if sprites should be rendered at screen resolution or not if you feel the need to do so.

Code: ags
System.RenderAtScreenResolution = true;


About the keyboard input, can you tell me how you are receiving the player keys? Like, is it a custom Gui and label with on_key_press, is it a textbox, are you using Game.InputBox, ... What's the way you are acquiring the keys? When I tested this before it was working but maybe something got broken or there's some specific character I did not test...

AndreasBlack

#95
Quote from: eri0o on Tue 31/05/2022 16:13:59
AGS should use OGL if you specified D3D and it doesn't find it (there's no D3D in Android). So it's probably the setting itself, please try setting it like at game_start and see if it solves your problem. You can also later make a GUI in your game to config to let the player configure if sprites should be rendered at screen resolution or not if you feel the need to do so.

Code: ags
System.RenderAtScreenResolution = true;


About the keyboard input, can you tell me how you are receiving the player keys? Like, is it a custom Gui and label with on_key_press, is it a textbox, are you using Game.InputBox, ... What's the way you are acquiring the keys? When I tested this before it was working but maybe something got broken or there's some specific character I did not test...


Edit 2: The code you've wrote did nothing it's still Software Rendering. But did you see my warning messages in the screenshot posted previously? Perhaps they are the cause, i don't know. You might know!

Turns out, it's not the choice of D3D that's causing it. I've changed to Open-GL and ctrl+v clearly shows software renderer like you've said before. So now we know that!
The error message is regarding the "ätbajs". I have other parser answer alternatives too, but even if i write any of those answers they still give me the error and the app is crashing. and Btw just to give you even more headaches, there seems to be an issue with trying to reinstall the app. I've tried several times now. Un-installed the previous game, downloaded the new app with Open-GL in the settings this time obviously into the phone, etc. And it says program wasn't installed and i click "done" and can't seem to install it again, yes, it's uninstalled, re-booted the phone, i've tried the re-upload the apk to google drive, gonna try again ofc, but it happened before, so it's not a one time thing, unfortunaly. Any idea why this is happening? Now i've turned off the phone, see if that helps.. 

Code: ags

function cmdbox_OnActivate(GUIControl *control)
{cmdbox.Visible = false;


    Wait(1);
    Parser.ParseText  (cmdbox.Text);
    String badword = Parser.SaidUnknownWord();
    
    
    
    if (badword !=null)  

  {

   player.SayAt(110, 75, 100, "Wrong password");
   

   
   player.ChangeRoom(1, 506, 121);
   cmdbox.Text = (""); //rensa texten pÃ¥ GUi
    
}

    else if (Parser.Said("ätbajs")) 
{ 
player.ChangeRoom(4);

}

Crimson Wizard

#96
Quote from: AndreasBlack on Tue 31/05/2022 16:51:46
Edit 2: The code you've wrote did nothing it's still Software Rendering.

That code is not for changing renderer type, but "Render at screen resolution" setting. It is not supported by software renderer btw.
It's possible to test if renderer type is software or not using "System.HardwareAcceleration".

QuoteOh, and btw pushing the back button and trying to enter a password aka using the text parser throw's me an error and game crash. I believe the error probably has to do with that i use an ä letter, not sure tho.

Please tell, what error is that? Does it happen on desktop?

AndreasBlack

#97
Quote from: Crimson Wizard on Tue 31/05/2022 17:34:33

Please tell, what error is that? Does it happen on desktop?

It's funny you'd say that. Cause i've just tried that "System.HardwareAcceleration" that is, and yes, it's not showing. Just red it in the manual, ha ha! So what else could be causing it? Any ideas? Is it that my phone is the wrong Android for the build itself? I installed all sdk packages even Jelly Bean 4.1 or something like that, if that's got something to do with it? That my phone is the "wrong" android system. Like mine may not be 8.1, bla bla bla?

As for the question, i did write that it's only regarding Android, so nothing we are discussing now happens on the PC build, everything is working fine there! It's just the Android. It's basically stating that "Ã,,tbajs parser else if error" something along that line. Cause unfortunaly. The phone won't let me install the app again  8-0. So i've re-started the phone, turned off the phone, and if i'm lucky it will let me install again! I wonder what's causing this. I know sometimes it shows "install unknown source" and i've ofc clicked yes there to install, but i'm not getting any such messages it just says "The app has not installed" and i have one choice which is to tap "done".  (roll)

Edit: Moved the downloaded APK to an SDcard in the phone, that worked, random luck, i suppose. The error message is as follows: Error: Said: supplied word 'tbajs' is not in the dictionary or is an ignored word Text %)*bajs"

I can't do the exact symbal that shows up before "bajs".
so it's obvious to me that it probably has to do with the letter Ã,, being in usage in the word itself. But it's funny. Because i actually wrote another else if answer which was not "ätbajs". So it's a bit of a weird error, i think.
And again, just to be clear. This all works in the PC Build.

Mareike

Hi,
it is great that you can build your AGS game for Android, unfortunatelly it looks like I have a compatibility problem somewhere. I checked the compatibility table for Java and Gradle but I still cannot compile my game for android.
It would be really great if someone has a hint for solving this issue.

Best
Mareike


-----------------------------------------------------------------
My Output:
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\xxx\Documents\PaC\xxx\Compiled\Android\mygame\settings.gradle' (C:\Users\xxx\.gradle\caches\7.5\scripts\2so6athllb9um441ymy4k1vxd).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Drücken Sie eine beliebige Taste . . .



--------------------------------------------------------------------------------
My Versions:
java version "20.0.2" 2023-07-18
Java(TM) SE Runtime Environment (build 20.0.2+9-78)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)


------------------------------------------------------------
Gradle 8.1.1
------------------------------------------------------------

Build time:   2023-04-21 12:31:26 UTC
Revision:     1cf537a851c635c364a4214885f8b9798051175b

Kotlin:       1.8.10
Groovy:       3.0.15
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          20.0.2 (Oracle Corporation 20.0.2+9-78)
OS:           Windows 10 10.0 amd64

--------------------------------------------------------------
AGS Editor .NET (Build 3.6.0.48)
v3.6.0, May 2023
Copyright © 2006-2011 Chris Jones and 2011-2023 others.
See the Licenses folder for copyrights of used libraries.
DockPanel Suite © 2007 Weifen Luo
irrKlang © 2001-2018 Nikolaus Gebhardt / Ambiera
Magick.NET © 2013-2019 Dirk Lemstra
Newtonsoft JSON.NET © 2007 James Newton-King
Scintilla © 1998-2003 Neil Hodgson
System: Windows 10

eri0o

#99
The Android Build can only work with Android Studio, as written in the manual. Which Android Studio are you using?

I also always recommend using the latest AGS (3.6.1.8) and latest Android Studio - use the JetBrains Toolbox to follow the Android Studio releases and easily upgrade. This is because Google Play Store has strict requirements for what version of the API you are targeting and how you build - and following up includes upgrading other things like SDL and keep compatibility in AGS engine with newer android versions. So if you are using an older version of the engine, even if it builds, you won't be able to release. We are using Gradle 8.3 currently which is compatible with the latest Android Studio - and near future upgrades.

I see your error reports a previous Gradle version, and one possible issue is that version isn't compatible with java 20 - I can't tell if you installed it manually or not. In any case I recommend using the java from Android Studio and not a manually installed version. Unfortunately there isn't much we can do regarding the build environment with Google using Google Play to keep upgrades going - we do try to keep it working in older Android versions, as long it's supported by the newer tooling, I believe it should work from Android 5 to 14.

Mareike

 :smiley:
Thanks a lot! It was the AGS version that was not compatible. Now I am also using Build 3.6.1.8 and it works.

To complete it the Android Studio Version:

Android Studio Giraffe | 2022.3.1
Build #AI-223.8836.35.2231.10406996, built on June 29, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false


Mareike

Hi

I tried to install my APK (see previous messages) on Android Devices. Both devices I have tested install the software without an error but when starting I receive the error message:

"AGSNative
Loading game failed with error:
Main game file not found or could not be opened.
Filename: ac2game.dta..

The game files may be incomplete, corrupt or from unsupported version of AGS."

I tried it also with a new generated template game. With the same result.

Therefore, I expect it is either another compatibility problem or I need to copy another file or need another software I haven't found in the documentary.

Gerät 1: Androidversion 13 TKQ1.221013.002
Gerät 2: Android-Version 7.0

Best
Mareike

SMF spam blocked by CleanTalk