commit d0a6f1705d7a9514a5850c4b006fffd631b14c4c
parent 3bb42f76fe9b8d2d3add76aea5eecd5ff5e03c93
Author: anon <anon@example.com>
Date: Sun, 25 Oct 2026 11:48:04 +0000
Verify special attack recovery and post-combat health reconciliation
Diffstat:
4 files changed, 143 insertions(+), 8 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -234,6 +234,15 @@ capacity checks are recorded in [belts and NCU](docs/belts-ncu.md).
- [x] Reconcile quiet health without phantom damage feedback. Check: after a
long native fight, prediction drift is corrected to server HP without extra
nanobot-damage chat or floating damage, including for an observer.
+- [x] Trace the three-point HP difference from the special-animation smoke.
+ Check: simultaneous owner/observer samples distinguish queued special damage
+ from native recovery and verify reconciliation after combat. Two GPU WASM
+ clients received matching Fast/ordinary hits, then crossed recovery counter120
+ 11.409 seconds apart. Their empty player queues and109 paired HP87/84 samples
+ identify independent prediction phases. Both stops preceded quiet corrections
+ through100; both native heaps and SQLite reached100. Fast/Fling tests cover
+ the stop/correction order. The broader healing/inspection audit remains open;
+ see the [recovery comparison](docs/npc-regeneration.md#special-attack-recovery-comparison).
The supported axe and fixed-QL fists use the period attack-rating multiplier;
fractional endpoint rounding remains provisional. See
@@ -1432,10 +1441,11 @@ and server restarts. Turn every reproduced bug into a focused regression test.
applies absolute remote HP without an animation guard, so it shares the
unresolved healing/hit ordering problem. Verify the server, owner and observer
through impact and subsequent regeneration; see [inspection](docs/character-info.md).
- The special-animation smoke also captured Fast target HP54/51 on two clients
- at different times during NPC retaliation. Include special animations and
- each client's recovery phase in this audit; do not treat matching result
- packets as proof of matching displayed HP.
+ The special-animation smoke's Fast target HP54/51 difference is traced to
+ independent native recovery phases by the simultaneous comparison above.
+ Include special animations, each client's recovery phase and target/controller
+ changes in the remaining audit; matching result packets alone do not prove
+ matching displayed HP or safe correction during combat.
- [ ] Audit ranged ammunition and reload. Cover empty/partial/full magazines,
matching/wrong/missing ammunition, insufficient stacks, repeated reloads,
reload during each attack phase, failed saves and round conservation across
diff --git a/docs/npc-regeneration.md b/docs/npc-regeneration.md
@@ -34,6 +34,15 @@ combat branch therefore gains 3 HP at counters divisible by 60. The idle
branch gains 1 HP each check for the supported maximum of 100. There is no
instantaneous full-health reset on stopping combat.
+The two-second trigger belongs to the local GameTime singleton. Original
+`GameTime_t::RunFunction` at `1000c3c0` alternates its tick phase; the actor
+update tests byte `+0x1d`. Each actor owns a separate recovery counter at
+`*(actor + 0x188) + 0x34`, initialized to zero by `10059770`. The recovered
+FullUpdate, HealthDamage, StopFight and GameTime update paths do not synchronize
+that counter or the local trigger phase. Independently loaded clients can
+therefore reach combat counter 60 at different times. This is bounded evidence
+from those message paths, not proof about every unexamined protocol class.
+
The controlled baseline omitted server recovery. After a nano hit, the native
Leet gained 3 HP at combat counter 60. After moving out of attack range, its
weapon controller became idle; HP rose from 53 to 59 as its counter advanced
@@ -71,6 +80,16 @@ so queued animation damage cannot subtract twice. StopFight precedes the next
quiet correction. Combat prediction phases can differ between clients and
the server; the subsequent quiet correction reconciles the display.
+Original holder stop `10079250` drains all queued weapon results against its
+current resolved target through `100ab5a0`, then clears its special-action
+queue. Stopping the NPC drains its outgoing results, not the player's hits
+against it. Safe correction requires the relevant attackers' stops to precede
+the correction, matching targets and no later result from that engagement.
+HealthDamage itself assigns HP without draining results or resetting recovery.
+Missing or changed targets and healing/inspection during combat remain separate
+ordering questions. The exact source ledger, retained records and generated
+message bodies are in `local/npc-regeneration-research/native-followup/`.
+
A contemporary [March 2003 mission-boss discussion, post 16](https://forums-archive.anarchy-online.com/showthread.php?112679-Finding-GA-Guide-P=)
reports substantially faster boss recovery after combat ends. It provides no
numeric rate, Leet measurement, or original-server capture. Later guides and
@@ -149,3 +168,45 @@ phases. SQLite reached 100 at its periodic checkpoint. All 192 item rows were
unchanged, including loaded ammunition 19. These browser runs reported no page
errors or unimplemented adapters, and their owned browser contexts were closed.
The checked report is `local/reet-regeneration-research/verification.json`.
+
+## Special-attack recovery comparison
+
+The earlier Fast Attack animation smoke's 54/51 HP captures were taken at
+different times during retaliation. Their preceding native snapshots already
+showed 72/69: the owner's recovery counter had crossed 60 while the observer's
+counter was 264. A later normal 18-point hit retained the three-point gap.
+Those captures suggested a recovery-phase difference, but did not establish
+simultaneous agreement or post-combat reconciliation.
+
+A fresh pair of published GPU WASM clients sampled native state concurrently
+every 100 ms. The Giant Snake received the same eight-point Fast Attack and
+eight-point ordinary hit on both clients, leaving 84 HP. After the player
+stopped attacking, the NPC continued retaliating. Each native counter crossed
+120 once and added three HP, 11.409 seconds apart. There were 109 paired samples
+within 150 ms of each other showing HP 87/84, both NPC controllers fighting,
+and the player's ordinary and special queues empty. No absolute NPC correction
+arrived during the engagement. This reproduces the difference independently of
+special damage delivery and explains the earlier three-point observation.
+
+Walking out of range delivered the NPC's StopFight after the player's earlier
+stop. The next quiet correction set HP 88, followed by each integer through
+100 with zero feedback fields. Across 374 steady idle samples, native HP stayed
+within one prediction tick of the latest settled correction. Both final native
+heaps and checkpointed SQLite HP were 100. The equipped axe retained its exact
+instance and slot; neither browser reported an error. Screenshots showed
+ordinary hit feedback without recovery damage messages.
+
+`TestWeaponSpecialRecoveryWaitsForBothCombatantsToStop` covers Fast and Fling:
+the player's stop does not publish absolute NPC HP during retaliation; moving
+out of range stops the NPC before a single phase-preserving idle correction.
+This comparison leaves the general combat healing/inspection ordering audit
+open. Captures, the checked report and owned-fixture cleanup verification are
+in `local/special-health-smoke/verification.json` and `cleanup.json`.
+
+The focused new test passed in 7.750 seconds. Weapon-special and NPC/player
+recovery tests passed three repetitions under the race detector in 108.843
+seconds; vet and diff checks passed. Both owned browser contexts were closed.
+Cleanup removed only the two fixture players, their axe and their NPC references,
+with unrelated-row hashes and SQLite foreign-key/integrity checks unchanged.
+Existing players 8/24 were retained and the single HTTPS preview was restored
+on its default ports. This follow-up changes tests and documentation only.
diff --git a/docs/weapon-special-animation.md b/docs/weapon-special-animation.md
@@ -78,10 +78,15 @@ preserved their identities, counts and remaining ammunition. The final run had
no page errors, unsupported adapters or renderer exits.
Fling's later native target-HP captures both read57. Fast's non-simultaneous
-captures read54/51 while the NPC still retaliated. Native recovery prediction
-and the existing healing/hit-order audit remain open; this run does not prove
-general HP agreement. Ordinary nonlethal damage remains on checkpoints, so its
-intermediate SQL snapshots can lag live HP. See [NPC recovery](npc-regeneration.md).
+captures read54/51 while the NPC still retaliated. A subsequent simultaneous
+two-client run reproduced a three-point difference when their independent
+native recovery counters crossed120 at different times, with empty player
+weapon/special queues. After both combatants stopped, quiet corrections
+reconciled HP through100 on both clients and SQLite. Fast/Fling regression tests
+now require both stops before the correction. The general healing/hit-order
+audit remains open. Ordinary nonlethal damage remains on checkpoints, so its
+intermediate SQL snapshots can lag live HP. See the
+[recovery comparison](npc-regeneration.md#special-attack-recovery-comparison).
Validation passed: full Go suite733.402s (gamedata7.570s), final browser/special
checks79.754s, focused race checks107.991s, and vet. One crash child exceeded its
diff --git a/server/weapon_special_animation_test.go b/server/weapon_special_animation_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/binary"
"testing"
+ "time"
)
func TestWeaponSpecialQueuesActionBeforeResultAndLockOnlyForVisibleClients(t *testing.T) {
@@ -69,6 +70,64 @@ func TestWeaponSpecialQueuesActionBeforeResultAndLockOnlyForVisibleClients(t *te
}
}
+func TestWeaponSpecialRecoveryWaitsForBothCombatantsToStop(t *testing.T) {
+ for _, name := range []string{"fast", "fling"} {
+ t.Run(name, func(t *testing.T) {
+ var world *server
+ var owner *combatTestConn
+ var request []byte
+ if name == "fast" {
+ world, owner = newFastAttackWorld(t)
+ request = fastAttackRequest(1, 1000000)
+ } else {
+ world, owner = newRangedWorld(t)
+ request = flingShotRequest(1, 1000000)
+ }
+ player, target := world.characters[1], world.characters[1000000]
+ target.health = 80
+ start := time.Now()
+ world.clients[1].regenerationAt = start.Add(time.Hour)
+ observer := &combatTestConn{}
+ world.characters[2] = &character{id: 2, playfield: 950, health: 100}
+ world.clients[2] = &worldClient{id: 2, conn: observer, target: true, ready: true, npcs: map[uint32]bool{1000000: true}, regenerationAt: start.Add(time.Hour)}
+ if err := world.handleCombat(world.clients[1], attackPacket(1, target.id)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceRegeneration(start)
+
+ if err := world.handleWeaponSpecial(world.clients[1], request[20:]); err != nil {
+ t.Fatal(err)
+ }
+ damaged := target.health
+ owner.packets, observer.packets = nil, nil
+ if err := world.handleCombat(world.clients[1], stopFightPacket(1)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceRegeneration(start.Add(2 * time.Second))
+ if target.health != damaged || target.fighting != 1 || player.fighting != 0 || len(owner.packets) != 1 || len(observer.packets) != 1 {
+ t.Fatal("stopping the special attacker corrected HP during NPC retaliation")
+ }
+ player.position = [3]float32{100, 0, 0}
+ world.advanceCombat(start.Add(3 * time.Second))
+ world.advanceRegeneration(start.Add(4 * time.Second))
+ world.advanceRegeneration(start.Add(4 * time.Second))
+
+ if damaged >= 80 || target.health != damaged+1 || target.fighting != 0 || target.regenerationSeconds != 4 {
+ t.Fatalf("special recovery changed damage or recovery phase: damaged=%d target=%+v", damaged, target)
+ }
+ for _, output := range []*combatTestConn{owner, observer} {
+ if len(output.packets) != 3 ||
+ binary.BigEndian.Uint32(output.packets[0][16:20]) != 0x4a41203e || binary.BigEndian.Uint32(output.packets[0][24:28]) != 1 ||
+ binary.BigEndian.Uint32(output.packets[1][16:20]) != 0x4a41203e || binary.BigEndian.Uint32(output.packets[1][24:28]) != target.id ||
+ binary.BigEndian.Uint32(output.packets[2][16:20]) != 0x3710256c || binary.BigEndian.Uint32(output.packets[2][24:28]) != target.id ||
+ binary.BigEndian.Uint32(output.packets[2][29:33]) != damaged+1 || !bytes.Equal(output.packets[2][33:45], make([]byte, 12)) {
+ t.Fatalf("expected both stops before the quiet HP correction: %x", output.packets)
+ }
+ }
+ })
+ }
+}
+
func TestWeaponSpecialDoesNotQueueAnActionForAnotherCombatTarget(t *testing.T) {
world, output := newFastAttackWorld(t)
player := world.characters[1]