Hi,
I’m currently working on an RTS game as a hobby project. To move my units, I’m using the NavMesh, starting with something basic like agent.SetDestination(destination). However, my first problem arises because all selected units try to reach the same point and never settle down.
I also tried switching between NavMeshAgent and NavMeshObstacle with carving enabled, depending on whether the unit has been given a movement command or not. Here, I encountered the issue that the carved areas are quite large. I think I could fix this by scaling the units, but I feel this could quickly lead to problems if the entire NavMesh has to be recalculated every time a unit moves.
Next, I thought about controlling the movement of units by determining a target point near the actual destination for each unit, based on the center of all units. This works well as long as no enemy units are in the way.
Additionally, I would like the units to keep trying to reach the target point, even if it is blocked. If I give the move command and other units are in the way, the units should try to find a path around the obstructing units.
I’m wondering how Blizzard solved this in Warcraft 3 or Starcraft 2. What would be a reasonable approach to solve this problem? Every solution I’ve tried so far doesn’t feel quite right.
Thank you in advance for your help!