very big number of individual animations for a single character, is 1 sprite sheet the best solution?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By panoramix

my project is going to have a lot of different animations for a player character, in 8 directions (isometric view), the sprite sheet png for the running animation alone is already 900 x 1200 (48 frames), my root node is a kinematicbody2d, children: sprite, animationplayer

the final version of the sprite sheet with all the animations could be around
10 000 x 2400 in dimensions, possibly 300+ of frames in this single sheet, can this be a problem? would it be better to create a separate sprite sheet for each of the animations in this case? (a sheet with 8 directions of running, another sheet with 8 directions of attacking, etc)

personally i would favor separate sheets, but if the engine has better performance with a single sheet (unless the sheet is ten thousand in dimensions?) i would choose that

if separate sheets, should i create a different sprite node for each of the sprite sheets? currently i am having trouble using two separate sheets for a single sprite node with the animation player

I think it is better to have separate sheets even when they would take more space in project. You propably don’t need to to think too deeply into it, because I doubt any SriteSheet creator program will actually let You construct such large single spritesheet. I don’t remember the limits though

Inces | 2022-01-17 22:01

thanks for the answers,

as i researched some more, i came upon some information hinting that godot internally cuts the large sprite sheet into smaller “frame images” depending on the frame width/height setup that i use for animation, thus as long as the image dimensions/size are accepted by godot, it should not matter, (i dont know how much truth there really is in this piece of information)

however, in my project, any animation is likely to be used in any particular level at any particular time so i found that having just 1 image with extra large dimensions is the simplest solution currently,

as i am planning to add a layer of clothing for the naked character, having multiple sheets would complicate it too much, this way i am able to have just 1 image for all naked character animations, another 1 image for a certain piece of clothing (that will be drawn on top of the naked character, the piece of clothing is drawn into every frame of the naked character, then combined into a sprite sheet identical to the naked character’s sheet, but with the naked character invisible), and so on

this way i can add as many pieces of clothing as i like without having to mess around with different sheets for different animations, at least that is how i see it as of now

thanks

panoramix | 2022-02-25 19:33

:bust_in_silhouette: Reply From: Rodeo

To address your question about performance, the only time is going to matter is when the scene is first being loaded from disk. During runtime, the image is already loaded, accessing it will take a constant time.

With that in mind, if there are animations that won’t be used in a particular level, it would be better in terms of memory to not load them. But if all your animations are in one image, you can’t selectively load them like that.

You should also know that graphics cards prefer images in dimensions that are powers of 2. I’m not sure of the reason for this, but it’s supposed to be better for memory consumption and maybe performance too. Most cards now can handle 8K textures (8192 pixels square), but more than that and you’ll run into issues at least on low-end hardware.