#84: the replicant salvo now HOMES AT THE LIVE TARGET -- the stale-point double detonation is gone

Oracle (674): "missile appear to register hit explosions twice, once where
target was and again where the target is".  Rajel (693): "once where the mech
was when I fired and on the expected impact".

MECHANISM, measured on two nodes (BT_PROJ_LOG "DET at" now logs EVERY contact
detonation, including damage-0 rounds, which were invisible before): the
replicant salvo mirror pushed rounds with NO entity handle at the FROZEN
fire-time aim point, and the pool's contact test is proximity to p.targetPos --
so mirror rounds "contacted" the empty air where the target USED to be and
detonated there, on every peer, every salvo (45 salvos -> 234 frozen-point
air bursts in a 200s bench).  The true impact appears at the live position
(the shooter's own homing rounds on his node; the victim's damage reaction on
peers) -- two sites per salvo, exactly as reported.

THE BINARY'S MODEL (CLASSMAP, Missile flight-entity cluster): missiles are
ENTITIES with authoritative/GHOST Performance variants (Projectile
PTR_LAB_005129e8 / 005129f4) and their own WriteUpdateRecord (@4bef4c, slot 7)
-- peers ran ghost missiles updated from the wire and saw the TRUE trajectory.
One explosion, correct place, every node.  The frozen-point mirror is the port
infidelity (the entity Missile itself stays blocked by the documented 2007
Entity-base mismatch; mislanch.cpp:301).

FIX: the MissileLauncher update record now carries the locked target's EntityID
(salvoTargetID; EntityID::Null = point fire).  The mirror resolves it on the
receiving node via HostManager::GetEntityPointer (engine T0, an index-socket
Find -- NULL-safe on any ID), refuses non-mechs via BTIsRegisteredMech, and
pushes the mirror rounds WITH the handle -- they re-lead on the live local
replicant exactly as the master's own rounds do, and detonate at the true
position.  Guards: record-length gate (a short record from an older build has
no ID field -- its tail would be garbage and must not resolve) + Null check +
registered-mech check.

