AI controller performance hit?

A lot of the functionality of AIController is hidden in the native cpp code. I’ve been testing how many AI i can add to my map before there is a noticeable performance drain and it seems i can get up to around 1000.

I imagine whatever code is calling SeePlayer() is somewhat expensive. Does anyone know what is happening with this logic? Is it running traces every tick?

Is there a way to reduce how often the AI ‘thinks’? Or any other way to tweak it to optimize performance?

Thanks in advance.

Are they crowd? If so then crowd doesn’t work in MP ( I seem to recall your game is MP ??) and if not I’d be surprised if a network game would not grind to a halt with around 250 AI + x players (then again there is a difference with numbers in a scene verse total numbers in game, this depends on how your game plays and how much code/conplexity you write in the AI’s controller).

Remember to consider the lower end spec PC’s you support + network bandwidth …

I’d assume seeplayer and hear noise etc simply work out distances between the event causer (e.g. player or noisemaker) and any others current location (e.g. an AI’s location). If its within range fire the event on the AI. I assume its not the AI looking for the player but the player notifying the AI that they are there through the event … maybe someone has delved deeper and knows.

Thanks for your response @Yummy-Vegetables. No they’re not crowd, and yes you’re right my game is multiplayer. I see very little control over the AI ‘thinking’ logic in the Unrealnscript AI controller.

Would love to hear some insight into this topic from someone who has peeked into the native cpp on AI controllers.

Was wondering why you’d need 1000+ AI in game (first person isn’t it)? Got an army of ants or similar attacking ?

Why not destroy the AI if not in the scene and respawn them as when required. I can understand in a MP game players could be all over the map (hence AI need to be spread out etc) but there must be ways you can limit the amount of AI required and spawned AI at any one time. I’d suggest going down the gameplay design route to look at how to find resource savings.

I have an open world in which various types of animals roam the landscape. I am creating AI behaviour whereby the animals feed, procreate, hunt, etc. Players can domesticate certain animal types and I have a whole system for animal husbandry.

Spawning/despawning animals based on player proximity will defeat what I’m going for with the game. Behaviour is somewhat procedural based on the needs of the animal at any given time. The AI animals are essentially playing their own survival game, and can thrive or die depending on the situations they encounter.

I didn’t say I needed 1000+ AI in the map, I was just outlining the benchmarking I’ve been playing with to see what the engine is capable of.

To be honest, I’ve been amazed by the number of AI the engine can support without any noticeable performance hit. I’ve implemented my own navigation system, which doesn’t rely on a nav mesh. This was required as players can build bases, so animals can negotiate terrain around player-placed structures.

I was simply curious about what is happening in the native cpp and seeing how far I could push it if I needed to.