godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.94k stars 21.15k forks source link

Please add support export Godot Game to Android can with resource pck file. #27224

Closed lefay1982 closed 4 years ago

lefay1982 commented 5 years ago

Godot version: 3.1 stable

OS/device including version: Android, IOS

Issue description: Please add support export Godot Game to Android can with resource pck file, like windows export

myGame.exe
myGame.pck

godot can export project to pck file format , and can load pck by load_resource_pack(). Can Godot add a feature: export to Android apk with pck file one click?

akien-mga commented 5 years ago

To clarify, you ask for an export option that would give an .apk without the game data, and a .pck next to it that should be loaded at runtime by the APK, as done for desktop exports? I don't know if that's doable on Android given the limitations of the filesystem and installation process.

Calinou commented 5 years ago

What use cases do you have in mind for this? APK Expansion makes it possible to upload large applications to Google Play.

For the record, the PCK file is embedded in the APK (try opening it with an archive manager like 7-zip).

lefay1982 commented 5 years ago

@Calinou I want to pack my script and resource to one file. and can encrypt them. so someone hack to obtain it is very hard.

sprite-1 commented 5 years ago

@lefay1982 you can export the PCK directly using this button

image

Calinou commented 4 years ago

Closing, as exporting to Android already creates a PCK file. It just happens to be embedded inside the APK, so you don't see it on your filesystem directly.

Filippopotamus commented 4 years ago

This is a valid use case. We've cloned Godot source and modified the android export to allow godot to run as a view inside of an existing Android app. We compiled the godot .aar module and added it to our Android project and exported the .pck from godot to be consumed by our godot module. However, it is extremely slow to load (16 seconds to load assets), meanwhile an .apk exported directly from godot loads in 0.3 seconds. Why is that? I've decompiled the .apk and didn't see an .pck file inside, instead all of the resources were inside of the assets folder with project.binary in there.

Note that we did the same for iOS (changed ios export template, compiled godot into a .a static library in a way where godot can be loaded as a view inside of an existing ios app and loaded the project .pck file), and it loads almost instantly. So now we are trying to figure out why loading resources from a .pck on Android takes so long.

Calinou commented 4 years ago

@Filippopotamus If you need this feature, please open a proposal on the Godot proposals repository as this is where feature proposals are now tracked.

Edit: There are already proposals for this, see @bruvzg's comment.

Filippopotamus commented 4 years ago

@Calinou will do. In the meantime, off the top of your head, can you think of any reason why loading from .pck on android is so slow while on ios is basically instant? On android I am manually injecting --main-pack packfile.pck in the list of commandline args

bruvzg commented 4 years ago

There are opened proposals for the similar features: https://github.com/godotengine/godot-proposals/issues/946 and https://github.com/godotengine/godot-proposals/issues/947

Calinou commented 4 years ago

@Filippopotamus I don't know why exactly. Maybe it's extracting the PCK from the APK every time a file is loaded from the PCK's virtual filesystem? That seems quite unlikely still.

thanwah commented 4 years ago

Hi @Filippopotamus, I'm also interested in this use case and why you're seeing slow loading times. Do you mind linking to a pull request or some other diff of what you're trying so that I can try to investigate the performance issue? Thanks!

Filippopotamus commented 4 years ago

@thanwah sure thing. I've invited you to a GodotTest project repo as well as to a clone of Godot where I made some changes (which GodotTest uses)

divshekhar commented 7 months ago

Hi @Filippopotamus @thanwah, I also ran across the same problem. Would love to know how exactly are you able to run .pck in apk. Do you mind adding me as a contributor to your test project? Thanks!