I see recommendations to pack sprites as spritesheets and I have begun doing so. However I have some issues. The standard advice seems to be bigger is better. My tests have shown otherwise.
If I load a 1024x512 spritesheet with 6 character animation sets, each 72 frames, the app takes about 16\ seconds\ to\ load\ in\ emulator.
If\ I\ load\ 6\ spritesheets\ with\ 72\ frames\ each,\ for\ the\ same\ total\ frames\ in\ framecache,\ that\ load\ time\ becomes5 seconds.
When I tried putting the equipment and a couple more characters on the sheet, for a 1024x1024 sheet with about 3 times as many sprites as the 6 character sheet, the load time went over two minutes. Not twice, or 3 times, or even 6 times as long, but 8+ times as long.
This all suggests that any spritesheets not being used on batchnodes should be as SMALL as possible, with as few frames as possible.
If I take the bigger is better approach with spritesheets, my app is going to be unloadable long before I have a chance to care about performance during it running. If I tried to get all my sprites on one batchnode the load time would probably be at least 10 minutes given this pattern. Which means since everything can’t be on one batchnode the Z-layer issues come in to effect, so do I even want to use spritesheets at all for most things? or are they just going to increase load times?
BTW, I’m still on the old 0.9.1 at the moment, in case this is something that has changed.
I recommend you to do not load big resources from APK. It is very slow when APK includes too many files. When you load sprite that asset will be extracted from APK and this is pretty heavy job when APK is big sized.
So I keep APK simple and small, and download additional required assets from download server. And then modifiy resourcepath in Cocos2dxActivity.java to the path the downloaded assets exist.
I recommend you to do not load big resources from APK. It is very slow when APK includes too many files. When you load sprite that asset will be extracted from APK and this is pretty heavy job when APK is big sized.
So I keep APK simple and small, and download additional required assets from download server. And then modifiy resourcepath in Cocos2dxActivity.java to the path the downloaded assets exist.
Thank you for the reply. APK size is definitely a factor, however I seem to have a much faster time loading smaller images even when total file size is the same or larger. When I keep my images below 1024x1024 I get a much faster load time, even when loading the same total frames. I seem to be getting better results capping things at 1024x512 or less, both in emulator and on my device.
I understand that the fastest way to access images on Android is as drawables in the APK, but is there a way to access those in Cocos2d-x and not just the Java?
Also, could you point me towards any tutorials for making a download system like the one you described? I’m assuming this is handled in the Java?