Expand description
Flow field pathfinding and Reynolds flocking for large groups of agents.
Flow fields compute a single vector-field over a grid from one or more goal cells. Every agent in the group samples the field at its position and follows the resulting direction — O(1) per agent after the O(N) build.
§Example
use proof_engine::ai::flowfield::{FlowField, FlowFieldGroup};
use glam::Vec2;
let mut field = FlowField::new(20, 20, 1.0);
field.set_cost(10, 10, f32::INFINITY); // obstacle
field.build_integration_field(&[(19, 19)]);
field.build_direction_field();
let dir = field.get_direction(Vec2::new(0.5, 0.5));
println!("flow direction: {:?}", dir);Structs§
- Boid
- An individual boid in the flock.
- Dynamic
Obstacle Field - Applies temporary cost increases to a flow field (e.g., for dynamic obstacles).
- Flock
- Reynolds flocking simulation (separation, alignment, cohesion).
- Flow
Field - A grid-based flow field.
- Flow
Field Agent - A group of agents that share a single flow field to a common destination.
- Flow
Field Cache - Caches pre-built flow fields keyed by goal cell. Evicts least-recently-used entries when the capacity limit is reached.
- Flow
Field Group - Manages a group of agents all moving toward the same destination via a shared flow field.