Android apk and drawers

Please post anything related to the Hollywood APK Compiler here
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Android apk and drawers

Post by xabierpayet »

is possible include some drawers with some hundreds of files inside an apk in android? is possible compress and uncompress archives directly from a hollywood application? (in android)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Android apk and drawers

Post by airsoftsoftwair »

xabierpayet wrote:is possible include some drawers with some hundreds of files inside an apk in android?
No, only single files can currently be included directly as assets, not whole drawers.
is possible compress and uncompress archives directly from a hollywood application? (in android)
No, only single files using CompressFile() and DecompressFile().
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Android apk and drawers

Post by xabierpayet »

ok, maybe is interesting update the compressfile and decompressfile comands, download 1000´s of files is not a good idea
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Android apk and drawers

Post by airsoftsoftwair »

A plugin is planned for archive support.
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Android apk and drawers

Post by g0blin »

Hello guys,

I am currently porting my game to create an apk package and, after some experimenting, I'm finally getting some decent results.

However, since the project is rather complex, I have some issues to raise, hoping to find some work around.

1) I do appreciate the fact that the compiler can wrap "external" files to the package by using the "GetAsset" command. Nonetheless, despite the compiler GUI can link files coming from subdirectories (eg: C:\Users\Gianluca\Desktop\TSMC_And\Data\Stills\entry-credit03.tif), they need to be put in a single directory at executable level. What I mean is that the original code:

LoadBrush(503,"Data/Stills/entry-credit03.tif")

must now become:

LoadBrush(503,GetAsset("entry-credit03.tif"))

It is not a big deal, yet it forces to modify the entire original code, something that it is not error-safe in a project with over 40K lines of code.
I'll try to deal with that a little bit at the time, but I think it should be nice if in the future such a feature could be implemented, since I think it is easier to code a project where resources are grouped into meaningful drawer (Backgrounds, Sprites, Props, Sounds etc...) rather then putting all of them in a single one.

2) At present resouces can be linked to the code by using the "Assets" tab of the APK Compiler. I found no other way to do it than loading them one by one, since the "Add.." button accept only a single selection at the time. Again, the game holds hundres of resources divided in graphics and sounds, and it really takes forever (besides not being error free). Saving the project as ".acp" is sure a very good help (thanks guys, I really mean it) but again, I hope to see an improvement in the future for this matter as well.

3) Finally, the game needs to save and load progress and system data. How does this work on Android? I mean, how does the "GetAsset" command works in this case? Does it sport a behaviour similar to any other file-related instruction? In other words, can i transform these lines ....

If Exists("Saved_game/my_global_variables.bin") And Exists("Saved_game/world.bin")
p_LoadData()
........

in something like ....

If Exists(GetAsset("my_global_variables.bin")) And Exists(GetAsset("world.bin"))
p_LoadData()
......


Thanks for your time and thanks for making this possible.
Gianluca aka g0blin
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Android apk and drawers

Post by airsoftsoftwair »

g0blin wrote:1) I do appreciate the fact that the compiler can wrap "external" files to the package by using the "GetAsset" command. Nonetheless, despite the compiler GUI can link files coming from subdirectories (eg: C:\Users\Gianluca\Desktop\TSMC_And\Data\Stills\entry-credit03.tif), they need to be put in a single directory at executable level. What I mean is that the original code:

LoadBrush(503,"Data/Stills/entry-credit03.tif")

must now become:

LoadBrush(503,GetAsset("entry-credit03.tif"))

It is not a big deal, yet it forces to modify the entire original code, something that it is not error-safe in a project with over 40K lines of code.
I'll try to deal with that a little bit at the time, but I think it should be nice if in the future such a feature could be implemented, since I think it is easier to code a project where resources are grouped into meaningful drawer (Backgrounds, Sprites, Props, Sounds etc...) rather then putting all of them in a single one.

2) At present resouces can be linked to the code by using the "Assets" tab of the APK Compiler. I found no other way to do it than loading them one by one, since the "Add.." button accept only a single selection at the time. Again, the game holds hundres of resources divided in graphics and sounds, and it really takes forever (besides not being error free). Saving the project as ".acp" is sure a very good help (thanks guys, I really mean it) but again, I hope to see an improvement in the future for this matter as well.
Yes, you're right. For huge projects this is of course very cumbersome. I'll see if I can improve the APK Compiler to allow importing whole asset folders. This should make it much easier for you then.
3) Finally, the game needs to save and load progress and system data. How does this work on Android? I mean, how does the "GetAsset" command works in this case? Does it sport a behaviour similar to any other file-related instruction? In other words, can i transform these lines ....
I'd save data to the path returned by GetSystemInfo().Preferences.
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Android apk and drawers

Post by g0blin »

Thanks a lot mate,

you're the man!

The more I study Hollywood the more I like it!

Keep it up
Gianluca
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Android apk and drawers

Post by g0blin »

I just finished to adapt the original TSMC code to make it work with the Android compiler (usage of "GetAsset()" etc).

The code works just fine and the only "bugs" I had to correct were related to upper case/lower case syntax, due to the Unix nature of some part of the apk compiler.

In the interest of the community I'd like to report that, despite it being a huge project, I didn't encounter any particular issue. Even the save/load part of the code worked just out of the box, without any need to exploit the path returned by GetSystemInfo().Preferences.

Finally, game saves are preserved during app update.

What can I say? Thanks, Andreas!
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Android apk and drawers

Post by airsoftsoftwair »

Great, congratulations on your successful Android port!
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Android apk and drawers

Post by g0blin »

Ok guys, here I am again.

I finished the port, I thouroghly tested it on my devices an I was ready to upload it on Play Store.
Sadly ... I found out the max package size is 100MB, and my game is above 200MB!

Lowering graphics resolution and/or color depth is, unfortunately, not an option, so I need to find a work around.
According to Android Devs page there is the possibility to link the main app with so-called "expansion files" but, as far as I understand, it's something possible only if you are using Android Studio (and its APIs) to develop the software.

I searched Hollywood docs but I did not find constructs like "getExternalFileDirs()", "Manifest.permission.WRITE_EXTERNAL_STORAGE" and so on.

Suggestions, anyone?

Thanks for you time
Post Reply