I have a game with waves, and every wave I spawn more and more enemies. When spawning a lot of enemies (about 50), my FPS drops a lot, it spawns every enemy BP and AI control with it. Is there a way to optimize this? thanks! <3
Optimize all the code… Get rid of every bit of bloat.
Translate to C++
Optimize your animation class as well. Potentially translate to C++ if need be.
Try to stagger the spawn process (not all at once), this should help with the frame rate.
Spawning & Destroying Actors is a performance hit in of its own. Especially so on complex actors such as Pawns, Vehicles, Projectiles etc.
Once you have your code, animations, materials, and textures optimized in your AI character you can jump to object pooling them vs spawning/destroying.
Level loads → Obj Pool spawns in the max number of AI characters needed → adds to pool.
Spawn wave pulls from the pool. As the enemy AI die, just return them to pool.
Once that process is optimized you should convert to C++ or at a minimum nativize.
Beyond this there isn’t much else that can be done other than reducing the impact the game world has on the client.