godot 4.2 scene drops to 20fps after adding more enemies
Started a small top-down shooter in Godot 4.2.1, everything was fine at 60fps with about 30 enemies. Added a wave of 150 and it tanks to 20fps on my laptop (GTX 1650, i5-9300H). Profiler says most time is in Scripting and Physics 2D. Each enemy is a CharacterBody2D with an AnimatedSprite2D, a CollisionShape2D, and a script that calls get_tree().get_nodes_in_group("player") every _physics_process to find the player. I know that lookup is dumb but is it really the whole problem? Also noticing the animation seems heavy. Should I be pooling these instead of queue_free and reinstantiate? Getting a bit lost on where to start.
4 replies