MP cross-pod damage ROOT-CAUSED: EntityID localID corrupted by hostID on the wire (task #47)

Traced the dispatched-message delivery end to end with BT_MP_NET /
BT_MP_FORCE_DMG. Everything works except one wire step:
- A's Entity::Dispatch reroutes the replicant's TakeDamage
  (application->SendMessage(ownerID=3, EntityManager, msg)); POST-Dispatch
  the message carries entityID=3:22 (host:local) -- the replicant's own
  ID, matching B's master (GetEntityID()==3:22). VERIFIED sent.
- On B the message ARRIVES, GetEntityPointer finds an entity, Posts it,
  the event drains (ProcessEventTask = ProcessOneEvent(0)), Event::Process
  runs, Receive finds+calls a handler. VERIFIED the full deliver chain.
- BUG: B receives entityID=3:19, NOT 3:22 -- the localID dropped by
  exactly the hostID (3) between A's send and B's receive. So
  GetEntityPointer(3:19) returns the WRONG entity (classID 48, not the
  mech 0xBB9), whose base handler ignores the unaimed hit -> 0 damage.
  Auto-replicated UPDATE records (msgID 18) arrive with the correct 3:22
  and find the mech, so the corruption is specific to the dispatched-
  message wire path/direction.

Next: the host-relative EntityID (de)serialization on the dispatched-msg
path (RoutePacket / packet EntityID encoding) -- diff vs the update path
which translates correctly. Diagnostics retained (all BT_MP_NET-gated,
off in solo -- verified: solo 22 hits, 0 probe noise).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-09 11:03:32 -05:00
co-authored by Claude Fable 5
parent a9c3e96f20
commit c78662a0f1
8 changed files with 86 additions and 18 deletions
+6
View File
@@ -98,6 +98,12 @@ void
//
Receiver::SharedData *sharedData = GetSharedData();
Handler handler = sharedData->activeMessageHandlers->Find(what->messageID);
// MP DIAGNOSTIC (task #47): for a TakeDamage (msgID 21), report whether a
// handler is found on this receiver (the cross-pod delivery endpoint).
if (what->messageID == 21 && getenv("BT_MP_NET"))
DEBUG_STREAM << "[mp-recv2] Receive TakeDamage this=" << (void*)this
<< " handler=" << (handler != Receiver::NullHandler ? "FOUND" : "NULL")
<< "\n" << std::flush;
if (handler != Receiver::NullHandler)
{
(this->*handler)(what);