Please make DetourCrowds usable from Blueprints

I would like to use DetourCrowds instead of RVOAvoidance in my game, but since my game is a blueprint project, I’m not able to do this. In July (in another thread) @Lukasz Furman wrote “blueprint team is working on feature to replace native components”, so is there any update on this?

I have generally not found much info about DetourCrowds in UE4, so let me also just ask whether what I’m trying to achieve is even possible with DetourCrowds :wink:

My game is a real time strategy game, so there are many units (and also civilians). They should be able to just walk through each other, so no collision between the AIs itself.
Even if I would not need any avoidance at all, because they are just ignoring each other, I would like to use DetourCrowds so that AI actually try to move around other AIs. If an AI want’s to move to a certain location, and the “direct” way is blocked from another AI, it should try to find a different way, and if it is not a too great detour, it should walk that different way. I want to be able to set how much actually is okay. For example, if the direct distance to target through a small bottleneck (blocked by another AI) is 500 meters, but there is an alternative way which is not more than 1000 meters, the AI should use the alternative way, otherwise it should just run through the other AI.

Yesterday, or so, I’ve submitted a new AIController class, DetourCrowdAIController. This is a temporary solution for BP users not being able to change native components’ classes. So to enable detour crowds you need to use this controller (or one derived from it) to drive your AI. Let me know about issues you’ve encountered while using this.

However, regarding your use case:

If an AI want’s to move to a certain location, and the “direct” way is blocked from another AI, it should try to find a different way
Detour doesn’t do that and the only way you can currently get an effect like that is to have stationary AI punch holes in the navmesh to mark the area untraversable (I’m pretty sure there are threads here or in the forums describing how to do that).

And in general, from another thread, I remember you were talking about like 2000 AI agents. I’m not sure detour will be able to handle that, or any avoidance solution for that matter. To solve this you need a boids implementation, which we do have somewhere in our backlog, but we’re not going to start working on it this year.

Cheers,

–mieszko

Thanks for the DetourCrowdAIController! Sounds great.

you can currently get an effect like
that is to have stationary AI punch
holes in the navmesh

I think the problem with this is, that if there is no other way, the AI is just not moving at all, right? As I described in the first post the AI should just decide whether do walk through the other AI, or if available, use a different path. But the AI should always be able to reach its target, which I guess is not possible with a hole in the navmesh blocking the only path for reaching that target.

I just thought about a “simple” way of doing this: In a stream you said the navmesh internally is just using A* for the path. As far as I know A*, its searching for the path with the least “cost”, and the cost is depending on the lengh of path and the type of ground, so walking through a swamp is more “expensive” than walking on a street and stuff like that. Would it be possible to just set the cost of the location where a different AI is standing to something extremely high?

Would it be possible to just set the cost of the location where a different AI is standing to something extremely high?

Yes. I’ve oversimplified. The way to efficiently punch holes in the navmesh is by applying “areas” to it, and areas can have cost associated with them, from anything more than 0 to FLT_MAX. You can totally do that :slight_smile: