How can I get adjacent paths, or a "thick" path?

Say I have this path here:

But I want to get the paths immediately to the left and right of it:

These alternate paths should merge with the main path in narrow corridors, but should otherwise hug as closely as possible to the main path. What would be the most effective way to go about doing this? I tried out AlternativePath, but those paths seem to have a mind of their own and do not attempt to conform to the main path. Knowing how to do this with both a navmesh graph and point graph would be most helpful.

The reason why I’m looking to do this is for clumps of enemies. Currently when a group of enemies spawn, they all go single file because they’re all following the same path. It would be great to allow them to clump in more of a grid or a circle so that it looks more natural for that group to traverse terrain. However, I still want them to clump and not go wandering off that an AlternativePath modifier seemingly provides.

Hi

If you want group movement, one common thing done in many games is to designate a “leader” unit, and then make other units try to get to that leader’s estimated position in say 5-10 seconds + some offset relative to the group.

For example, here’s a screenshot from the Company of Heroes Squad Formations chapter in AI Game Programming Wisdom 4 book:
bild

With full 3d pathfinding, it would take a bit of additional work, but I think it might be doable.

  1. Create two lists of graphNodes, one for each offset path
  2. Go 5-10 nodes in, get the nearest node offset to the left or right based on the center node’s normal direction
  3. Pathfind to that nearest node, then take the result and add the graphNodes to the list
  4. Repeat until the path reaches the destination

Alternatively, I could just check the nearest node for every graphNode in the center path, and generate a new path based just on all those nearest node checks. I’ll have to check and see which method is more performant.

1 Like