iOS 9 On Demand Resources Feature Help?

iOS 9 On Demand Resources Feature Help?
0.0 0

#1

Hi,

I Want to implement iOS 9 On Demand Resource. I know Asset Manager and have successfully implemented it also.

Here is the scenario and why i am specifically looking for OnDemandResources or ODR. When i implemented Asset Manager and put the downloadable content on Server it was around 100 MB. My Client told i am not interested on Managing a server and its downtime. Its a head-ache & cost is also involved.

So better approach is to put it on Apple server through ODR. my game is a kids based game and it has 40+ mini games.
So ipa size is greater than 100 mb and i have to bring it down to 60-70 mb.

I started coding it in Objective-C but i am not good at it and facing a lot more trouble. If any one implemented it before and point me in right direction then i am ready to pay also for code or time.

I have already read all these threads or similar one, then only i am asking for it.

Thanks
PS : I am tagging some of the persons knowingly as i need quick help.
@slackmoehrle @stevetranby


#2

The only advice I can give is to follow the reply in that thread:

You’ll need some ObjC/Swift code to handle the resource download and management.
Then once you know the resource is loaded you can use the imageNamed: method to access the image file (and its data). I’d try the code given in that reply first. If that doesn’t work you’ll have to write some platform code to access the image data. If you want to use other formats beyond PNG you’ll have to again figure out the best way to open it. My guess would be you could use NSData and then pipe that into the Texture::initWithData c++ method.

You’ll also need to know how to handle writing platform code. With ObjC you can essentially just have a mixed .mm file, whereas with Swift you’ll probably need to have a bridging ObjC file to interface. I’d use ObjC for now. Check the source for the various platform code /platform/apple/ to check how this is handled if you’re not sure.

Sorry, that’s the best help since I’ve yet to use the platform-specific file hosting or slicing features since they increased to 100MB on iOS/Android/tvOS and on desktop Steam/Humber/itch.io/AppStore allow larger installs.


#3

That said, I’d also try just passing the asset’s name in its asset catalog after the resource has been downloaded.

// e.g. in swift, but only need `UIImage(named: "Green Star")` => ObjC
// https://code.tutsplus.com/tutorials/an-introduction-to-on-demand-resources-on-ios-and-tvos--cms-24929
// proj: https://github.com/tutsplus/iOS-OnDemandResources-StarterProject
// asset catalog contains image w/tag "Green Star"

// Access w/UIImage (see linked reply for extract into creating a Sprite)
UIImage* image = [UIImage imageNamed:@"Green Star"]; // e.g.

// Possibly you can try this ... but prob fail due to converts to absolute path
// you may need to modify cocos2d-x sources: 
// CCSprite, CCTexture, CCFileUtils-Apple.mm
Sprite::create("Green Star"); // or try Texture::create()