#82 peers see a limping mech SKATING: the mech erased its own gimp cell every frame

The binary's one mech+0x40 IS Simulation::simulationState, which rides EVERY
update record header -- so in 1995 a peer's replicant learned the gimp level on
every packet and its gait limped with no gimp-specific replication anywhere.
The port's Mech::PerformAndWatch wrote SetMovementMode(1) every frame ("ground,
non-death, non-airborne"), which erased the level once it was mirrored in for
the warning voice (#78): the wire carried 1, bystanders walked while sliding at
limp speed, and the voice sequence restarted on every damage event (1->4 edge
per tick) instead of announcing once.

- mech4: that per-frame write now writes the AUTHORITATIVE level
  (gimped ? 3/4 : 1) via a new alarm-only bridge BTMechGimpAlarmLevel -- which
  deliberately never consults the cell it feeds, so a respawn-cleared alarm
  cannot re-latch stale gimp out of it.
- BTMechGimpLevel: falls back to the replicated cell, with ONE-CELL precedence
  (a fall/death/limbo state wins, so the normal drivers and their death latch
  run -- what the binary's single cell enforced structurally).
- Reverted the #78 record guard: on a replicant the master's records are
  authoritative, so pinning 3/4 against them would keep a peer limping through
  a respawn.  Fixed at the writer instead.
- [simstomp] trap now scoped to the watched mech with a module-relative return
  address (symcrash-able) -- that is what named the writer.
- Also learned + recorded: zone damage levels replicate only when the EXPLOSION
  TABLE's tier is crossed (peer measured at 0.428 vs master 0.857), so peer-side
  damage state must never be inferred from them.

Verified two-node (scratchpad/night6/mp_skate.sh): the observer's replicant gets
sim=4 and its gait runs 23 -> 25 (wgr entry -> ggl limp cycle).  Field clue that
cracked it: "after respawning a peer DID see the limp" (epilectrik/SAURON).
KB: locomotion.md + gotcha #25.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-07-29 22:29:03 -05:00
co-authored by Claude Fable 5
parent 98907f45af
commit e1c15eb806
6 changed files with 180 additions and 35 deletions
+15 -22
View File
@@ -2176,21 +2176,14 @@ Logical
// airborne 3,4) tracks the master automatically; the case-0 / tail edge
// tests below then see the old->current transition.
//
// #78 GIMP-MONOTONIC RECORD GUARD: the binary's mech+0x40 is one cell, so its
// records always carried the live gimp level (3/4). The port's mirror write
// (mechdmg) can be STOMPED by a record whose simulationState was captured
// pre-gimp -- and the loopback then perpetuates the stale value forever
// (write captures the stomped 1, read re-applies it): the "reverse disabled"
// voice sequence restarted on every damage tick and never reached the voice
// note. Gimp is monotonic within a life, so a record carrying <=1 while the
// live state is 3/4 is stale by construction: patch the RECORD field to the
// live value before the base read -- SetState then dedupes (no edge, no
// restart) and the next WriteUpdateRecord captures 3/4, converging the loop.
#define BT_GIMP_SAFE_BASE_READ(msg) \
do { unsigned _cur = GetSimulationState(); \
if ((_cur == 3 || _cur == 4) && (msg)->simulationState <= 1) \
(msg)->simulationState = _cur; \
Simulation::ReadUpdateRecord(msg); } while (0)
// (#78 history: a "gimp-monotonic record guard" briefly lived here, patching
// incoming records that carried a pre-gimp simulationState. It was treating a
// symptom -- the real cause was the mech's own per-frame SetMovementMode(1) in
// PerformAndWatch erasing the gimp level from that one cell every frame, found
// with the [simstomp] trap and fixed at source (mech4.cpp). The guard is gone
// because on a REPLICANT it would have been actively harmful: the master's
// records are authoritative, so pinning 3/4 against them would have kept a
// peer's mech limping forever through a respawn.)
void
Mech::ReadUpdateRecord(Simulation::UpdateRecord *message)
@@ -2296,7 +2289,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
} // FUN_0041bd34
bodyTargetSpeed = record->speedDemand; // @0x6b4 <- rec+0x10
@@ -2326,7 +2319,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
}
bodyResetLatch = record->legResetLatch; // @0x658 <- rec+0x10
@@ -2351,7 +2344,7 @@ void
case 4: // orientation + angular-velocity re-sync
{
Mech__ResyncUpdateRecord *record = (Mech__ResyncUpdateRecord *)message;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
creationTime = Now(); // @0x778 -- the dead-reckon ref time
{
EulerAngles e(Radian(record->eulerX), Radian(record->eulerY),
@@ -2390,7 +2383,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
}
heatAlarm.SetLevel(record->heatLevel); // @0x450 <- rec+0x10
@@ -2421,7 +2414,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
}
heatAlarm.SetLevel(record->heatLevel);
@@ -2454,7 +2447,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
}
heatAlarm.SetLevel(record->heatLevel);
@@ -2482,7 +2475,7 @@ void
// real payload (simulationState). BT_T2_CLOCK restores the old stamp (A/B).
static const int s_t2clock = getenv("BT_T2_CLOCK") ? 1 : 0;
const Time savedLastUpdate = lastUpdate;
BT_GIMP_SAFE_BASE_READ(message);
Simulation::ReadUpdateRecord(message);
if (!s_t2clock) lastUpdate = savedLastUpdate;
}
airborneSelect = record->airborne; // @0x3f4 <- rec+0x10