Is it better to cut and store all sprites needed from a spritesheet in memory, or cut them out just-in-time?
Posted
by
xLite
on Game Development
See other posts from Game Development
or by xLite
Published on 2012-06-03T22:30:33Z
Indexed on
2012/06/03
22:48 UTC
Read the original article
Hit count: 233
sprites
|spritesheet
I'm not sure what's best practice here as I have little experience with this. Essentially what I am asking is...
if it's better to get your single PNG with all your different sprites on it for use in-game, cut out every sprite on startup and store them in memory, then access the already-cut-out sprite from memory quickly
or
Only have the single PNG with all the different sprites residing in memory, and when you need, for example, a tree. You cut out the tree from the PNG and then continue to use it as normal.
I imagine the former is more CPU friendly than the latter but less memory friendly, vice versa for the latter. I want to know what the norm is for game dev. This is a pixel based game using 2D art. Each PNG is actually an avatar's sprite sheet with each body part separated and then later joined to form the full body of the avatar.
© Game Development or respective owner