Hi everyone!!
Have patience with me please because I'm still quite a beginner with Spine and the Runtime.
I started studying and doing small exercises on ECS (DOTS) Architecture in Unity
Also I have a personal indie project I'm developing for mobile devices.
My game is a strategic that has some similarities to clash royale basically here you also summon units on a battlefield.
Eventually I came across the optimization problem that is having a lot of units.
If you can give me some directions on what could be for you the best approaches and if I'm missing some very useful techniques, I would very grateful.
Since each character is seen from a isometric type of camera, for each unit I have 3 different Skeleton data asset front-left, left and back-left the other mirrored direction are obtaining setting ScaleX.
As for the current stage of design I could expect to have, as an average max, 20/30 animated units "sampling" from 15/18 skeleton data asset. But since the game has the rogue-lite element and I expect to have units that could act like spawners for other units, I can expect emergent behavior from the player to bring the number of units to a certain number (I will probably limit it anyway) I can see reaching 100/200 of animated units.
I could avoid runtime Initialize() for the skeleton animation by having a list of skeleton data assets
attached to the same gameobject (one for each direction) and activate them just when needed:
- Unit G.Obj.
- SkeletonDir1
- SkeletonDir2
- SkeletonDir3
it means to have x3 RAM occupied, but even if it could still be feasible, then the problem that remains is the Update of the skeleton that happens each frame for each skeleton if I understand correctly (since it's a routine inside the PlayerLoop of Unity). It can escalte to high latency very quickly with a lot of units. I know there's Update when visible, but most of the units (70/80%) will always be visible.
I know there is a way to change the update rate, do you think that If I implemented a ECS logic of establishing when a major eye-catch moment is coming for the unit ( like a enemy is in the FOV, an ability triggers or an enemy spawned next to it ), to set the update rate of the spine animation back to 60 from like 30 or 15, I could save enough latency for making it feasible?
The other safest route I'm considering is exporting every animation as sprite sheets from Spine and using the data-oriented rendering system of ECS.