How can I optimize my spawned AI?

Currently I have the spawn AI function set up however when a large number of AI has spawned the framerate starts to drop significantly as there are a big number of AI controllers spawned. I was wondering if there is a way to use the spawn actor function and have just one AI controller running all of my AI?

With multiple character’s spawned it’s character movement and animation that’s dragging your CPU down, not AIControllers. Making all of your AI controlled by a single controller won’t help by itself.

Consider simplifying your animation and/or using simpler movement component. Also, if you have any AI blueprints make sure you don’t run it too often (implementing Tick is the single worst thing you can do here!).

Cheers,

–mieszko

Thank you very much, good to know :slight_smile:

@MieszkoZ
Hi Mieszko,
I am making a Myth style RTT game and I would like to have around 150 visible on screen characters.
For now when I’m spawning 72 characters the game is already below 60 fps (CPU bounded on ~5ghz processor).
I see that the bound comes from UCharacterMovementComponent.
My game is strictly single player - so I tried to set all the replications to false.
it didn’t give me a single fps :-).
I want to use RVO feature fir unit avoidance so it seems like I shall use UCharacterMovementController.

I tried to make an Offscreen optimization - I devided the characters in several groups and updated them (called tick) in distinct time.
(based on priority some movement components of characters are skipping tick functions - but accumulating the delta time so the movement distance won’t be affected) it helped a lot when some characters are not visible.

However I am interesting to have more visible characters than just 40-50.

Could you suggest something to try in order to meet my requirements ?