nav
The navigation the simulation runs on, from navKit: a grid map for walkability, nearest points and floor heights, and a waypoint map for one path per group order. Buildings block both through navKit obstacles.
rtsKit.nav
The navigation the simulation runs on, from navKit: a grid map for walkability, nearest points and floor heights, and a waypoint map for one path per group order. Buildings block both through navKit obstacles.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2rtsKit.nav - the navigation the host simulation runs on, from navKit. An RTS moves groups, not single characters, so Field Command plans one path per order and lets each unit hold its formation slot along it. When a match starts it bakes: * `fc.walk` a navKit grid map: is this spot walkable for this radius, the nearest walkable spot, and the floor height (cheap lookups, every step). Walkable answers come from a bucketed copy of navKit's obstacles, ~1 us a call. * a coarse path graph of its own (2 m nodes, 8 neighbours) over that map, searched with a heap A* and string-pulled: ~1 ms a plan where navKit's Luau A* costs 40-100 ms (it scans every obstacle zone per edge). Patched in place when obstacles change. Buildings and anything else with a navKit `NavObstacle` block both. local Nav = require("rtsKit.nav") Nav.bake({ min = { -80, -60 }, max = { 80, 60 } }) local pts = Nav.path(0, 0, 40, 12) -- { {x, z}, ... } or nil if Nav.walkable(x, z, 0.5) then ... end
ready( ) → boolean
True once both maps are baked.
bake(opts: any) → void
Bake the walk grid and the path graph over a box. `opts.min`/`opts.max` are {x, z}. Spread over frames (a few ms each) when called from a coroutine (`opts.spread`).
| arg | type | description |
|---|---|---|
| opts | any |
reset( ) → void
Forget the baked maps (a new match on another map).
height(x: number, z: number) → number
Floor height at a spot (0 outside the baked box or before baking).
| arg | type | description |
|---|---|---|
| x | number | |
| z | number |
fastState( ) → any
walkableRaw(x: number, z: number, rad: number) → boolean
| arg | type | description |
|---|---|---|
| x | number | |
| z | number | |
| rad | number |
clearRaw(x0: number, z0: number, x1: number, z1: number, r: number) → boolean
| arg | type | description |
|---|---|---|
| x0 | number | |
| z0 | number | |
| x1 | number | |
| z1 | number | |
| r | number |
walkable(x: number, z: number, r: number?) → boolean
Can a ground unit of this radius stand here? (true before the maps are baked, so tests and empty worlds still move).
| arg | type | description |
|---|---|---|
| x | number | |
| z | number | |
| r | number? |
nearest(x: number, z: number, r: number?) → void
The nearest walkable spot to (x, z), or the spot itself when nothing is baked. Buildings, mines and trees block ground on top of the baked map, so an answer standing inside one is walked outwards in rings until it is open.
| arg | type | description |
|---|---|---|
| x | number | |
| z | number | |
| r | number? |
clear(x0: number, z0: number, x1: number, z1: number, r: number?) → boolean
Is the straight walk from a to b clear for this radius (sampled every 0.7 m)?
| arg | type | description |
|---|---|---|
| x0 | number | |
| z0 | number | |
| x1 | number | |
| z1 | number | |
| r | number? |
nodeIndex(ix: number, iz: number) → number
| arg | type | description |
|---|---|---|
| ix | number | |
| iz | number |
refreshNodes(ix0: number, ix1: number, iz0: number, iz1: number) → void
| arg | type | description |
|---|---|---|
| ix0 | number | |
| ix1 | number | |
| iz0 | number | |
| iz1 | number |
refreshEdges(ix0: number, ix1: number, iz0: number, iz1: number) → void
| arg | type | description |
|---|---|---|
| ix0 | number | |
| ix1 | number | |
| iz0 | number | |
| iz1 | number |
snapshotObstacles( ) → void
buildGraph(spread: boolean) → void
| arg | type | description |
|---|---|---|
| spread | boolean |
syncGraph( ) → void
re-check the graph around every obstacle that appeared, moved or left since the last plan
nodeNear(x: number, z: number, r: number) → number
the open node a unit at (x, z) can walk straight to (or the nearest open one when none is in sight)
| arg | type | description |
|---|---|---|
| x | number | |
| z | number | |
| r | number |
nodeXZ(i: number) → void
| arg | type | description |
|---|---|---|
| i | number |
search(s: number, t: number) → void
heap A* from node s to node t; returns the node list (s..t, or s..the node nearest t when t is unreachable)
| arg | type | description |
|---|---|---|
| s | number | |
| t | number |
h(i: number) → number
| arg | type | description |
|---|---|---|
| i | number |
push(i: number, f: number) → void
| arg | type | description |
|---|---|---|
| i | number | |
| f | number |
pop( ) → number
graphPath(x0: number, z0: number, x1: number, z1: number, r: number) → void
plan on the graph: { {x, z} ... } from (x0, z0), string-pulled, ending at the goal when it can be reached
| arg | type | description |
|---|---|---|
| x0 | number | |
| z0 | number | |
| x1 | number | |
| z1 | number | |
| r | number |
path(x0: number, z0: number, x1: number, z1: number, r: number?) → void
A ground path from a to b as { {x, z}, ... } ending at b (or the closest reachable spot), or nil when no map. Straight when the walk is clear.
| arg | type | description |
|---|---|---|
| x0 | number | |
| z0 | number | |
| x1 | number | |
| z1 | number | |
| r | number? |
block(key: string, mn: { number }?, mx: { number }?) → void
Block a box on both maps (a building footprint). `min`/`max` are {x, z}; no min clears it.
| arg | type | description |
|---|---|---|
| key | string | |
| mn | { number }? | |
| mx | { number }? |
blockStatic(group: string, boxes: { { number } }) → void
Block boxes that never move (map scenery: a river, a ridge) straight on navKit's maps, with no entity or component ticking for each. `boxes` = { { minX, minY, minZ, maxX, maxY, maxZ } }. Calling again with the same `group` replaces that set; `Nav.clearStatic(group)` removes it.
| arg | type | description |
|---|---|---|
| group | string | |
| boxes | { { number } } |
clearStatic(group: string) → void
Remove a set of static blockers `Nav.blockStatic` placed.
| arg | type | description |
|---|---|---|
| group | string |
stats( ) → any
Planning totals since the match began.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.