airsdk / ANE-PlayAssetDelivery

Play Asset Delivery ANE
2 stars 2 forks source link

[not issue] examples on how to integrate it with Starling's Asset Manager #1

Closed jimmymjing closed 2 years ago

jimmymjing commented 2 years ago

Hello, again I failed to find a proper place to ask this question.

Currently, my game is over 800 MB, so I have to use PAD in order to release it on Google Play. I use Starling's Asset Manager to load/unload dynamically in-need assets from the disk. I assume the AssetManger class has to be modified and add in Android Asset Pack Manager's functionalities. (just like Java's Resources class?) (I'm not an expert in Java so I maybe totally wrong).

Right now I'm a bit lost and don't know how to proceed. I thoroughly read the wiki page. I think it's easy to load in 1 single file from pad, but I need to recursively load/unload files from different directories (basically all the functionalities the AssetManger provided). And as the game targets both iOS and Android, I hope the assets could be handled for both platforms.

Could you please point me in the right direction on how to proceed, or maybe an example project? Thank you so much for your help in advance!

ajwfrost commented 2 years ago

Interesting idea - although if you wanted to load assets from Play Asset Delivery packs then there would be some changes needed in some of this framework... and one challenge as you mention above is keeping it platform-agnostic when you want to have the same code on Android and on iOS.

The thing we found a little odd about Play Asset Delivery was that an "install-time" asset pack has files that have to be accessed via a different API from the fast-follow or on-demand packs: https://developer.android.com/guide/playcore/asset-delivery/integrate-java#integrate-play-core As the flow diagram shows, if you use the later versions, you can just get a path to where the files have been installed, and you can then access them via normal file system APIs. But for install-time you need to use the (Android/Java) AssetManager API which doesn't seem to be backed up by any sort of URL/path-based access mechanism: https://developer.android.com/reference/android/content/res/AssetManager

So it might be that you'd need to extend the Starling classes so that they can load in the data and extract it into the appropriate format (so e.g. a Texture file you could just do an PlayerAssetFile.loadBytes() and then upload this to a texture..) but it will need to be fairly customised according to this usage.. and on iOS, the whole lot would be different...

thanks