Does Apple thinning work on Cocod2d-x?

Does Apple thinning work on Cocod2d-x?
0.0 0



I’m an independent artist building children story apps for cocos2d-x. Currently we’re only on IOS, and I want to use the apple thinning feature but my programmer is having a hard time making it to work.

We have a combination of png, pvr.czz, jons and jpegs assets.

Apple thinning is a very important feature to us. If it is not supported by cocos2d-x that would suck, and unfortunately we would have to move and try something different.

Any help or guidance would be greatly appreciated.



iOS 9 On Demand Resources Feature Help?

And you already implemented app thinning with pvr.ccz using which engine?


Thanks for the response.

We are using Cocos2d-x and our apps are on IOS. We do have one on itunes store, but we are not using apple thinning. We want to use it. Now we have all the assets in one build. We combined, so iphones 6+ and ipad retina are using most of the same assets, but because it is a story book for children, designing for such different aspects ratios is complicated. That’s one of the reasons we want to use apple thinning so each device will just load the right assets.

Is that possible? or not an option to use cocos2d-x and apple thinning with per.ccz and jpegs background images.


I just asked, because I wonder if you get chance to use pvr.ccz with thinning. As I see it supports only png files when you assign them in Xcode. Then it will be packed and sliced for different devices.
However, I don’t think so that anybody tried this, because it’s too specific option and will require modifications to cocos2d-x code. I would like to be wrong, maybe some one can help, good luck.


Can you explain why App Thinning is this important to you? Can you explain your specific use case? I am also taking a read over this.


So by using apple thinning, when we deploy our app universally, people that download the iphone 5 version, will download the assets of the ipad pro as well. Our app it is a picture book, so we have a lot of background images, and it is a big compromise to use that many repetitive background with different ratios. With apple thinning, each device will access/download only the assets that we design for each asset.

I don’t understand why is not very popular or a simpler way to implement it. It seems that the problem may be the pvr.czz assets.


App thinning should be a separate thing from cocos2dx. It’s both an Xcode project settings and possibly, but shouldn’t need to, modify your loading directories/paths.


That’s what I think so. I’d think it is a pretty straight forward operation. But we are having problems loading the pvr images.

I’m trying to know if anybody has managed to do it before and use this feature with cocos2dx projects and pvr.ccz and jpg sets of images.

I can’t think I’m the only one in need of this feature in the whole cocos2dx community. I’m kind of lost here.


Most games that use cocos2dx don’t need more require more than 100MB (w/all archs), but App Thinning should be supported of course.

The obvious (me thinks) questions:
Are you using Asset Catalogs to store app thinning resources?
Have you been successful loading .png from an Asset Catalog in cocos2dx?
Have you been successful loading .jpg from an Asset Catalog in cocos2dx?
Have you been successful loading .pvr from an Asset Catalog in cocos2dx?
Are you trying to support App Slicing? (just curious)
Are you trying to support On-Demand Resources? (just curious)

I’ll prob take a look at this for a bit in a test app since I use Asset Catalogs in “regular” iOS apps, but have yet to try App Thinning (haven’t needed > 100MB yet in non-Unity-built games), but had fun trudging through the .apk expansion pack process a couple years back :frowning: .


@theflyingsquid ahhhh … Is cocos2dx supporting App Thinning feature in iOS 9? … I see it looks more like you haven’t tried yet, so you’re checking before having to learn it all yourself? It looks like someone figured it out over there, at least one method.


We’re just in need for app slicing, because at this point our apps are 180mb but without all the different device assets they could be under 100mb.


Actually we have tried that method on the thread you posted and somehow we can’t make it to work with our app. So I was wondering if my Programer is missing something or that method is not working anymore.

I’m an independent artist, making this project at this point out of passion and a programmer is helping me out.

Just wanted to confirm if is possible to do it. I don’t expect people to write the code for me, just guide me in the right direction. I wish I could know about programming but the only code I know is “If” “else” and “then”. I don’t think I can go very far with that. :slight_smile:

Thanks Steve for your response.


Hi Ivan. To my knowledge, cocos2d-x does not support Assets catalog (and so, the App thinning process won’t do much). You could, however, do a little programming to support it on iOS only: instead of loading images with the Sprite::create method, use [NSImage imageNamed: …]. That will search on the assets catalog and return the image. Then you will need to create a Sprite from that NSImage. Code will look like this:

	// search imageKey in assets catalog
	auto image = [UIImage imageNamed:@(imageKey)];

	// convert NSImage to Texture
	NSData* data = UIImagePNGRepresentation(image);
	auto length = [data length];
	unsigned char* buffer = (unsigned char*)malloc(length);
	[data getBytes:buffer length:length];
	auto img = new Image();
	img->initWithImageData(buffer, length);
	auto tex = new Texture2D();

	// create sprite		
	auto sprite = Sprite::createWithTexture(tex);

	// free buffers

I have also used assets catalogs with JPGs. For that, you need to set the Render As option to Original Image (in Xcode select the Image set and change the RenderAs option on the panel on the right). Haven’t tried with PVR, but I guess the same procedure should work too.

btw, the app thinning process is something done by the AppStore (it provides different “slices” of the app depending on the device is requesting it). cocos2d-x could provide support for reading images from assets catalogs, but Android builds will still be “downloaded in full” since there is no thinning process on other stores (Google, Amazon, …) as far as I know.

Hope that helps!

iOS 9 On Demand Resources Feature Help?

@kmaker, thanks for the info!

Another option would be to store the excess data on your own server (or Amazon S3, for example). The use the asset manifest and downloader classes. This is what many of the free to play games do.

While it would require user to download more data you could have the baseline resolution assets in the main install and then optionally download the higher-res art afterward and just have your code choose the higher one if available/exists and fallback to the regular assets bundled with the game’s .ipa/.apk


Thank you so much for for the help.

We’re going to try it out and see if that guides us to a successful apple thinning! :slight_smile:

I really appreciate it.


Also thank you very much for the time and your ideas.

My programer suggested this a few days ago. One of the issues with this approach is that our app is a children’s app for young children, and there are pretty strict regulations to comply when developing this kind of apps. I’m not sure if using this kind of technology complies with Coppa. I’ll do some research on that. But thanks anyway, it is good to know that at least that way definitively works.


Hello Everyone,
I have a little different problem… i dont want app thining or app slicing. I want to know about On Demand Resources. I am also developing children based app. We dont have different asset sets for different devices but have lots of mini games. What i want is if user or kid clicks on icon that mini game should get downloaded on Demand. Please Refer this link if i am not clear.

So do i have to do it natively on xcode side or i can do it through cocos2d-x or is there some easy way.


try assetmanager or downloader features in cocos2dx


I know asset Manager a little but what is downloader…


Asset Manager works Fine, but what i want is Initial Install tags. Which comes with ios 9 and later.

My Client mailed me these links.

He is having a valid point. What he wants is initial install tags. I searched on youtube but i didnt got any good video or reference. What i was getting was either swift or spriteKit examples but nothing on side of C++ or cocos2d-x.

Please just point me in the right direction. I want Initial install tags working, Apple app thining feature.