VERIFIED (two nodes, 200s, missile autofire both ways):
  * every record arrives len=52/52 with sane aims ([mlrec] diag)
  * 22/46 salvos resolve (tgtID=3:22 -> the victim's local master) and their
    mirror rounds home: the frozen-air DET population fell 234 -> 102, the
    live-homing population rose to 155/207 per node
  * the unresolved remainder is BENIGN and correct: EntityID::Null point fire
    plus hostID=-1 LOCAL entities -- i.e. the victim's WRECK, which autofire
    keeps shooting after the kill; a wreck does not move, so the frozen aim IS
    its true position
Downstream expectations: Ronin's smoke-screen (#114) should drop by ~the mirror
half, and the audio census (#32) loses the duplicate Static3DPatchSource
explosion sounds on peers -- both to be read from the next field logs.

Also in this commit: [projectile] DET diagnostic (every contact detonation with
position/damage/handle/aim), [mlrec] record-arrival diagnostic (len/recID/
subsys/counter/aim, capped 200), scratchpad/night9/mp_double.sh.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-08-02 02:29:58 -05:00
co-authored by Claude Opus 5
parent 3354db4bd1
commit da70bd58b2
5 changed files with 106 additions and 4 deletions
+45 -2
View File
@@ -63,6 +63,10 @@
#if !defined(TESTBT_HPP)
# include <testbt.hpp>
#endif
#if !defined(APP_HPP)
# include <app.hpp> // #84: application -> host manager
#endif
#include <hostmgr.hpp> // #84: HostManager::GetEntityPointer (salvo target resolve)
#include <math.h>
// WAVE 7 Phase B -- the port-side flying-projectile service (defined in mech4.cpp, a
@@ -99,6 +103,7 @@ namespace {
int fired; // master: salvos launched
int seen; // replicant: last counter applied (-1 = unsynced)
Point3D target; // master: the last salvo's aim point
EntityID targetID; // master: the locked target (#84; Null = point fire)
};
BTSalvoState gSalvoTable[64];
@@ -117,6 +122,7 @@ namespace {
s.fired = 0;
s.seen = -1;
s.target = Point3D(0.0f, 0.0f, 0.0f);
s.targetID = EntityID::Null;
return s;
}
}
@@ -362,6 +368,8 @@ void MissileLauncher::FireWeapon()
BTSalvoState &s = BTSalvoOf(this);
++s.fired;
s.target = targetPos;
s.targetID = (target != 0)
? ((Entity *)target)->GetEntityID() : EntityID::Null;
}
Check_Fpu();
}
@@ -384,6 +392,7 @@ void
rec->salvoCounter = s.fired;
rec->salvoRounds = missileCount;
rec->salvoTarget = s.target;
rec->salvoTargetID = s.targetID;
}
void
@@ -392,6 +401,19 @@ void
MechWeapon::ReadUpdateRecord(message); // @004b964c (alarm apply)
MissileLauncher__UpdateRecord *rec = (MissileLauncher__UpdateRecord *)message;
if (getenv("BT_PROJ_LOG"))
{
static int s_rr = 0;
if (s_rr++ < 200)
DEBUG_STREAM << "[mlrec] len=" << (int)rec->recordLength
<< "/" << (int)sizeof(MissileLauncher__UpdateRecord)
<< " recID=" << (int)rec->recordID
<< " subsys=" << (int)rec->subsystemID
<< " ctr=" << rec->salvoCounter
<< " n=" << rec->salvoRounds
<< " aim=(" << rec->salvoTarget.x << "," << rec->salvoTarget.y
<< "," << rec->salvoTarget.z << ")" << std::endl;
}
BTSalvoState &s = BTSalvoOf(this);
if (s.seen < 0)
{
@@ -422,8 +444,27 @@ void
if (mid >= 0)
BTMissileThrustOf(mid, &tBurn, &tAccel);
}
// #84 -- home the mirror at the LIVE target, as the binary's GHOST
// missiles did. The record carries the master's locked-target entity
// ID; resolve it against THIS node's registry (the victim's local
// master or replicant -- both track the true position here). The
// frozen salvoTarget remains the launch aim + the fallback for point
// fire, unresolved IDs (target died / not yet replicated here), and
// short records from older builds (length-gated: a stale-build record
// has no ID field and its tail would be garbage).
Entity *mirror_tgt = 0;
if (message->recordLength >= (int)sizeof(MissileLauncher__UpdateRecord)
&& !(rec->salvoTargetID == EntityID::Null)
&& application != 0 && application->GetHostManager() != 0)
{
mirror_tgt = application->GetHostManager()->
GetEntityPointer(rec->salvoTargetID);
extern int BTIsRegisteredMech(Entity *e);
if (mirror_tgt != 0 && !BTIsRegisteredMech(mirror_tgt))
mirror_tgt = 0; // resolved to a non-mech: refuse
}
for (int i = 0; i < n; ++i)
BTPushProjectile(mz, owner, 0 /*no entity: aim point only*/,
BTPushProjectile(mz, owner, mirror_tgt /*#84 live target; 0 -> point*/,
rec->salvoTarget, spd, 0.0f /*VISUAL*/, &launchVelocity, 1,
subsystemID /*per-round detonation resolve on this node*/,
0, GetSegmentIndex() /*task #67 mount frame*/,
@@ -431,7 +472,9 @@ void
if (getenv("BT_PROJ_LOG"))
DEBUG_STREAM << "[projectile] REPLICANT salvo x" << n
<< " at(" << rec->salvoTarget.x << "," << rec->salvoTarget.y
<< "," << rec->salvoTarget.z << ")\n" << std::flush;
<< "," << rec->salvoTarget.z << ")"
<< " tgtID=" << rec->salvoTargetID
<< " resolved=" << (void *)mirror_tgt << std::endl;
}
}