How can I get the AI to avoid each other (and the player)

They run into each other quite regularly, how can I make them pathfind around each other?

Thansk!

You can enable RVO Avoidance in Defaults tab of your Character blueprint (under Avoidance section). If your project is with C++, you can also try enabling Detour Crowds.

With RVO you can set weight (default 0.5) and consideration radius, so play with these values to achieve desired effect.

This question has been already asked couple of times. For example look at this recent thread: https://answers.unrealengine.com/questions/162429/enabling-detour-crowds.html

Cheers,

–mieszko

I’ve tried this and it doesn’t seem to have an affect on the interaction between the AI and Player Character. Was this only intended for AI?

That link seems to have changed to a advert page that breaks your back-button.

Quite an old comment but in case anybody else comes across this. This is covered in the comments in CrowdManager.h. But to repeat them here:

/*
 *  Actors that should be avoided, but are not being simulated by crowd (like players)
 *  should implement CrowdAgentInterface AND register/unregister themselves with crowd manager:
 *  
 *   UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
 *   if (CrowdManager)
 *   {
 *      CrowdManager->RegisterAgent(this);
 *   }
*/

Indeed, fortunately nowadays there are more tutorials on this: unreal detour crowds - Google Search

I just tried this but my ais are having trouble. They have started to avoid my character, but they are also getting stuck still and trying to squeeze past the player even when there is no room for them to pass.

For any unable to find the RVO Avoidance option, it’s actually inside the Character Movement component of your NPC.

334498-ue4-avoid.jpg

Turning it on is like magic! All of a sudden the AI just avoid each other and there doesn’t seem to be any performance impact. With 120 ai on scene, I’m getting a solid 55 FPS on a GTX 1080 with RVO on or off.
I also found I get better results with the default AI controller in 4.26 instead of the Detour Crowd (which seems broken now).

1 Like

Can confirm. Switching from Detour to regular AI fixed the issues I was experiencing