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.):

current results:

ideally(when they catch up to you):

The AI logic right now is is just moving to the player directly(Move To: Player(reference to actor) 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.)

I dunno if something like this works but BUMP? :D… :’(

I am still new to detour crowds but I ran across this in my research and I’ll share what I can.

From what I understand detour crowds is really good at handling avoidance while the AI is in motion but they don’t seem to do any sort of avoidance on other AI that is not moving. The way I handle moving multiple units around is by calculating relative positions which ends up creating a grid pattern.

For your needs you’d probably need some way to set slots around the player that the AI can claim or calculate relative positions around him. I don’t think detour crowds can do this but I would be pleasantly surprised if it could out of the box.

FVector newLocation;
FVector cellSize;

uint8 rows = FGenericPlatformMath::FloorToInt(FGenericPlatformMath::Sqrt(SelectedUnits.Num()));
uint8 middle = FGenericPlatformMath::FloorToInt(rows / 2);
uint8 idx = 0;

for (auto selected : SelectedUnits)
{
	uint8 row = FGenericPlatformMath::FloorToInt(idx / rows);
	uint8 col = (idx % rows);

	// We use the GridBoxCollision to allow sizing the distance between units in the blueprint editor.
	cellSize = selected->GridBoxCollision->GetScaledBoxExtent();

	// Caclulate position based on unit's index in selected units array.
	// TODO: Need to get location based on closest available position instead of using index.
	newLocation.X = Location.X + (row * cellSize.X);
	newLocation.Y = Location.Y + (col * cellSize.Y);
	newLocation.Z = Location.Z;

	selected->MoveToLocation(newLocation);

	idx++;
}