crcbl_nav/lib.rs
1//! Navigation: where an agent on the ground can walk, and by which cells.
2//!
3//! Two grids, both from EW, whose AI ran on each before it moved here:
4//!
5//! * [`grid`]: a caller-authored field of walkable and blocked square cells on
6//! one floor, a shortest four-neighbour route across it, and a bounded flood
7//! fill that answers "what is within `n` steps of here".
8//! * [`spans`]: the same two questions over each column's walkable floors, as
9//! a caller's probe of the collision world found them, so routes climb
10//! stairs, cross slopes and pass under floors above, kept a body's radius
11//! from walls and drops.
12//!
13//! And [`follow`], for walking a route either grid planned: which waypoint to
14//! steer toward, so a walk turns where its route turns, and whether the walk
15//! has stalled.
16//!
17//! # The rung below the navmesh, not a replacement for it
18//!
19//! `docs/plan/24-navigation.md` is still the plan: a Recast-lineage navmesh
20//! baked from physics colliders, tiled and sector-aware, with A\* and a funnel
21//! over polygons. None of that is built. The grids are what a game uses
22//! before it — a bounded arena, a scene whose walkability a game can sample
23//! itself — and they stay useful after, for the small local questions (a cover
24//! search, a reach test) a polygon mesh is heavier than.
25//!
26//! # Determinism
27//!
28//! Every answer here is a function of its inputs and nothing else: no hash
29//! map, no clock, no randomness, no thread. The same grid asked the same
30//! question returns the same route, cell for cell, on every machine — which is
31//! what lets a server decide a path and a replay reproduce it. [`grid`]'s docs
32//! name the tie-break that makes that true when several routes are equally
33//! short.
34//!
35//! # What is not here
36//!
37//! * **No probe of a physics world.** Declined on 2026-09-27
38//! (`docs/backlog.md`, _EW's engine port requests_): which probe decides that
39//! a cell is walkable — its clearance, its step height, its margin — is a
40//! scene's policy, and EW is the only game with one. A caller fills the cell
41//! map and hands it to [`grid::GroundGrid::new`], or hands its probe to
42//! [`spans::SpanGrid::build`].
43//! * **No smoothing, and no costs on [`grid`].** A route is the cell centres a
44//! walk visits; [`grid`]'s steps are four-neighbour and equal, [`spans`]'s
45//! eight-neighbour and measured. Cutting corners or weighting terrain is the
46//! navmesh's business, or a caller's.
47
48pub mod follow;
49pub mod grid;
50pub mod spans;