public class WaypointPathfinder extends Object
Constructor and Description |
---|
WaypointPathfinder(char[][] map,
DijkstraMap dijkstra,
RNG rng)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius measurement,
RNG rng)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius measurement,
RNG rng,
boolean thickCorridors)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius measurement,
RNG rng,
int fraction)
Calculates and stores the specified fraction of walkable points from map as waypoints.
|
Modifier and Type | Method and Description |
---|---|
ArrayList<Coord> |
getKnownPath(Coord self,
Coord approximateTarget)
Finds the appropriate one of the already-calculated, possibly-long paths this class stores to get from a waypoint
to another waypoint, then quickly finds a path to get on the long path, and returns the total path.
|
LinkedHashSet<Coord> |
getWaypoints() |
ArrayList<Coord> |
goBackToPath(Coord currentPosition,
ArrayList<Coord> path)
If a creature is interrupted or obstructed on a "highway" path, it may need to travel off the path to its goal.
|
public WaypointPathfinder(char[][] map, Radius measurement, RNG rng)
map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.measurement
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (which will make this use a new RNG); will be used for all random choicespublic WaypointPathfinder(char[][] map, Radius measurement, RNG rng, boolean thickCorridors)
map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.measurement
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (which will make this use a new RNG); will be used for all random choicesthickCorridors
- true if most chokepoints on the map are 2 cells wide instead of 1public WaypointPathfinder(char[][] map, Radius measurement, RNG rng, int fraction)
map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.measurement
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (which will make this use a new RNG); will be used for all random choicesfraction
- the fractional denominator of passable cells to assign as waypoints; use 29 if you aren't surepublic WaypointPathfinder(char[][] map, DijkstraMap dijkstra, RNG rng)
map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needsdijkstra
- a DijkstraMap that will be used to find paths; may have costs but they will not be usedrng
- an RNG object or null (which will make this use a new RNG); will be used for all random choicespublic ArrayList<Coord> getKnownPath(Coord self, Coord approximateTarget)
self
- the pathfinder's positionapproximateTarget
- the Coord that represents the approximate area to pathfind to; will be randomized if
it is not walkable.public ArrayList<Coord> goBackToPath(Coord currentPosition, ArrayList<Coord> path)
currentPosition
- the current position of the pathfinder, which is probably not on the ideal pathpath
- the ideal path, probably returned by getKnownPathpublic LinkedHashSet<Coord> getWaypoints()
Copyright © 2012–2016. All rights reserved.