Logo FSBarV1_Archived

Pathing Module

Slope-aware A* pathing over a MapGrid with friendly-structure masking. Pure over inputs; never blocks beyond the configured budget.

Functions and values

Function or value Description

defaultPathBudget

Full Usage: defaultPathBudget

Returns: PathBudget

Default budget: 50 ms wall clock, 50 000 cell expansions, slope cost multiplier 2.0.

Returns: PathBudget

findPath grid moveType ownStructures start goal budget

Full Usage: findPath grid moveType ownStructures start goal budget

Parameters:
    grid : MapGrid - Map data providing passability and slope information.
    moveType : MoveType - Movement type governing passability thresholds.
    ownStructures : OwnStructureFootprint seq - Friendly structure footprints to mask out of the passability grid.
    start : float32 * float32 * float32 - Start position in world coordinates (elmos).
    goal : float32 * float32 * float32 - Goal position in world coordinates (elmos).
    budget : PathBudget - Wall-clock, expansion, and slope-weighting limits.

Returns: Result<Path, PathFailure> Ok with a Path on success, or Error with a PathFailure on invalid endpoints or no route.

Find a path from start to goal over grid for moveType, treating every cell covered by an ownStructures footprint as impassable.

grid : MapGrid

Map data providing passability and slope information.

moveType : MoveType

Movement type governing passability thresholds.

ownStructures : OwnStructureFootprint seq

Friendly structure footprints to mask out of the passability grid.

start : float32 * float32 * float32

Start position in world coordinates (elmos).

goal : float32 * float32 * float32

Goal position in world coordinates (elmos).

budget : PathBudget

Wall-clock, expansion, and slope-weighting limits.

Returns: Result<Path, PathFailure>

Ok with a Path on success, or Error with a PathFailure on invalid endpoints or no route.

pathCost grid moveType path slopeCost

Full Usage: pathCost grid moveType path slopeCost

Parameters:
Returns: float32

Re-sum the edge weights of a precomputed path under a caller-supplied slope cost. Used to re-score an existing Path against a different SlopeCost without re-running the full search.

grid : MapGrid
moveType : MoveType
path : Path
slopeCost : float32
Returns: float32

rasteriseFootprints grid ownStructures

Full Usage: rasteriseFootprints grid ownStructures

Parameters:
Returns: bool[,]

Rasterise a collection of structure footprints into a boolean grid overlay matching the shape of MapGrid.passability. Callers can reuse the overlay across multiple findPath calls for the same structure set.

grid : MapGrid
ownStructures : OwnStructureFootprint seq
Returns: bool[,]

Type something to start searching.