# Crowd Manager – how to make ai separate/spread more?

**URL:** <https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579>\
**Category:** AI\
**Tags:** ai-navigation, detour-crowd-ai-cont, unreal-engine, UE4, Blueprint, question\
**Created:** [November 25, 2017, 5:09pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579 "2017-11-25T17:09:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [November 25, 2017, 5:09pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/1 "2017-11-25T17:09:33Z")

</div>

Hello

I have few ai characters and I’m trying to make them separated - not walking on same path/straight line. I’m changing **Separation Dir Clamp** with different values, but still I can’t get best result.

What other settings should I change and where I can find tutorial with basic settings for different situations?

Thank you++

This is sample with 4 AI

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/9/1/191e021fd0fbb2031af828c4921abfd1711e3292.jpeg)

This is best what I can achieve now - they all spawn in one place 2-3 seconds before this screen shoot. I need them spread much more if possible.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/6/f867523687b96a131a20c1bb3043f73a8399eda7.jpeg)

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [December 6, 2017, 8:37pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/2 "2017-12-06T20:37:54Z")

</div>

Bump 🙂  
Please, my ai can already shot, evade, look for supplies, take cover, crouch and even make espresso, but how to make crowd spread more???  
THX!

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [January 2, 2018, 12:20am UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/3 "2018-01-02T00:20:23Z")

</div>

C++ answer will help ?

---

<div class="post-metadata">

**Author:** ![xdeviloper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xdeviloper](https://forums.unrealengine.com/u/xdeviloper)\
**Post date:** [March 31, 2018, 3:31pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/4 "2018-03-31T15:31:28Z")

</div>

Yes, C++ answer will can help. Please help )

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [March 31, 2018, 4:36pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/5 "2018-03-31T16:36:52Z")

</div>

Hi. Sorry, I miss your comment. Any help appreciated! However, if this is open for blueprints I think here should be documentation for blueprints too.

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [March 31, 2018, 4:59pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/6 "2018-03-31T16:59:28Z")

</div>

It’s been a While…

Well there is a Separation Weight that is not exposed to BPs as far as I know…  
Separation Dir Clamp is ok - but it should come togethere with Separation Weight to make it more sensitive.  
Separation Dir Clamp is just a threshold value for DOT product value → to be considered as Vectors of the same direction.

```
void MYAICONTROLLER::SetAvoidanceQuality(ECrowdAvoidanceQuality::Type quality)
{
	UCrowdFollowingComponent* pathfol = Cast<UCrowdFollowingComponent>(GetPathFollowingComponent());
	if (pathfol)
	{
		pathfol->SetCrowdAvoidanceQuality(quality);

		pathfol->SetCrowdSeparationWeight(2, true);
		pathfol->SetCrowdSeparation(true, true);
	}
}
```

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [March 31, 2018, 5:24pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/7 "2018-03-31T17:24:14Z")

</div>

Thank you. All what I need I have in blueprints, maybe I will change project to C++, for now this is only reason - ai. I will try this solution, but waiting still for blueprint way. I know too, this is not exposed, weird…

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [April 2, 2018, 3:27am UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/8 "2018-04-02T03:27:56Z")

</div>

It would be really easy to add this C++ function.

Right-Click on content browser → Choose Create new C++ File → choose blueprint-library name it and create it.  
In the generated C++ header file add the following:

.h

```
//Includes to add
#include "DetourCrowdAIController.h" //Not sure about this one -> just in case.
#include "Navigation/CrowdFollowingComponent.h" 
//...
//Class declarations auto-generated...
//...
public:
    UFUNCTION(BlueprintCallable, Category = DetourCrowd)
    static void SetSeparationWeight(UCrowdFollowingComponent* inCrowdFolowingComponent, int32 inWeight);
//... Add anything you want
// don't forget to close the class declaration score with "};"

```

In .cpp file this implementation

```
void UYOURCLASSNAME::SetSeparationWeight(UCrowdFollowingComponent* inCrowdFolowingComponent, int32 inWeight)
{
    if(inCrowdFolowingComponent)
    {
         inCrowdFolowingComponent->SetCrowdSeparationWeight(inWeight, true);
         inCrowdFolowingComponent->SetCrowdSeparation(true, true); //Just in case it is not enabled.
    }
}

```

Save and Compile

Now you will have this Function available in your Blueprints.

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [April 2, 2018, 3:38am UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/9 "2018-04-02T03:38:35Z")

</div>

Also you mentioned:

