Sunday, December 11, 2022
HomeGame DevelopmentOne Large sprite sheet or smaller particular person sheets? - cocos2d-x

One Large sprite sheet or smaller particular person sheets? – cocos2d-x


Hello there,
Fast query. Is there any advantage of placing all sprites in a single sheet. For example the idle, the stroll, the run, the bounce, the dying, and many others… In a single massive picture and it’s corresponding one knowledge .xml/json file?
Or have a smaller particular person ones: walkSheet.png and walkSheet.json, run sheet.png and runSheet.json and many others…
Any profit from a efficiency standpoint or it simply s matter of desire?

Thanks


Put as a lot as you’ll be able to on a single sprite sheet. If all the things can match on a single sprite sheet, then that might imply a single draw name from CPU to the GPU; principally, no want for the CPU to waste time transferring knowledge throughout to the GPU. The extra draw calls you have got, the extra time you waste, and the decrease your body price, though it’s possible you’ll not discover this until you’re switching out massive textures or loads of them.

Within the instance you gave, with idle, stroll, run and many others., you’d wish to change out and in of the completely different animations in a short time, so to keep away from should continually ship completely different knowledge to the GPU every time (that means extra draw calls), simply match all of them on a sprite sheet.

If I keep in mind accurately, all present GPUs assist a sprite sheet dimension of 2048×2048, and a few may even deal with 4096×4096 or bigger, however you would wish to detect this one way or the other and use the right set of sprite sheets if you will attempt to use something bigger than 2048×2048.

For those who do an online seek for the explanations to make use of sprite sheets, then I’m sure you’d have all the data you require about this matter. For example, the useful data right here.



2 Likes

Cool, thanks for the reply and the hyperlink.
I did a analysis earlier than asking right here, and I discovered blended opinions and a few have been in favor of many sprite sheets claiming that it’s extra related the workflow you apply.

The factor is that, say you have got 2 sprite sheets: the stroll and the run. Every comprises what ever variety of photos. Then you definitely parse every sheet solely as soon as to create the Animate object. So that you retailer in reminiscence the walkAnimate object and the runAnimate object. Having carried out that, that’s it proper? You’ll be able to neglect in regards to the sheet photos since you already extracted the animate objects you want within the sport. So you aren’t going backwards and forwards studying sprites sheets. It’s carried out as soon as.

In abstract, should you solely learn the sheets as soon as to retailer in reminiscence Animate objects, is there a distinction?

Thx

That’s not the way it works. The animation frames are sprites, and each sprite comprises a reference to the feel that it requires (or a slice of the larger sprite sheet texture).

Regardless of whether or not you’re utilizing a sprite sheet or particular person picture information, as soon as they’re loaded into reminiscence, they should stay there whereas something is referencing them.

I see. Thanks for the reason. I’ll give {that a} thought for positive.

cheers
R

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments