Crowd Simulation/AI in Unreal
I tried testing out the crowd simulation and artificial intelligence capabilities in Unreal Engine 4.
UE4 has several built-in AI controllers and I first tested out the default AI Controller and the Detour AI Controller.
I first tested the avoidence logic by colliding two groups of characters.
After these two tests, I noticed several challenges:
1. The default AI Controller manages to preserve the shape of the crowd, but only the characters on the outter edge can continue moving.
2. The Detour AI Controller can't preserve the shape of the crowd and has irratic movement when not neccessary.
Next, I tested the avoidence logic by colliding four groups of characters.
As shown above, the default AI Controller could not make any of the characters to reach its destination
To improve the crowd simulation, I made some modifications to the movement of the AI characters so they can break free when they can't move forward
In order to maintain the structure of the crowd but still have avoidence, I added a custom detour behavior to the existing crowd system.
I added a logic that makes the characters move in the direction of the Right Vector if the Velocity is below a certain number.
The results are still a little slow, but I was able to quickly prototype a crowd that maintains the structure while having detour.
Below is a test with the Unreal built-in Detour combined with my Custum Detour logic. The crowds in the example below can't maintain its structure, but is able to reach the destination point the fastest.