Download

Detour Crowd AI Controller Questions

Hey guys,

I’m currently trying to get my NPCs that normally flock to the player and get stuck on each other on the way to avoid each other as they move to the player character.
Ideally I’d like them to surround the character to entrap him but

Main Problem: I want them to avoid each other as they make their way to the player.(or downtown, walking fast, faces past, before they go homebound.)

Right now they get stuck on each other as they try to get to you(finding the same path and trying to get to that ideal path I suppose, or fighting for it.):

ideally(when they catch up to you):

The AI logic right now is:
ff2af77cacfd60148406303aa8700d2cb8028273.png

simply, the AI is just moving to the player directly once the player is found in their patrol.
and I figure it’s possibly this that needs editing but I also ran into Detour Crowd AI controller which sounds like it might have the results I’m looking for.

Questions:
What is the Detour Crowd AI Controller mostly used for?
What is the Crowd Manager tab in Project Settings mostly accounting for?
How does one implement the Detour Crowd AI properly?
What are some of the edits that are available to me on the blueprint side?(as per posting in blueprint.)

I have looked online for a few examples and I was forced to upgrade my project from 4.8 to 4.9 to get the blueprint editable version of Crowd Following Component, which I’m assuming takes or applies its information from the character movement component
wherever the AI is set to.(avoidance group, group to ignore, etc.) but do not know what else to apply to try and get a result that will have them avoid each other as they chase the player. I was hoping there was some input from the community or other that can help me move down the right direction or mindset.

I also program some of this project in C++ and have no qualms with moving this over to c++ implementation of Detour, any means necessary to get this to work!

Thank You,
Alex Batista

Bonus: I’d like for NPC’s to avoid each other as they move around in the world as well, and possibly some objects but that comes later.(some npc’s will get stuck behind objects trying to chase the player without finding the best path to them…figure it might be fixed with EQS, just rambling here.)

“How does one implement the Detour Crowd AI properly?”

Have you tried using RVO avoidance in Character Movement component. It makes the pawn move around objects better, including other pawns.

Yeah I’ve enabled it and messed around with the radius but I have little understanding on what the weight does to apply radius check or collision checks? It didn’t seem to help much is the reply, in fact it kinda made it worse cause when it was enabled they kinda pushed themselves around instead.

shame-filled Bump :’(

DetourCrowds is just an avoidance algo. What you do is make an AI Controller of a DetourCrowds class rather than the defalt kind and it will be enabled by default.

It works pretty well, but it’s not a silver bullet. Certainly better than RVO though since it seems to base its avoidance on direction of movement (i.e. enemies can’t force-field-push other enemies backward) and it also affects navigation movement in a useful way (i.e. enemies will rotate to a new movement direction rahee than just float-shoving sideways).

I see. I did reparent my AI Controller to have the DetourCrowds but I was unable to notice a difference in their bunching and moving. I was able to create the desired affect of my enemies surrounding the player with EQS and Behavior Tree manipulation. I figure that’s one of the ways to do it. They still bunch when they run after my player with no avoidance what so ever. I think it’s because I’m not utilizing the algorithm correctly. Maybe it doesn’t work when they’re in full motion like " Move to player" has a higher precedence over “Avoid each other.”

Thank you for your input :smiley: