Reduce performance impact and quality of movement when far from player?

Is there an easy way to reduce the pathfinding load from agents far from the player? I’m using RichAI to handle movement.

Thinking that it matters less how nice it moves while no one can see it, I still want it to check paths to know if places are reachable and such. Is it worth swapping out the movement script to something cheaper? Any parameter changes that would give a big reduction in load?

Hi

First, check if this is actually a problem using the Unity profiler.

The RichAI cannot easily be optimized. You could possibly switch it out for an AILerp script together with a FunnelModifier. But it’s a lot of complexity for not an enormous amount of gain.

Thank you, I did some experiments running my game with 500 agents.

In the end, most of the issues were not caused by pathfinding. However, I cut the time spent on pathfinding by roughly 4. I set up my prefab so that it had RichAI, aiLerp, RVO Controller, and Funnel modifier. When it is far from the character, I have aiLerp and Funnel active. I have RichAI, RVO controller, and funnel activated when it is close by. This worked wonders in the tests that I have done.

1 Like