Hello, I’m trying to create a 2D RTS game. There are around 300 Skeleton2D in the same scene. Each skeleton has around 9 bones with 9 sprite2D. I tested 300 Skeleton with only Idle animation, not running any code or physics, just stand there and show animation, but I only get 150 FPS on my high-end PC. That is a ridiculous number, because my PC can run many other high-graphic 3D games with at least 100 FPS, why does this simple 2D game with some Sprite2D get only 150 FPS? I think it will even get lower FPS on mobile devices, as I target my game for mobile devices. I tried to optimize with multimesh2D, reduce the number of nodes, reduce the number of animation trackers, reduce the number of Collisionshape2d from 3 to 1 for each skeleton, but I can not increase FPS to at least 200 FPS for 300 Skeleton2D. could anyone please suggest me how to optimize performance for this case? Thanks in advance
Skeletons are pretty expensive to calculate bone positions, you may get high framerate on AAA games because they use low-fps for distant animations. Or more advanced games will bake “Vertex Animation Textures” for crowds, looking up a texture is much faster than applying bone transforms on the CPU and especially on the GPU; but cannot use dynamic effects like looking at targets or any inverse kinematics.
I need every skeleton to animate on its own, so I can not use LOD or Vertex animation or treat them as crowds. because I planned to equip gear for each skeleton, so I can not use animation texture. Sorry to ask this in the Godot forum, but can Unity run better in my case?
Unity might run it better through multithreading, but that would only apply CPU side. Don’t know if they do transforms on DOTS but it seems plausible, probably not a standard optimization. This youtube video claims to be using DMotion for animations.
thank for your response. I will try to create a simple scene with 300 skeleton 2D with unity to test it performance and decide what game engine I should use.
I believe rendering 300 unique characters in the same scene is nearly impossible for any game engine. In RTS games, developers typically use instancing, and these games usually feature only 10 to 20 unique characters at most because rendering individual models is too computationally expensive. To optimize performance, it’s essential to use instancing, level-of-detail (LOD) techniques, and disable skeletal animations for distant characters. Additionally, there is a plugin for baking animations into textures—I can’t recall the name, but I think it’s VAT (Vertex Animation Textures).
thank for your response, but I can not use LOD as it is just a small battlefield and all skeleton must be in the same scene. I also need skeleton because I want to have gear mechanism for each skeleton so I can not use vertex animation. I made a test with unity, use the same skeleton model and animation. create random 900 skeleton. the final result is, godot run with 20 → 40 FPS and unity run with 130 → 160 fps. I have decided to change to unity. So sad, it took 6 months to make my game, and now I have to recreate everything from scratch. Today is my saddest day. Thank everyone for your kind response, I appreciate it
Unity says you are saving a ton by batching, are you sure you are testing without instancing correctly? Does this test include your unique gear system that would prevent instancing?
I have scml file for each character. for testing, I just imported a new scml file to both unity and godot, create an empty scene, write code to instantiate 900 skeleton randomly and run that scene. I don’t attach any code to the character for both godot and unity. Yes I already realized that unity are doing many batching when the fps go low. as I observed even if I increase number of skeleton from 500 to 900, FPS in unity still keeps around 130 -150 as it increases using threads and batching. but in godot, fps decrease instantly if I increase the number of skeletons, I don’t understand why. in godot, I have tried to use batching but not sure why it doesn’t work. even with multimeshinstance2d, I use mesh to reduce number of draw call. use one multimesh to draw for every sprite 2d for all characters in battlefield. in profiler the number of draw calls significantly reduced, but the FPS is still same, I think there is some problem with skeleton2D in godot even all sprite2d of skeleton are null, as I reset it when using multimesh