> This is best what I can achieve now -  
> they all spawn in one place 2-3  
> seconds before this screen shoot. I  
> need them spread much more if  
> possible.

Why wouldn’t you spawn them not in one place?

Random navigable point in radius or something ?

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [April 2, 2018, 4:37pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/10 "2018-04-02T16:37:33Z")

</div>

Great! 🙂 Now I’m deep in landscape, I will add this asap - thank you a @ColdSteel48 lot!

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [April 3, 2018, 1:40pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/11 "2018-04-03T13:40:43Z")

</div>

You can take a look in to my answer → It would be the easiest way to integrate it to your project with as less affords possible.

Also I am not sure why people are so ANTI C++ → it is way faster and cleaner than blueprints.  
My project are about 90% C++ My blueprints are mostly inherit C++ classes to make visual adjustments and set some parameters/properties like textures/meshes etc…

I can not imagine how would I do it all in BPs even if we assume that BPs had no Limitations → it is an eye sore to manage Complex logic there - and a pain in the butt to maintain it.

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [April 3, 2018, 2:39pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/12 "2018-04-03T14:39:53Z")

</div>

Why no c++? I work on my game in Game Maker, code only. My friend persuaded me to try Unreal Engine, I have no c++ skills, so I start with blueprints only and it was never problem - doing things or analyse, my structure is clean. I should learn c++, I published my other software done in Delphi, Java and some php for web, but I never start C++ or just C any kind. After over year of daily work with blueprints I can cay, main reason to move to C++ is blueprints limitations in many ways, like this ai, but complex logic is no problem for me. I know, Game Maker script is not C++ but is code and I created in it my own world composition like system for open world and much more, as a single dev (code, idea, structure, level design, materials and more) I’m just trying to make things faster, of course I know, slogan **“in Unreal Engine you can do everything with blueprints only”** is a lie like a cake in Portal 😃

---

<div class="post-metadata">

**Author:** ![Vaheva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vaheva/32/963466_2.png) [@Vaheva](https://forums.unrealengine.com/u/Vaheva)\
**Post date:** [April 3, 2018, 2:42pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/13 "2018-04-03T14:42:46Z")

</div>

I not remember how I spawn them, for sure I can make any pattern for spawn crowd, like a circle etc just shortly after spawn, they gathering to close each other like on picture.

---

<div class="post-metadata">

**Author:** ![Starkium](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/starkium/32/1194588_2.png) [@Starkium](https://forums.unrealengine.com/u/Starkium)\
**Post date:** [June 30, 2019, 6:19pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/14 "2019-06-30T18:19:20Z")

</div>

I keep seeing you everywhere haha. SO I went ahead and added this node, problem is that the crowd controller crowd following component isn’t blueprint read write normally. Is there anyway to override that in the super?

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [June 30, 2019, 6:25pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/15 "2019-06-30T18:25:09Z")

</div>

No, you can make your own CrowdFollowingComponent subclass and add this to the character in its constructor and then just keep a pointer (read/write), or you can just get in from CPP GetPathFollowingComponent then cast it to CrowdFollowing.

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [June 30, 2019, 6:28pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/16 "2019-06-30T18:28:05Z")

</div>

I will have to warn you guys: Using detour with Separation will ignore NavMeshFilters.

---

<div class="post-metadata">

**Author:** ![Starkium](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/starkium/32/1194588_2.png) [@Starkium](https://forums.unrealengine.com/u/Starkium)\
**Post date:** [June 30, 2019, 7:37pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/17 "2019-06-30T19:37:55Z")

</div>

using second method ( in construction script in bp) editor crashes

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [June 30, 2019, 8:19pm UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/18 "2019-06-30T20:19:24Z")

</div>

Show you code, or dont use ConstructionScript try in BeginPlay - better yet to go with the first method. Anyway after some time you will get mad on UE4 and its pathetic AI system and will implement your own.

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [December 7, 2023, 12:43am UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/19 "2023-12-07T00:43:35Z")

</div>

this is easy to solve, there is a blueprint callable function GetPathFollowingComponent which can cast to crowd controller following component and then you can use that as the target for the new function…

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [December 7, 2023, 2:17am UTC](https://forums.unrealengine.com/t/crowd-manager-how-to-make-ai-separate-spread-more/410579/20 "2023-12-07T02:17:45Z")

</div>

I tried all of this, and it appears to make zero difference in my use case… they still avoid each other the same amount if I call the function or not, and I verified the functions were called…

edit\* I ended up just using RVO avoidance, works exactly as I want and better…
