Since Evil Google decided our charming little group is in fact a terrible gang of evil Sith lords bent on spam domination, I figured I'd continue this topic:
http://groups.google.com/group/cocos2d-iphone-discuss/browse_thread/thread/693de2fbaa0bfa42#
On these boards instead...
Now, in response to Steve:
------------------------------------------------------
What is 2Mb, the combined total of the files? If so, that is
irrelevant. What matters is the dimensions of your images, the bit
depth and how many you have. My guess is you really are running out
of memory and probably need to look at using sprite sheets to use
texture memory more optimally.
------------------------------------------------------
2 Mb is indeed the combined total of all the files. My game works now, after "tuning down" the quality of the sprites using the new features in 0.7.3:
[Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGB5A1];
But it's still using way too much memory. Now, I've been able to gather bits and pieces of information suggesting that using an AtlasSpriteManager, and storing my animations in a sprite sheet would be much more memory-friendly. Now, I've got a couple of questions which I'd be happy if someone could answer or link to relevant articles/wikipedia pages for (not just for me, but as future reference material).
1. Why is one 1024x1024 image more memory-friendly than ten 102x102 images?
2. What is the easiest way to convert a bunch of animation frames, stored as individual PNG's, to a sprite sheet on a Mac ?
3. Is there something further I should keep in mind when generating these sprite sheets, like the optimal size of the sheet? Should it be 1:1, rather than 1:2 in width/height ?
4. Say I have 10 frames measuring 187x140 in size and I line them up in a sprite sheet in five rows and two columns.
I create my sprite manager:
AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"ninja_dance.png" capacity:10];
I then create an AtlasSprite which would be the default state of my player character: (not 100% sure this is correct)
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(x,y,187,140) spriteManager:mgr];
Now, how do I go about adding the rest of the frames to an AtlasAnimation and how do I activate the animation itself? Does it work like the regular Animation class or do I have to keep something special in mind when using it ?
I know I'm asking for a lot but I think there are lots of new developers pondering the same questions and hopefully the answers in this topic will answer the questions of many people, myself just being one of them.
Best regards,
Nicke.