Hi !
I’m working on a “hack and slash” game and I’ve started the creation of a basic “zombie” AI with some rules like " zombies prefer to go forward, but are still attracted by a “rally point” so they don’t end up everywhere. they only move to where they can see, so they don’t go around corners therefore breaking the first rule, etc… "
Everything is working fine, but I’ve been testing how many AI I can put in a scene and I’m a bit disappointed by the performance I get…
With nothing else going one then the Sight Perception Sensing ( I replaced the entire Behavior Tree with a wait node and removed everything that could take processing time ), I can barely get a hundred AI in the map.
It struggle to keep 60 FPS ( I’ve been trying in standalone game )
It’s a little frustrating considering the Sight perception sensing isn’t that much complicated… 99% of the actors in the map shouldn’t even be considered when trying to find something ( in my case )… I have an empty map with a hundred AI and a single player and I can’t keep up the beat with two overclocked i7 dual-core processors running at 4.6Ghz!
So, I’ve been looking for a while for magic parameters, or something basic like an array of actors to consider instead of looking at everyone… Maybe even a “speed” at which the perception system do it’s calculation ? I don’t mind if a stupid zombie take multiple seconds to see me…
The only thing I found is a “AIPerceptionSystem” parameter in the project setting, but I can’t create a new blueprint based on the one that is already in it ( correct me if I’m wrong here… )
Here is a test I did :
In the second picture, there were even 33 more “AI” ( without the AI controller ) ( well they attacked me in the first test when they were activate, I had to kill some… )
There is a difference of 10.6ms per frame between the two test. On a 16.6ms max for 60FPS, that’s nearly 64% of the processing time available in a single frame taken by the AIController ( and most probably by the AIPerception system ( well correct me again if I’m wrong ) ). I even suppose the process time without the AI is a lot lower and was “capped” around 60 FPS…
I don’t mind if it takes 10 or even 20ms, if I can split it on every AI, once in a second instead of ( from what I can see ) doing it over and over again everyone at the same time…
So my questions are :
- Can I have more information on how the perception system “find” actors ? Is everything I said wrong ?
- is there a way to feed it with a custom list of actors ( that, in my case, would only contain the players ) ?
- can I control at which speed the perception system try to find valid actors, or somewhat lower the impact it have on the system ?
- Is is possible to override the current perception system ( entirely ), or override the way it is looking for actor in the map, etc…
- Is it possible to specify an actor class ? The zombie is different class then the player. Currently, the “AIPerception” component seems to always yield everyone in the sight or the zombie. I would suppose that is a useless overhead
- Other than making my own detection system, which I am most likely to do, what other solution is there ? What could give me more performance ?
Thanks all !