I don't know how to optimize game

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

enter image description here

Yellow is scripts time in profiler
enter image description here

My script doesn’t add much frame time. My fps drops significantry (from 230 to 14) when I spawn 8 bots. All bots have 40 bones, 17 physical bones, animation tree. When I add bots my script doesn’t add much time, it’s usually under 1 ms summary for all my scripts, so I think godot AnimationTree and physics are extremily slow? What do I do? If I rewrite my whole game as a module, would I even get any boost or godot is just not compatible with type of game I’m making?
I tried disabling process and physics process, remove collisions for physical bones, and when I disable everythign so my bots just float in air withotu brain and logic - there is no fps drop, however enabling any part of script adds significant (~1ms) delay to frame, and I don’t think I can even optimize all that, there are just essential things like more blend in BlendTree2D for 2D movement animation, blend hand attack animation, manipulate ragdoll and stuff like that.

I have physical ragdoll based combat and GridMap https://www.youtube.com/watch?v=FZT0cyaixAk&feature=youtu.be

:bust_in_silhouette: Reply From: DaddyMonster

To put your mind at rest, I’ve got dozens of animations in my game and the fps holds up fine. There is no intrinsic problem with Godot here.

My guess would be that you’ve probably got a for / while loop that’s iterating like crazy every frame. Or maybe an animation that’s starting and stopping. Without seeing your code I can’t know.

You’ll fix this with commenting. So you disabled _process, _physics_process etc and the frame rate jumped. Add them back one at a time and and see which one has the issue. Once you’ve done this comment one section of code at a time within this until the fps jumps up. Just a process of elimination and you’ll find the culprit.

Don’t worry about Godot, it’s perfectly solid when it comes to animations.