Thursday, December 8, 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 good thing about placing all sprites in a single sheet. As an example the idle, the stroll, the run, the soar, the dying, and so forth… In a single massive picture and it’s corresponding one information .xml/json file?
Or have a smaller particular person ones: walkSheet.png and walkSheet.json, run sheet.png and runSheet.json and so forth…
Any profit from a efficiency viewpoint or it simply s matter of desire?

Thanks


Put as a lot as you may on a single sprite sheet. If the whole lot can match on a single sprite sheet, then that might imply a single draw name from CPU to the GPU; mainly, no want for the CPU to waste time transferring information throughout to the GPU. The extra draw calls you’ve, 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 giant textures or lots of them.

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

If I keep in mind appropriately, all present GPUs help a sprite sheet measurement of 2048×2048, and a few may even deal with 4096×4096 or bigger, however you would want to detect this in some way and use the right set of sprite sheets if you’re going to attempt to use something bigger than 2048×2048.

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



1 Like

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’ve 2 sprite sheets: the stroll and the run. Every accommodates 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 finished that, that’s it proper? You possibly can overlook concerning the sheet photos since you already extracted the animate objects you want within the sport. So you aren’t going forwards and backwards studying sprites sheets. It’s finished as soon as.

In abstract, in case 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 accommodates 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 certain.

cheers
R

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments