• Editor
  • Performance optimization tips pls?

Related Discussions
...

Hi guys,

Would you please share some tips to optimize performance when we create animations with Spine and/or when we use them in game frameworks? :rofl:

When creating animations: Fewer bones means less processing. Fewer keys means less processing. However, you generally don't want to sacrifice your animations to reduce the bones and keys because the processing is not all that much and is unlikely to be a bottleneck in your games. Remove any keys that aren't doing anything. Spine will likely remove unnecessary keys on export in the future.

In the runtime: Use a texture atlas to reduce texture binds. More info here. The most likely bottleneck on mobile devices is fill rate. On the desktop you probably won't have this issue. Fill rate is how many pixels you draw. It doesn't matter if the pixels are transparent, they still count against you. If you draw too many pixels, drawing will end up taking a lot of time and you may not have the frame rate you want. Because Spine animations are made of many images, you can eat up your fill rate quickly. So, try to reduce the size of your images. Eg, a sword is long and skinny and it would be wasteful to use a sword image where it is diagonal. Rotate the sword so you can use a smaller image.

Don't forget rule #1: Never optimize anything until you've identified what is a bottleneck, and then optimize only that. Faster than fast enough is a waste of time. In other words, if the user will never notice a difference, don't waste your time. 🙂 This also means if you are just starting a project, don't worry about things until you have an actual problem you need to fix.