sprites and memory

Hi

Could someone explain me how sprites consume memory? What factors are the most important during creation of sprites? Size of PNG file, number of frames, size of frame? What is the biggest allowed PNG sprite file? 1024x1024? What is the better solution: to create one big sprite with all animations or to create many smaller sprites and then group them in one animation?

Thanks in advance

barcin [import]uid: 12119 topic_id: 7044 reply_id: 307044[/import]

sprite is generally the name for a single static image (character etc) Sprite courtesy of wikia.nocookie.net

you combine a bunch of these into a spritesheet

you use a tool like Zwoptex to pack as many sprites into a small space as possible.

this means you are minimizing the amount of memory taken up by all of your sprites, as they can all be loaded onto the GPU in one texture. this also helps performance.

When the GPU needs to draw a sprite it is just taking a portion of the spritesheet already in memory and drawing that portion to screen. rather than having to free up some memory to put a new graphic on the GPU. therefore I believe it is best if related graphics (eg graphics for 1 level) are on the same spritesheet rather than spreading them across several. if you have different themed sections of your game, I would be tempted to put the different themes on different spritesheets (unless they *all* fit onto one of course)

that’s how i understand it anyway

maximum size i believe is 1024x1024 on iPhone and 2048x2048 on iPad… you’ll need to check these figures though

[import]uid: 6645 topic_id: 7044 reply_id: 24788[/import]