Hello,
We are developing a train simulator with passenger exchange at stations.
Context:
- Unreal Engine 5.6.1
- World Partition with Level Streaming for a large open-world environment (10km x 6km)
- AI Gameplay system for entity behaviors
- RuntimeGeneration = Dynamic
- NavMesh pathfinding with CrowdFollowingComponent
Use Case: Passengers need to navigate between platforms and train interiors when trains stop at stations. Platforms may be narrow (approximately 3m wide) with obstacles such as shelters.
To manage train boarding, we implemented Clusters - designated areas with waypoints where AI agents are assigned specific positions to approach train doors. However, we are experiencing frequent pathfinding failures where AI agents cannot reach their assigned waypoints (see attached video).
Could the pathfinding failures be related to NavMesh tile resolution or CrowdFollowingComponent configuration?
Any guidance would be greatly appreciated.
Thank you,
[Attachment Removed]
It looks as if the path is blocked by all of the other pawns that have reached their destination, but the lateral separation is not large enough to move around the edge of the platform. You could try adjusting the AvoidanceQuality enum for the CrowdFollowingComponent, but it really increases the samples used for DetourCrowd which you already have done with the changes to the config. Have you tried loweing the Side Bias weight so that possible points around the crowd are not so heavily penalized?
I am going to seem like a noob, but I am not familiar with the last screenshot in your post for the avoidance config profiles. Is this something you have added or another plugin? It appears to be some of the fields from the CrowdFollowingComponent, but I do not know where that is in the editor.
A solution we used for something similar in City Sample was a wait slot reservation system so the closer wait slots to the goal (the train doors in your project and crosswalks in CitySample) are chosen first. City Sample is done in Mass, but I believe you could get similar results using the Smart Object system with Actors.
-James
[Attachment Removed]
Yes, the last screenshot shows a configuration variable for the CrowdFollowingComponent. We provide this configuration when creating or reusing our AIs.
Concerning lateral bias, setting it to 0.1 or 0.3 seems to improve AI movement. I’ve worked hard to fully understand the crowd configuration. It’s a bit more functional now, but the same problem persists.
Sometimes, the AI stops without reaching its destination. I’ve looked for solutions to this problem, and it turns out that the MoveTo task completes with the “Goal Reached” state set to “true,” but the AI doesn’t actually reach its destination.
Here’s more information about our AIs. I’ve adjusted the CrowdAvoidanceQuality configuration :
- We have two distinct AI “groups”: passengers and pedestrians. For better control, I configured the passenger AI to use ECrowdAvoidanceQuality::Low and the pedestrian AI to use ECrowdAvoidanceQuality::Medium. This allows me to apply specific avoidance parameters only to certain types of AI.
- I also added that when the AI moves, its ECrowdSimulationState changes to ECrowdSimulationState::Enabled, and when it stops, it reverts to ECrowdSimulationState::ObstacleOnly.
- We override the AIContoller::OnMoveCompleted() and AIContoller::StopMovement() methods to indicate that our AI is in ECrowdSimulationState::ObstacleOnly mode.
- We override `MoveTo(const FAIMoveRequest & MoveRequest, FNavPathSharedPtr* OutPath)` to indicate that our AI is in `ECrowdSimulationState::Enabled` mode.
Here are two videos with fairly similar configurations where we find all the problems encountered:
- The AIs stop before completing their MoveTo and are considered to have successfully completed their MoveTo.
- The AIs often try to reach their waypoint instead of going directly to their final destination.
- Sometimes the AIs completely leave the NavMesh.
Thank you,
[Attachment Removed]
This is where some of the limitations of the avoidance system show up. It is also one of the main things we aim to solve using MassAvoidance for crowds. It has an idea of both standing and moving avoidance. We used it to power The Witcher 4 demo and even used it for Actors where the pathfind and avoidance were done in Mass and updating movement and pathing information to Mover. It may be a big change for you, but it is where we are looking for the future of avoidance in the engine.
Otherwise, you could create some of your own functions to start a new pathfind if an agent has not moved a certain distance within so many frames or time. It would be possible to automate this with having the agents become dynamic obstacles when they reach their destination, but that causes a navmesh rebuild/update which will invalidate any paths that are going through the affected tile.
The MoveTo task returning true without reaching the destination is not something I would expect to see. Did it end from a partial path? Did the Detour system mark it as blocked?
-James
[Attachment Removed]