Ignoring penalties


I would like my AI to have two different movement styles;

  1. Optimal path: do normal pathfinding, respecting tags & node.penalty
  2. “As the crow flies”: respect tags BUT ignore penalties

Can I create a TraversalProvider to ignore node.penalties?


public static class DefaultITraversalProvider {
    public static bool CanTraverse (Path path, GraphNode node) {
        return DefaultITraversalProvider.CanTraverse(path, node);

    public static uint GetTraversalCost (Path path, GraphNode node) {
        // Ignore node.Penalty
        return path.GetTagPenalty((int)node.Tag); // + node.Penalty;
1 Like

Above and beyond, much obliged!

1 Like