waymark-tilecache
Dynamic obstacle management and tile caching for navigation meshes.
Overview
waymark-tilecache provides tile-based navigation mesh management with support
for runtime obstacle addition and removal. It enables dynamic environments
where obstacles can change without regenerating the entire navmesh.
Rust port of the DetourTileCache component from RecastNavigation.
Features
- Tile Caching: Compressed storage of navigation mesh tiles
- Dynamic Obstacles: Add/remove obstacles at runtime
- Obstacle Types: Cylinder, box, and oriented box shapes
- Incremental Updates: Rebuild only affected tiles
- LZ4 Compression: Efficient tile storage
- Streaming Support: Handle large worlds through tile streaming
Optional Features
serialization- Save/load tile cache state via Serde
Example
use ;
// Configure tile cache
let mut params = default;
params.width = 48;
params.height = 48;
params.max_obstacles = 128;
// Create tile cache
let mut tile_cache = new?;
// Add a cylinder obstacle (e.g., a tree or pillar)
let obstacle_id = tile_cache.add_obstacle?;
// Add a box obstacle (e.g., a crate)
let box_id = tile_cache.add_box_obstacle?;
// Update affected tiles
tile_cache.update?;
// Later, remove an obstacle
tile_cache.remove_obstacle?;
tile_cache.update?;
Obstacle Types
| Type | Description | Use Case |
|---|---|---|
| Cylinder | Circular base with height | Trees, pillars, characters |
| Box | Axis-aligned box | Crates, furniture |
| Oriented Box | Rotated box | Vehicles, angled objects |
WASM Support
This crate is fully compatible with WebAssembly. Build for WASM with:
LZ4 compression uses lz4_flex, a pure Rust implementation that works on WASM.
Serialization works with in-memory buffers; file-based save/load is not
available on WASM.
License
Dual-licensed under either:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)