Versus network messages

The three network sections above were read from the executable alone. This one checks them against two loopback captures of a live 1v1 (11-14, the 2017 game run by Phantom Dust Rebirth on two machines; the game’s own datagrams are in clear on the loopback interface between its UDP port 43210 and the bridge’s local link port) and records what the captures confirm, correct and add. The captures are private test vectors and are not in any repository. Parser: converter/netmsg.py (structs from the tables in these sections; check, events, state, lobby modes), test converter/tests/test_netmsg.py (made-up packets). Host = net index 0, joiner = net index 1. Nothing here comes from the bridge’s code.

Result of the check (H): every datagram of both captures (18 688 and 22 926; 14 950 and 18 821 of them battle packets) parses with the layouts below to its exact length: mesh length = datagram length, wrapper length = 6 + parsed game packet, no unknown mask bit, no trailing byte. So the mesh header, the wrapper, the 0x18 game header, the mask / table-order rule, the 26 sizes, the “u32 sequence after each reliable payload” rule and the acknowledge bits are H. Field meanings are H where a row below says “seen”, else they keep the grade of the older sections.

One datagram, as captured (H)

layer bytes layout
mesh header 7 {u16 sequence, u8 type, u16 total length, u16 flags}
session wrapper 8 {u16 length = 6 + what follows it without voice, u16 0x1200, u16 type, s16 sender’s member id}
game header 24 {u64 mask, u32 net index, u32 elapsed tick / 2, u32 lead, u32 talk flag}
messages – per set mask bit 0..25, in table order: payload, then a u32 sequence when the type is reliable (types 2..25)
acknowledges – per set mask bit 26 + k (k = type − 2): one u32 sequence

Session control and lobby, as captured (H for what was seen)

Game header (H layout; lead rule corrected)

Battle messages against the capture

“Seen” = number of first sends in the action-list match and the rematch start, both directions. Sequence numbers start at 0 per type, per sender, per battle.

# message seen what the capture shows
0 position and state every packet all fields plausible: health 20 at start, deck 30 → 26 once the four buttons are dealt, knockout tick −1 until the knockout, facing 0..65535 (full 16 bits, not 15), aura level + 1 per aura card used. 0x24 is the opponent’s index from tick 0 to the knockout (then −1) whether or not the lock was held: it is the current target, not “lock held”. Byte 0x27 went to 1 on both sides at tick 3600 of an idle battle (the draw countdown). 0x1A / 0x1C / 0x1E stayed −1
1 button cards every packet −1 empty, 0 = aura card; a button shows the capsule’s card from the tick of the take and −1 after its last use
2 fire start 46 cast id rises by 1 per cast of that player (shared with message 3); 0x16 is the facing at the cast (equal to message 3’s facing unless the body turned in between); 0x18 = target player index or −1; 0x19 = 10 / 11 / 12 (ground / air / other cast state). Sent 2..30 ticks before the matching message 3 (per skill; 18 or 20 for most). Aura card uses and some button skills send no message 2, only message 3
3 fire 95 same cast id as its message 2; the 16 floats are a 4 × 4 transform: three unit axis rows (w = 0) and the spawn point (w = 1); 0x52 = 100 in every one; 0x54 = 0 in every one; 0x56 = the cast profile record (equal to the skill id for most, 343 for the aura card, a different record for an air cast); 0x5A = a small per-skill value (0..7, 0xFFFF once); 0x5C button; 0x5D target player or −1; 0x5E = 0
4 skill object control 0 not seen
5 skill object end 26 object id = the cast id; sent by the victim as well as by the owner: 17 of 26 name an object owned by the other player, with reasons 0, 1, 2, 3 (2 goes with the victim’s hit log in the same packet); the owner’s own are reason 1. 0x52 = 255
6 stage hit reaction 27 layout as in “Stage events on the net”: s16[3] point at 4, s16[3] direction × 10 at 0xA, material at 0x11
7 stage object event 45 wire order differs from the queue record (sender 0x14027c200 moves the stamp to the front): {u32 stamp @0, u8 code @4, u16 object index @6, s16[3] point @8, s16[3] direction × 10 @0xE, u8 @0x14, u8 @0x15, u8 @0x16, u8 @0x17, u32 @0x18, u32 @0x1C = record + 0x18}. Stamps are elapsed × 2 + player index (25894 from player 0 at tick 12947, 25901 from player 1 at 12950), so the factor at 0x1404bc9b4 is 2 here. Codes 0x45, 0x47, 0x48, 0x49 seen; 0x47 carried stamp 0 and 200 / 205 in byte 0x14 (not followed)
8 capsule state 63 three at tick 0 (timer 0, the dealt card, 0 = aura capsule); then one per take: timer 420, skill = the next card drawn into that slot, tick = the take; when the deck is used up, skill −1 timer 0. 0x0A = 1 once
9 environment entry 3 {f32[3] point, u32 start tick, u32 end tick, u32 stamp, s16 skill, u8 owner, u8 flags}: end = start + 1800 at the cast; after a capture the owner re-sends it with end = stamp = the capture tick
10 environment capture request 1 {u32 the entry’s start tick, u32 capture tick, u8 owner, u8 0}; answered in the owner’s next packet by the re-sent entry (9) and a message 11 that puts an aura card (skill 0) on the capturer’s button 0
11 card into / out of a button 2 0xFFFF = clear: seen once from the opponent, the target’s button went to −1 two ticks later; and the capture answer above
12, 13, 16, 17, 18, 21, 25 0 not seen (no capsule move, steal, player capture, warp, retire in a 1v1 on this stage)
14 status slot 52 at tick 0 each player sends slots 0, 1, 2, 3 three times round (12 messages, all values 0), one per packet; none later (no stat slot changed in these battles)
15 draw countdown restart 88 payload 0; seen with capsule takes, health changes and environment events
19 no-damage timer 4 value 75, sent 72..84 ticks after the heavier hits (damage 3 and 6)
20 damage effect 27 from the victim in the same packet as its hit log: {effect id = the skill id here, kind 3, cue id}
22 ready to start 2 per battle first value 1 from player 0 and 3 from player 1 (it is written to the player record + 0xCC by the receiver 0x140250480; a per-player set-up value, L for its name); second value 0. Sent during the tick 0 wait
23 knockout tally 2 from the knocked-out player in the knockout packet: column {1, 0, 0, 0} = one for attacker 0
24 hit log line 34 from the victim at the hit: skill, damage (0 for effect-only hits), attacker, effect flag; the health byte of message 0 drops in the same packet

Status mask bits seen (message 0): 11 for exactly 90 ticks with each use of one defence card; 4 for 90 ticks and 9 for 450 ticks on the victim of two effect skills; 41 on both players while an environment is active (set in the packet of the entry, cleared in the packet of its end).

Reliability and timing, as captured (H)

Rules that rebuild every recorded send (netreplay 11-14; INFERRED where marked)

godot/scripts/net/pd_wire_peer.gd, played as “this machine” on both recordings (tests/test_pd_wire_peer.gd), rebuilds every reliable send, resend and acknowledge of both sides (9397 / 9397 and 7489 / 7489 packets; 8 acknowledges of the second Deck side one packet late, all at the battle 0 tick-0 burst, arrival timing). The rules:

The action-list match on the wire

Order played: stand, walk, jump, lock-on, capsule pickup, missed attack, hit, defence, erase, environment / status, slot overwrite, pause, round end, second match. What the packets show, in time order (ticks of the first battle; netmsg.py events and state print the full lists):

tick what is on the wire
0 (3.4 s) per player: 12 × message 14, 3 × message 8 (dealt capsules), message 22; message 0 with health 20, target = the opponent; message 1 with the dealt buttons
1..1300 stand, walk, jump: message 0 only. Action ids change with the position (0 standing; 1, 2, 4, 7, 12 while moving; 34 → 35 → 36 in a row, read as the jump); no reliable message at all for 43 s
lock-on nothing of its own: the target byte never changes in a 1v1; a held lock shows only as target ≥ 0 in the casts’ messages 2 / 3 (−1 without)
1302..1966 capsule pickups: message 8 (timer 420, next card) + 15; the button shows the card; an aura card use is a message 3 with skill 0 and profile 343 and the aura level + 1
1847..2228 missed attacks: message 2, then 3 after 18 ticks, target −1; nothing from the other side
2285..2416 hits: 2 + 3 (target = the victim when the lock was held); from the victim 20 + 24 + 15 and health 20 → 18 → 16, action 124 (its reaction) in the same packet
2620.. defence: message 3 only (no 2), status bit 11 for 90 ticks, action 37 → 39
9611..9636 erase: a message 11 with 0xFFFF for the other player’s button 3, which empties
11830..12696 environment: cast (2, 3), entry (9), status bit 41 on both; captured by the other player 838 ticks later: 10 → 9 + 11, bit 41 off, aura card on the capturer’s button
throughout slot overwrite: only message 1 changes (the button’s id is replaced at the take); no message of its own
– pause: no trace. The tick never repeats and packets never stop; an online battle is not held by a pause
13578..13636 the loser’s deck is used up: three message 8 with skill −1; from 13726 its health falls 1 per 90 ticks
13999 round end: message 0 with knockout tick 13999, health 0, action 103; message 23; the winner’s target byte goes to −1; ~2 s of packets, then the lobby
second match new type 2 (new start order group), tick and all sequences from 0, the same start burst

What a third-party peer must do to be accepted

From the code and the captures; “accepted” = the game keeps the peer in the member table, starts the battle and does not knock it out.

  1. Be a session member with a net index: the join through wrapper types 2 / 3 / 5 (not captured, M) or whatever the platform bridge does in its place, and an endpoint the game’s socket can send to. Send from the address the member record holds.
  2. Mesh: answer the hello, then a 7-byte heartbeat every 2 s; count the 16-bit sequence up by 1 for every datagram of any type; type 0x40, flags 0, exact total length.
  3. Stay alive: any wrapper reloads the 150-tick silence countdown; in the lobby send a lobby packet 10 times per second and answer every ping (same 16 bytes, flags | 1).
  4. Lobby: type 1 with name, side and choice until the host stops asking (type 7), type 3 with the member count, then keep-alives; take stage, variant, type and rule from net index 0 and the start table from type 2.
  5. Start: at tick 0 send messages 0 and 1, the own three capsules (8), the four stat slots (14) and message 22 reliably; the host starts only when every present player’s 22 has arrived. Acknowledge everything received.
  6. Battle: one packet every 2 ticks with tick / 2 rising by 1, messages 0 and 1 in each; keep the own tick within 60 of the peer’s or the peer stops; put the averaged lead in the packets with tick / 2 mod 30 = 15; acknowledge each reliable sequence once in the next packet; resend unacknowledged ones every 6 packets; sequences per type from 0 each battle.
  7. Be honest about the own body: the game takes health, knockout tick, deck count, buttons, capsules and status from the peer without checking, and expects the peer to test the game’s shots against its own body and to answer hits with 20 / 24 (and 5 for the shot), requests with 11 / 13 / 17, and the knockout with the tick and 23.

No checksum, version field, signature or encryption exists in layers 2 to 7: nothing in the header, wrapper or messages identifies a build, and no receiver validates more than lengths, the 0x1200 word, the member id and sequence duplicates. Version gating happens only in the session directory (platform side).

What cannot be known without the bridge (not guessed here)

Still open in the game’s own layers

Message 22’s first value by name; fire 0x52 (100), 0x54 (0 in all 95) and 0x5A by meaning; stage hit bytes 0, 0x10, 0x13.. and stage event bytes 0x14..0x1F; the reasons of message 5 by name; messages 4, 12, 13, 16..18, 21, 25 and lobby types 5, 6, 9, 21 were not exercised; a 3- or 4-player session (mesh fan-out, lead sum over several peers) was not captured.

Implementation notes for the rebuild

  1. Build the wire codec from converter/netmsg.py’s tables (they parse all 41 614 datagrams of the two captures): mesh header, wrapper, game header, 26 message structs, sequence and acknowledge placement. Port them to GDScript as data, with the same made-up test packets.
  2. A replay harness comes first: feed a recorded peer stream (netmsg.py can already split it) into the compatible mode and check that the remote body, buttons, capsules, casts and hits appear; then answer it (acknowledges, own state) and compare the own outgoing stream’s shape with the recorded one.
  3. Start burst at tick 0: 3 capsules, slots 0..3 three times, message 22; hold tick 0 until every present player’s 22 is in.
  4. Message 0’s target byte = the current target (the opponent in a 1v1) from tick 0, −1 after a knockout; facing uses all 16 bits; deck count and aura level as the game counts them (level + 1 per aura card used).
  5. Casts: message 2 at the cast start (not for the aura card or the defence kind seen), message 3 at the spawn (2..30 ticks later, per skill) with the caster’s 4 × 4 spawn transform and the cast profile record; the cast id counts all of a player’s casts.
  6. The victim ends the attacker’s shot with message 5 (reason 2 next to its 20 / 24 on a hit; reasons 0 and 3 also come from the victim’s side); the owner ends its own with reason 1.
  7. Capsules: message 8 at every take with timer 420 and the next card of the slot; skill −1 when the deck is out. Environment: 9 at the cast (end = start + 1800), status bit 41 while active, capture by 10 → 9 + 11 (aura card to the capturer’s button 0).
  8. Lead word: momentary value in every packet, the 30-send average when the send counter mod 30 is 15; read it only at tick / 2 mod 30 = 15.
  9. Stage event wire order has the stamp first; stamp = elapsed × 2 + player index.