public class WaypointPathfinder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
StatefulRNG |
rng |
Constructor and Description |
---|
WaypointPathfinder(char[][] map,
DijkstraMap dijkstra,
IRNG rng)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius radius,
IRNG rng)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius radius,
IRNG rng,
boolean thickCorridors)
Calculates and stores the doors and doors-like connections ("chokepoints") on the given map as waypoints.
|
WaypointPathfinder(char[][] map,
Radius radius,
IRNG rng,
int fraction)
Calculates and stores the specified fraction of walkable points from map as waypoints.
|
Modifier and Type | Method and Description |
---|---|
java.util.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.
|
OrderedSet<Coord> |
getWaypoints() |
java.util.ArrayList<Coord> |
goBackToPath(Coord currentPosition,
java.util.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 StatefulRNG rng
public WaypointPathfinder(char[][] map, Radius radius, IRNG rng)
rng.nextLong()
, or unseeded if
the parameter is null.map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.radius
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (this will always use a new RNG, but it may be seeded by a given RNG's next result)public WaypointPathfinder(char[][] map, Radius radius, IRNG rng, boolean thickCorridors)
rng.nextLong()
, or unseeded if
the parameter is null.map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.radius
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (this will always use a new RNG, but it may be seeded by a given RNG's next result)thickCorridors
- true if most chokepoints on the map are 2 cells wide instead of 1public WaypointPathfinder(char[][] map, Radius radius, IRNG rng, int fraction)
rng.nextLong()
, or unseeded if
the parameter is null.
map
- a char[][] that stores a "complete" dungeon map, with any chars as features that pathfinding needs.radius
- a Radius that should correspond to how you want path distance calculated.rng
- an RNG object or null (this will always use a new RNG, but it may be seeded by a given RNG's next result)fraction
- the fractional denominator of passable cells to assign as waypoints; use 29 if you aren't surepublic WaypointPathfinder(char[][] map, DijkstraMap dijkstra, IRNG rng)
rng.nextLong()
, or unseeded if
the parameter is null.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 (this will always use a new RNG, but it may be seeded by a given RNG's next result)public java.util.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 java.util.ArrayList<Coord> goBackToPath(Coord currentPosition, java.util.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 OrderedSet<Coord> getWaypoints()
Copyright © Eben Howard 2012–2022. All rights reserved.