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
+7 -5
View File
@@ -2397,9 +2397,10 @@ void
if (m == 0) continue;
Point3D mp = m->localOrigin.linearPosition;
DEBUG_STREAM << "[mp-cand] " << (void*)m
<< " entityID=" << m->GetEntityID()
<< " ownerID=" << (int)m->GetOwnerID()
<< " inst=" << (int)m->GetInstance()
<< " interest=" << m->interestCount
<< " dead=" << (int)m->IsMechDestroyed()
<< " classID=" << (int)m->GetClassID()
<< " pos=(" << mp.x << "," << mp.y << "," << mp.z << ")"
<< " zones=" << m->damageZoneCount << "\n" << std::flush;
}
@@ -2429,10 +2430,11 @@ void
Entity::TakeDamageMessageID,
sizeof(Entity::TakeDamageMessage),
GetEntityID(), -1, dmg);
DEBUG_STREAM << "[mp-force] PRE m->GetEntityID()=" << m->GetEntityID()
<< " td.entityID=" << td.entityID << "\n" << std::flush;
((Entity *)m)->Dispatch(&td);
DEBUG_STREAM << "[mp-force] dispatched TakeDamage at replicant "
<< (void*)m << " ownerID=" << (long)m->GetOwnerID()
<< " (reroute -> master via SendMessage)\n" << std::flush;
DEBUG_STREAM << "[mp-force] POST td.entityID=" << td.entityID
<< " (== what Dispatch put on the wire)\n" << std::flush;
break;
}
}