commit 1710165a4ffd93e0323a42b21598bbdd912865e7
parent d3319b1290234296e0ccbc3d36e42eeed9260a5c
Author: anon <anon@example.com>
Date: Thu, 5 Nov 2026 09:20:33 +0000
Ground and validate idle NPC routes before broadcasting
Diffstat:
4 files changed, 121 insertions(+), 7 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -43,6 +43,10 @@ research separately. More screenshots and test cases do not count as new gamepla
Clan/Neutral route using the same movement code. Completion: no visible
multi-metre correction on these routes and a regression for the actual cause.
See [prior movement evidence](docs/npc-pursuit.md#npc-starts-turns-and-stops).
+ November 5: fixed buried and obstructed idle waypoints reproduced on the
+ Clan/Neutral routes, with packet regressions and two-client reconnect checks.
+ The specific Trade report remains unreproduced; its actor/location or a new
+ failing capture is needed before repeating the passing Trade scenarios.
- [ ] **A2: NPC vendors respond and trade.** Start with the two OT Food Providers
in Omni Trade (`710/district/0/fixed/18` and `19`). The current machine-only
diff --git a/docs/npc-pursuit.md b/docs/npc-pursuit.md
@@ -340,8 +340,8 @@ server leash/navigation policy remain separate fidelity work.
### November 5 A1 reproduction check
-The reopened walking-then-jumping report remains unresolved. Fresh two-client
-checks at server source `e428aa04` did not reproduce multi-metre corrections.
+Initial two-client checks of the reopened walking-then-jumping report at server
+source `e428aa04` did not reproduce multi-metre corrections in Trade.
The four Trade Wardroid/Organic Waste Collector placements produced 157 samples
and 56 stops, including both page reconnects: maximum stopped pose error was
.163m and maximum sampled displacement beyond the walking-speed allowance was
@@ -361,8 +361,59 @@ the tested bundle (`974c7f5d...` and `48d48eac...`). Its executable hash and bui
timestamp, complete asset hashes, raw captures and analyses are retained under
`local/npc-stop-jump/`, in `native-20261105-003000`,
`native-20261105-003311` and `pursuit-20261105-003550`. Owned test clients and
-servers were closed. No movement behavior was changed and A1 is not closed.
-The next reproduction needs the reported actor/location and circumstances, or
-a capture that identifies a correction. Clan/Neutral route acceptance and a
-regression for the reported cause remain outstanding; do not repeat the same
-passing Trade samples as evidence of a fix.
+servers were closed. These initial passing checks did not close A1.
+
+### Roaming destinations on slopes
+
+The subsequent Clan/Neutral checks reproduced stop corrections on both native
+observers. Clan Leet 1067362 stopped predicting at `(79.256,11.191,114.141)`
+while the server continued uphill, then jumped about 1.68m on the stop packet.
+Its destination `(77.837,10.408,116.345)` reused the home elevation and lay
+below the destination floor. Neutral Android 1067471 showed the same failure.
+The captures are `native-20261105-005518` and `native-20261105-005650`; the latter
+also timed out waiting for all fourteen Androids to complete three routes, so
+the focused replay selects the affected Android instead of extending that wait.
+
+A controlled two-client replay of the Clan route failed with 1.345m of
+displacement beyond the walking-speed allowance. Changing only destination Y
+to the existing scene floor plus .01m reduced that excess to .053m. The Leet is
+framed in both clients; native vehicle snapshots and screenshots are retained
+under `local/npc-stop-jump/slope/20261105-010336` and `20261105-010412`.
+These are fixture routes, not earned progression.
+
+Grounding the endpoint alone was insufficient for a Neutral junkyard route.
+The Android crossed a mound from `(273.938,6.391,64.193)` toward
+`(273.975,6.043,69.179)` while native prediction stopped at
+`(273.949,7.281,65.625)`, followed by a 2.55m stop correction. Both the low and
+raised approach probes are obstructed on this route; the same probes are clear
+on the corrected Clan route. Evidence is in `native-20261105-010957` and
+`probe.log`.
+
+Idle route selection now projects the waypoint onto the existing physical
+scene floor and admits it through the shared walkability probe before sending
+it to observers. An obstructed choice waits for the ordinary roaming pause
+before choosing again. Current position, retained home, acceleration, arrival
+radius and checkpoint cadence are unchanged. This is reconstruction policy for
+short idle walks, not evidence of the original server's destination algorithm.
+`TestNPCRoamingPublishesTheDestinationFloorHeight` exercises ordinary route
+selection and checks the advertised packet height while preserving the pose
+and home. `TestNPCRoamingDoesNotAdvertiseAnOccludedRoute` checks that a blocked
+choice sends no movement and schedules the next attempt. All 31 focused
+movement/routing tests pass.
+
+The grounded Clan replay covers all six authored level-one Leets: 156 samples,
+93 stops and both page reconnects, with .067m maximum excess displacement and
+.199m maximum sampled stop error (`native-20261105-010733`). After obstruction
+admission, the affected Neutral Android completes at least three stops per
+observer before and after reconnect: 183 samples, 13 stops, .011m maximum
+excess displacement and .231m maximum sampled stop error
+(`native-20261105-011450`). The Neutral observers are placed outside the junk
+mesh and face the Android. No browser exceptions were recorded.
+The final all-ten Trade replay also passes both reconnects: 189 samples,
+158 stops, .046m maximum excess displacement and .175m maximum sampled stop
+error (`native-20261105-011630`). Owned browser clients and test servers are
+closed after every run. Vet and the server build pass.
+
+A1 remains open: the specific Omni Trade report has not been reproduced, and
+these slope/scenery fixes do not establish its cause. Reopen that bounded
+investigation with the reported actor/location or a fresh failing capture.
diff --git a/server/npc_motion_test.go b/server/npc_motion_test.go
@@ -35,6 +35,54 @@ func TestNPCRoamingMatchesNativeAccelerationAndWaypointArrival(t *testing.T) {
}
}
+func TestNPCRoamingPublishesTheDestinationFloorHeight(t *testing.T) {
+ // Keep every random endpoint on raised ground above the retained home height.
+ world, conn, start := newNPCPursuitWorld(t)
+ npc := world.characters[1000000]
+ npc.fighting = 0
+ npc.position, npc.motion.home = [3]float32{5, 2.01, 5}, [3]float32{5, 0, 5}
+ npc.motion.nextMove = start
+ npc.body = playerCollisionBody{mesh: 1, scale: 1, base: int32(npc.baseScale()),
+ sphere: collisionSphere{offset: [3]float32{0, .25, 0}, radius: .25}}
+ world.terrain = map[uint32]*terrain{950: {width: 2, height: 2, boundsWidth: 2, boundsHeight: 2,
+ spacing: 5, scale: 1, heights: []byte{2, 2, 2, 2, 2, 2, 2, 2, 2}}}
+ world.geometry = &sceneGeometry{
+ playfields: map[uint32]scenePlayfield{950: {cellsX: 1, cellsZ: 1, cellWidth: 10, cellDepth: 10, sizeX: 10, sizeZ: 10}},
+ terrain: world.terrain,
+ surfaces: map[uint32]*sceneSurface{950 << 16: nil},
+ waters: map[uint32]*sceneWater{950: {zones: []waterZone{{maxHeight: -1}}}},
+ }
+
+ world.advanceNPCs(start.Add(250 * time.Millisecond))
+
+ if npc.position != [3]float32{5, 2.01, 5} || npc.motion.home != [3]float32{5, 0, 5} || !npc.motion.moving {
+ t.Fatal("choosing a route changed the current pose or retained home", npc.position, npc.motion)
+ }
+ if npc.motion.destination[1] != 2.01 || len(conn.packets) != 1 || math.Float32frombits(binary.BigEndian.Uint32(conn.packets[0][74:78])) != 2.01 {
+ t.Fatalf("idle route advertised a waypoint below its floor: destination=%v packets=%x", npc.motion.destination, conn.packets)
+ }
+}
+
+func TestNPCRoamingDoesNotAdvertiseAnOccludedRoute(t *testing.T) {
+ // Every candidate around home lies across the wall from the current pose.
+ world, conn, start := newNPCPursuitWorld(t)
+ addCombatWall(world)
+ world.terrain = world.geometry.terrain
+ world.geometry.waters = map[uint32]*sceneWater{950: {zones: []waterZone{{maxHeight: -1}}}}
+ npc := world.characters[1000000]
+ npc.fighting = 0
+ npc.motion.home, npc.motion.nextMove = [3]float32{5, 0, 10}, start
+
+ world.advanceNPCs(start.Add(250 * time.Millisecond))
+
+ if npc.motion.moving || npc.position != [3]float32{16, 0, 10} || len(conn.packets) != 0 {
+ t.Fatal("idle route crossed an obstruction hidden from the native follower", npc.position, npc.motion, conn.packets)
+ }
+ if !npc.motion.nextMove.After(start.Add(3 * time.Second)) {
+ t.Fatal("blocked idle route did not pause before another choice", npc.motion.nextMove)
+ }
+}
+
func TestNPCPursuitStartsItsRouteBeforeAdvancing(t *testing.T) {
world, conn, start := newNPCPursuitWorld(t)
diff --git a/server/roaming.go b/server/roaming.go
@@ -86,6 +86,17 @@ func (server *server) advanceNPCs(now time.Time) {
character.motion.home[1],
character.motion.home[2] + float32(math.Cos(angle)*distance),
}
+ // Buried waypoints make the native follower stop short on rising ground.
+ if character.geometry.physical(character.playfield) {
+ point, normal := character.motion.destination, [3]float32{}
+ character.geometry.floor(character.playfield, server.terrain[character.playfield], point, &point, &normal)
+ character.motion.destination[1] = point[1] + .01
+ // Idle walks need a clear approach; try another destination after the pause.
+ if _, clear := probeNPCWalk(*character, character.motion.destination); !clear {
+ character.motion.nextMove = now.Add(time.Duration(3+rand.IntN(6)) * time.Second)
+ continue
+ }
+ }
character.motion.moving = true
}
if started {