commit c1c9852540f1bd473762f6538d250123943ae909
parent f504f5dcc14720e9b9feafe13e9d23fd6ecf1994
Author: anon <anon@example.com>
Date: Wed, 28 Oct 2026 16:32:23 +0000
Verify indoor route recovery and combat lifecycle
Diffstat:
4 files changed, 130 insertions(+), 17 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -64,8 +64,9 @@ survives restart without respawning. Returning that exact book to its issuing
booth now completes the fixed contract and atomically grants authored cash
and a selected-quality equipment reward. The fixed selection is provisional;
the fixed mission now has five level-1 Leets using shared combat and loot.
-Conditional completion token/XP, obstacle routing and historical population/reward
-generation remain open.
+Indoor combatants now use shared body/collision probes to plan bounded detours;
+native movement timing still needs refinement. Conditional completion token/XP
+and historical population/reward generation remain open.
An ordinarily created Enforcer has now funded a request with corpse cash, entered
the fixed mission, collected and returned its exact book, and retained the earned
cash/glove across rejected wear, reconnect and cold restart. The same character
diff --git a/docs/mission-encounters.md b/docs/mission-encounters.md
@@ -38,12 +38,12 @@ z28-to-z43 routes cross the actual inter-room portal and return home without per
the tongue mesh at y1.476895, rather than the lower floor beneath that scenery.
Mission pursuit and return now share a bounded half-metre route search. Each
-candidate walks a copy of the actor through the same 60Hz physical integration
+candidate walks a copy of the actor through the same 60 Hz physical integration
used for live motion. Room transitions, original collision bodies, slopes,
walls and gravity decide reachability. Natural settling handles a horizontal
arrival above the destination floor. Only physically walkable shortcuts remove
intermediate points. Search state distinguishes horizontal cells and floor
-height; a query considers at most4096 nodes. Failed queries retry after one
+height; a query considers at most 4096 nodes. Failed queries retry after one
second instead of repeating on every scheduler tick. These sampling and budget
choices are reconstruction policy, not recovered original server rules.
@@ -51,7 +51,7 @@ Routes remain in memory. A target moving one metre from the planned endpoint
causes replanning; roots and motion cancellation discard cached waypoints.
Cold loading reconstructs a route from the persisted pose and home. The live
actor consumes waypoints within its movement-time budget, and native packets
-carry its current position plus at most29 remaining points. New observers use
+carry its current position plus at most 29 remaining points. New observers use
the same remaining route. Indoor close approach also requires a walkable final
segment; exact native arrival/visibility parity remains unverified.
@@ -67,32 +67,42 @@ Evidence and exact addresses are retained in
`local/npc-pursuit-research/followSteering.json` and
`local/mission-encounter-research/integration-audit.md`.
-The original side-passage regression starts at(15,.011,15) and ends at
-(12.5,.011,34). Straight steering stalls near(14.018,.011,20.092). Both the Leet
+The original side-passage regression starts at (15,.011,15) and ends at
+(12.5,.011,34). Straight steering stalls near (14.018,.011,20.092). Both the Leet
and the admitted Salamander Boss body now reach the destination through actual
room geometry, including exact return-home completion. Existing tongue-mesh
and inter-room round trips remain covered. Additional regressions cover a
moving target, disconnected rooms, rooted route cancellation, bounded packets
-to two observers, cold return without observers and zero per-tick position writes.
+to two observers, spawn-before-route replay for a late observer, death during
+a pending detour, a rejected death save followed by a living return, cold
+return without observers and zero per-tick position writes.
-An isolated GPU WASM visitor accepted mission58 normally. A controlled
-fixture then placed only its NPC1068664 at the regression start, with the
+An isolated GPU WASM visitor accepted mission 58 normally. A controlled
+fixture then placed only its NPC 1068664 at the regression start, with the
destination as its retained home and a temporary root to allow observation.
After expiry, the original client consumed a three-point route, crossed the
-obstruction and reached home;452 native position samples and all three route
+obstruction and reached home; 452 native position samples and all three route
updates are retained under `local/indoor-routing/`. There were no page exceptions.
-The native final x12.375 differs from server x12.491 by the existing movement
+The native final x=12.375 differs from server x=12.491 by the existing movement
packet quantization. The native follower lagged before the turn, then received
an approximately three-metre correction. Acceleration, braking and waypoint
timing parity remain open; reaching the endpoint does not establish smooth or
canonical motion. Both actors are visible in `native-return-visible.png`.
The fixture's poses/home were restored, the root expired, and the owned browser
-closed. The earned character5's complete character/player rows, eight item
+closed. The earned character 5's complete character/player rows, eight item
instances, learned nanos and contracts were unchanged. No rewards or combat
balance outcome is claimed for this controlled navigation check. On the local
-machine, isolated first-tick detour searches took about49ms at100HP and87ms
-at1HP; these are observations, not a population-scale performance guarantee.
+machine, isolated first-tick detour searches took about 49 ms at 100 HP and
+87 ms at 1 HP; these are observations, not a population-scale performance guarantee.
+
+The complete server/game-data suite passed 1,627 test functions and 16,089
+tests/subtests (server 2,181.955 seconds); the export package compiled with no
+test files. Four later lifecycle regressions passed separately. The final
+navigation selection passed all ten functions and sixteen results, also under
+the race detector. The broader pursuit selection passed 23 functions and 57
+results under the race detector. Vet and the server build passed. Logs,
+source/binary hashes and cleanup checks are retained in `local/indoor-routing/`.
## Completion token evidence
diff --git a/docs/npc-pursuit.md b/docs/npc-pursuit.md
@@ -26,7 +26,7 @@ did not recover those numeric rules for Leets.
The server therefore handles concrete target loss without claiming a historical
outdoor give-up timer. Distance/time leashing remains unimplemented. Straight
-routes use the native default RunSpeed 100 and run mode, represented on the
+routes use this server's fixed RunSpeed 100 and run mode, represented on the
server as 4.5 metres/second. Selecting that default for admitted pursuit and return
is provisional; it is not an original-server species speed measurement. The
close-approach threshold comes from native NPC steering `FUN_10048430`, whose
@@ -77,7 +77,7 @@ waypoint consumer, not evidence of original server route planning.
The server sends self as the route's target identity and current position.
Straight routes contain two points: current position and destination. Indoor
-detours contain current position followed by up to29 remaining waypoints;
+detours contain current position followed by up to 29 remaining waypoints;
turns refresh that remaining route. Pursuit and return use run
control 23; ordinary idle roaming uses walk control 22. The native setter
skips the starting point when a second point is present. A changed player
diff --git a/server/npc_navigation_test.go b/server/npc_navigation_test.go
@@ -5,6 +5,7 @@ import (
"bytes"
"encoding/binary"
"fmt"
+ "slices"
"testing"
"time"
)
@@ -216,3 +217,104 @@ func TestMissionNPCColdLoadReplansTheReturnWithoutObservers(t *testing.T) {
t.Fatal("cold return restored transient waypoints, lost its home or healed", restored.position, restored.motion)
}
}
+
+func TestMissionNPCNewObserverReceivesTheRemainingDetourAfterSpawn(t *testing.T) {
+ world, _, _ := enteredMissionEncounterWorld(t)
+ player, npc := world.characters[1], world.characters[2000003]
+ npc.position = [3]float32{15, .011, 15}
+ player.position = [3]float32{12.5, .011, 34}
+ npc.fighting = player.id
+ world.fighting[npc.id] = npc
+ start := time.Now()
+ world.lastNPCUpdate = start
+ world.advanceNPCs(start.Add(250 * time.Millisecond))
+ observer := &combatTestConn{}
+ world.characters[2] = &character{id: 2, playfield: 65536, position: player.position}
+ world.clients[2] = &worldClient{id: 2, conn: observer, target: true, ready: true, npcs: make(map[uint32]bool)}
+
+ world.advanceNPCs(start.Add(500 * time.Millisecond))
+
+ var keys []uint32
+ var route []byte
+ for _, packet := range observer.packets {
+ if binary.BigEndian.Uint32(packet[24:28]) != npc.id {
+ continue
+ }
+ key := binary.BigEndian.Uint32(packet[16:20])
+ keys = append(keys, key)
+ if key == 0x260f3671 {
+ route = packet
+ }
+ }
+ if !slices.Equal(keys, []uint32{0x271b3a6b, 0x1d3c0f1c, 0x260f3671, 0x28494070}) ||
+ binary.BigEndian.Uint32(route[54:58]) != 3 || len(npc.motion.route) != 2 {
+ t.Fatal("new observer received a stale straight route or incorrect spawn order", keys, len(npc.motion.route))
+ }
+}
+
+func TestMissionNPCDeathDiscardsItsPendingDetour(t *testing.T) {
+ world, client, _ := enteredMissionEncounterWorld(t)
+ player, npc := world.characters[1], world.characters[2000003]
+ npc.position = [3]float32{15, .011, 15}
+ player.position = [3]float32{12.5, .011, 34}
+ npc.fighting = player.id
+ world.fighting[npc.id] = npc
+ start := time.Now()
+ world.lastNPCUpdate = start
+ world.advanceNPCs(start.Add(250 * time.Millisecond))
+ if len(npc.motion.route) == 0 {
+ t.Fatal("fixture did not start an obstacle route")
+ }
+ player.position, npc.health = npc.position, 1
+ world.combatRoll = func(uint32) uint32 { return 0 }
+
+ if err := world.handleCombat(client, attackPacket(player.id, npc.id)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceCombat(player.nextAttack)
+ position := npc.position
+ world.advanceNPCs(start.Add(time.Minute))
+
+ if npc.health != 0 || npc.corpse == nil || npc.position != position || npc.motion.moving || npc.motion.returning || len(npc.motion.route) != 0 {
+ t.Fatal("dead NPC retained its obstacle route or moved its corpse", npc.position, npc.motion)
+ }
+}
+
+func TestMissionNPCFailedDeathCancelsItsDetourAndReturnsAlive(t *testing.T) {
+ world, client, output := enteredMissionEncounterWorld(t)
+ player, npc := world.characters[1], world.characters[2000003]
+ npc.position = [3]float32{15, .011, 15}
+ player.position = [3]float32{12.5, .011, 34}
+ npc.fighting = player.id
+ world.fighting[npc.id] = npc
+ start := time.Now()
+ world.lastNPCUpdate = start
+ world.advanceNPCs(start.Add(250 * time.Millisecond))
+ player.position, npc.health = npc.position, 1
+ world.combatRoll = func(uint32) uint32 { return 0 }
+ if err := world.handleCombat(client, attackPacket(player.id, npc.id)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if len(npc.motion.route) == 0 {
+ t.Fatal("fixture did not retain its pending obstacle route")
+ }
+ if _, err := world.db.Exec("CREATE TRIGGER reject_navigation_death BEFORE UPDATE OF health ON characters WHEN NEW.id=2000003 AND NEW.health=0 BEGIN SELECT RAISE(FAIL,'blocked death'); END"); err != nil {
+ t.Fatal(err)
+ }
+
+ world.advanceCombat(player.nextAttack)
+ cancelled := !npc.motion.moving && len(npc.motion.route) == 0 && npc.motion.returning && npc.fighting == 0
+ for tick := 2; tick <= 96; tick++ {
+ world.advanceNPCs(start.Add(time.Duration(tick) * 250 * time.Millisecond))
+ }
+
+ if !cancelled || npc.health != 1 || npc.corpse != nil || npc.motion.moving || npc.motion.returning ||
+ len(npc.motion.route) != 0 || surfaceDistanceSquared(npc.position, npc.motion.home) >= .01 {
+ t.Fatal("failed death did not cancel the old detour and return a living NPC", npc.health, npc.position, npc.motion)
+ }
+ for _, packet := range output.packets {
+ if binary.BigEndian.Uint32(packet[16:20]) == 0x5e477770 && binary.BigEndian.Uint32(packet[24:28]) == npc.id {
+ t.Fatal("failed death published a corpse")
+ }
+ }
+}