API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classPathfinder

@codexo/exojs-pathfinding / pathfinding / stable

Runs path queries against any NavigationSpace. One pathfinder owns the search buffers and reuses them across every query, including queries against different spaces of different sizes, so a search itself allocates nothing once the buffers have reached their size. The result objects are freshly allocated by design: callers hold on to a path, and pooling something a caller retains trades a little garbage for use-after-reuse bugs. A pathfinder holds no world state and no lifecycle - construct one per system that needs paths, or share one, as long as queries do not interleave with a mutation of the space being searched.

0
props
3
methods
0
events
Import
import { Pathfinder } from '@codexo/exojs-pathfinding'

Runs path queries against any NavigationSpace.

One pathfinder owns the search buffers and reuses them across every query, including queries against different spaces of different sizes, so a search itself allocates nothing once the buffers have reached their size. The result objects are freshly allocated by design: callers hold on to a path, and pooling something a caller retains trades a little garbage for use-after-reuse bugs.

A pathfinder holds no world state and no lifecycle - construct one per system that needs paths, or share one, as long as queries do not interleave with a mutation of the space being searched.

Constructors1
new(): Pathfinder
Methods3
Finds a cost-optimal path between two node ids. unreachable yields an empty path unless FindPathOptions.snapToNearest is set; budget-exceeded always carries the best partial path found, which is a real, traversable prefix and not a guess at the rest.
findPath between two points instead of node ids. A point outside the space makes the query unreachable unless FindPathOptions.snapToNearest is set and the space can resolve a nearest node.
Every node reachable from origin within FloodOptions.maxCost, with its cost - the "tiles I can still move to this turn" query, and the input a flow field for many agents heading to one goal is built from.
Source