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
+8
View File
@@ -1140,6 +1140,14 @@ void L4NetworkManager::Send(
//Net_Common_Ptr->Buffer_Length = (short)SEND_BUFFER_SIZE(packet_size);
//send_packet_request->Socket_Ptr = l4host->GetNetworkSocket();
//NetNub::SendCommand();
// MP DIAGNOSTIC (task #47, BT_MP_NET): log every non-update send so a
// dispatched cross-pod message (e.g. TakeDamage) is visible on the wire.
// (Update records are msgID 6, ~144 bytes -- filtered out to cut noise.)
if (getenv("BT_MP_NET") && !(message->messageID == 6 && message->messageLength <= 160))
DEBUG_STREAM << "[mp-send] host=" << (long)host_ID << " client=" << (int)client
<< " msgID=" << (int)message->messageID
<< " len=" << (int)message->messageLength << "\n" << std::flush;
send(l4host->GetNetworkSocket(), (char *)my_temp_packet, packet_size, 0);
free(my_temp_packet);
// Check for errors and abort if there were any