Skip to main content

Module pathfinding

Module pathfinding 

Source
Expand description

A* pathfinding, Dijkstra maps, Jump Point Search, and hierarchical pathfinding.

§Example

use proof_engine::ai::pathfinding::{PathGrid, AStarPathfinder};
use glam::Vec2;

let mut grid = PathGrid::new(20, 20, 1.0);
grid.set_walkable(5, 5, false); // obstacle
let finder = AStarPathfinder::new();
if let Some(path) = finder.find_path(&grid, Vec2::new(0.0, 0.0), Vec2::new(10.0, 10.0)) {
    println!("Found path with {} waypoints", path.len());
}

Structs§

AStarPathfinder
Full A* pathfinder operating on a PathGrid.
DijkstraMap
A distance field computed simultaneously from multiple source cells. Useful for “all enemies chase the player” scenarios — compute once, use many.
HierarchicalPathfinder
Two-level hierarchical pathfinder. Performs a coarse A* over chunks, then refines within each chunk.
HierarchyChunk
A chunk in the hierarchical pathfinder.
JumpPointSearch
Jump Point Search — optimized A* for uniform-cost grids. Significantly reduces nodes expanded on open terrain.
Path
A resolved path as a sequence of world positions.
PathGrid
A uniform grid used for all grid-based pathfinding algorithms.
PathNode
A single node used internally during A* search.
PathRequest
A pathfinding request.
PathfindingStats
Statistics collected during a pathfinding run.

Enums§

Heuristic
Available heuristic functions for A*.
PathResult
The result of a pathfinding operation.

Functions§

smooth_path
Remove redundant waypoints using line-of-sight checks (string-pulling).
spline_path
Catmull-Rom spline interpolation for smooth curved paths.