Function bfsMultiroomDistanceMap

  • Create a distance map for the given start positions, using a breadth-first search. This does not factor in terrain costs (treating anything less than 255 in the cost matrix as passable), so it's faster but less useful than Dijkstra's algorithm.

    This calculates a distance map across multiple rooms, with a few configurable limits:

    • maxTiles: The maximum number of tiles to explore.
    • maxRooms: The maximum number of rooms to explore.
    • maxRoomDistance: Don't explore rooms further (in Manhattan distance) than this.
    • maxTileDistance: Don't explore tiles further (in Chebyshev distance) than this.

    At least one of these limits must be set.

    Parameters

    • start: RoomPosition[]

      The starting positions.

    • options: {
          allOfDestinations?: RoomPosition[];
          anyOfDestinations?: RoomPosition[];
          costMatrixCallback: (room: string) => undefined | ClockworkCostMatrix;
          maxRoomDistance?: number;
          maxRooms?: number;
          maxTileDistance?: number;
          maxTiles?: number;
      }

      The options for the distance map.

    Returns ClockworkMultiroomDistanceMap

    A multi-room distance map.