feat: async pathfinding with provisional paths and bit-grid snapshots
- Add StandableBitGrid: O(1) bit-packed snapshot (~6KB per 50k tiles vs HashMap overhead) - Implement two-tier pathfinding: sync for short paths (<64 tiles), provisional+async for long paths - calculate_provisional_path: capped A* returning path to best heuristic node - calculate_async_path: A* using bit-grid (Send+Sync, no thread_local) - prepare_paths system: dispatches provisional paths immediately, spawns async for full paths - poll_async_paths + splice_completed_async_paths: seamless path transition when async completes - Entities start walking immediately on provisional path while full path computes in background Architecture: FixedUpdate: prepare_paths → update_wandering_targets → movement PostUpdate: poll_async_paths → splice_completed_async_paths Priority: DF-like pathing (immediate movement) > performance > memory
This commit is contained in:
+2
-1
@@ -4,6 +4,7 @@ pub const TILE_SIZE: f32 = TILE_PIXELS as f32 * PIXEL_RATIO;
|
||||
pub const ITILE_SIZE: i32 = TILE_SIZE as i32;
|
||||
pub const SEED: u32 = 420;
|
||||
|
||||
pub const PATHFINDER_SHORT_PATH_MAX_TILES: i32 = 100;
|
||||
pub const PATHFINDER_SHORT_PATH_MAX_TILES: i32 = 64;
|
||||
pub const PATHFINDER_MAX_NODES: usize = 5000;
|
||||
pub const PATHFINDER_WAYPOINT_THRESHOLD_TILES: i32 = 100;
|
||||
pub const PATHFINDER_PROVISIONAL_NODE_LIMIT: usize = 64;
|
||||
|
||||
Reference in New Issue
Block a user