ludic.nav (18.1): a DetourCrowd per kind of walker
The shim builds DetourCrowd from the same pinned Recast & Detour tag. nav_crowd_start puts a crowd on a kind's mesh, with the mesh's tastes as its filters. Walkers are added (snapped to the mesh), sent and sped through verbs, stepped together, and read back into nav_agent_*. nav_crowd_us times the stepping with the OS clock. Dropping a mesh drops its crowd first. On the test meadow, twenty walkers crossing head-on never come closer than their two radii (0.7003 m), all arrive, and a step costs about 12 us. nav 15/15 on the Mac and the PC; the DLL still imports KERNEL32 alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c2902a2246
commit
521efe67db
12 changed files with 267 additions and 10 deletions
|
|
@ -45,6 +45,8 @@ export state NavState {
|
|||
nv_asked: int = 0 # paths asked for, found (two corners or more), and cut short
|
||||
nv_found: int = 0
|
||||
nv_short: int = 0
|
||||
nv_crowds: []pointer = nv_none() # a crowd per kind, on that kind's mesh (crowd.ludic)
|
||||
nv_agent: []float = floats(6) # the last walker read: position, velocity
|
||||
}
|
||||
function nv_none() -> []pointer {
|
||||
let m = new []pointer
|
||||
|
|
@ -57,6 +59,7 @@ function nv_mesh(nav_st: NavState, kind: int) -> pointer {
|
|||
}
|
||||
function nv_set(nav_st: mut NavState, kind: int, h: pointer) -> bool {
|
||||
if kind < 0 or kind >= NAV_KINDS { return false }
|
||||
nv_crowd_drop(nav_st, kind)
|
||||
if nav_st.nv_meshes[kind] != null { nvc_free(nav_st.nv_meshes[kind]) }
|
||||
nav_st.nv_meshes[kind] = h
|
||||
return h != null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue