The original network protocol (executable)

How the Store build’s versus mode talks between machines, read from PDUWP.exe only (image base 0x140000000). Nothing here was checked against a capture or footage, so everything is M (read in code, meaning inferred) unless marked; the message table itself is H (dumped from the data section). Message names are paraphrased. The platform session / mesh layer below the datagram send (0x1400b1990) is in “Session, mesh and lobby layers under the battle protocol” (netcompat).

Shape

Message table

At 0x1403fb4d0, 26 entries of 40 bytes, ended by a size of 0 (H):

off type field
0x00 u32 payload size in bytes
0x04 u32 reliable: 1 = sequence number, resend until acknowledged
0x08 u64 queued: 1 = taken from the per-type 16-slot queue by the generic sender 0x14027bfc0
0x10 ptr sender(buffer, manager): fills the payload, returns 1 when there is one
0x18 ptr receiver(sender’s player index, manager); payload at manager + 0x40
0x20 ptr name string
# size rel. queued sender receiver carries
0 40 – – 0x14027c080 0x14027c4f0 player position and state
1 8 – – 0x14027c0b0 0x14027c610 cards on the four buttons
2 28 yes yes 0x14027c110 0x14027c660 fire start (cast begins)
3 96 yes yes 0x14027c130 0x14027c6a0 fire (skill object spawn)
4 28 yes yes 0x14027c150 0x14027c6e0 skill object control
5 96 yes yes 0x14027c170 0x14027c760 skill object end
6 28 yes – 0x14027c190 0x14027c7e0 stage record A
7 32 yes – 0x14027c200 0x14027c810 stage object event
8 12 yes yes 0x14027c2b0 0x14027c8b0 capsule state
9 28 yes yes 0x14027c2d0 0x14027c8d0 environment entry
10 12 yes yes 0x14027c2f0 0x14027c930 environment capture request
11 4 yes yes 0x14027c310 0x14027c950 card into / out of a button of another player
12 16 yes yes 0x14027c330 0x14027c9f0 capsule point move
13 4 yes yes 0x14027c350 0x14027ca30 health / aura / level change on another player
14 6 yes yes 0x14027c370 0x14027cb00 status slot value
15 4 yes yes 0x14027c390 0x14027cbf0 draw countdown restart
16 2 yes yes 0x14027c3b0 0x14027cc10 player capture request
17 3 yes yes 0x14027c3d0 0x14027cca0 player capture answer
18 1 yes yes 0x14027c3f0 0x14027cdc0 player revive
19 4 yes yes 0x14027c410 0x14027ce50 no-damage timer
20 6 yes yes 0x14027c430 0x14027ce90 damage effect on the sender’s body
21 28 yes yes 0x14027c450 0x14027cee0 warp
22 8 yes yes 0x14027c470 0x14027cf80 ready to start
23 4 yes yes 0x14027c490 0x14027cf90 knockout tally
24 6 yes yes 0x14027c4b0 0x14027cfd0 hit log line
25 4 yes yes 0x14027c4d0 0x14027d040 player out (retired)

Net manager

Global pointer 0x140527bd0 (constructor 0x14027a910, reset 0x14027aa90, queue allocation 0x14027bee0).

off field
0x004 / 0x008 / 0x00C message count, total payload size, reliable count (from the table)
0x010 u32[4]: newest tick seen per sender
0x020 tick field of the packet being read
0x028 / 0x030 packet build buffer / staging buffer
0x040 / 0x048 read or write cursor / packet length
0x050 + type·0x28 per-type state: u32 next sequence, u32 pending entry size (payload + 0x18), pending list (20 entries), acknowledge lists (4 senders × 10 u32), ring index, history (4 senders × 50 u32)
0x500 per-peer saved packets
0x508 send counter
0x50C..0x514 bandwidth meter (bytes rounded up to 8, + 45 per packet, averaged every 15 sends)
0x518 / 0x718 voice bytes (up to 0x200) / their length
0x740 26 queue pointers

A queue has 16 slots of {u32 used, payload}. The game code that raises an event writes the slot itself (no common push routine); when all 16 are in use the message is dropped without notice. The generic sender takes one entry per packet, so each queued type goes out at most 15 times per second.

Other globals: local player index 0x1404bbe00 (net index 0x140527bc4); characters 0x1404bc9d8[4]; session member table 0x140595ea8 (records of 0x298, count 0x140594ea4); per-peer “in battle” flag 0x140527a00[4] with a countdown 0x1405279c8[4] set to 10 by each battle packet.

Packet

Send 0x14027abe0(elapsed tick, clock): invoked by the battle tick (0x14012bdc3 area) every tick in the net modes (0x1404bc9d4 = 4 or 5). On an odd clock value the player info packet (lobby type 1, 0x1401910a0) goes out with the voice bytes (corrected, netcompat); on an even one a game packet per peer. Also from the phase 2 wait (0x140129c42, tick 0) and from every 8th stalled tick (0x14012bc58). Outside the battle a second sender (0x14027b480, every 3rd frame, packet types 0, 5, 6, 7, 8 through 0x140191570) handles the lobby side: decoded in “Session, mesh and lobby layers under the battle protocol”.

Datagram wrapper (0x140125430(peer, buffer, length, voice, voice length)), 8 bytes (L for the meanings of the constant words):

off type field
0x00 u16 length = game packet length + 6
0x02 u16 0x1200
0x04 u16 packet type, 8 = battle data
0x06 u16 session word (0x140594e80)

then the game packet, then the voice bytes. Voice is added only for peers of the same team, or for everyone while status slot 37 is set on the sender.

Game packet header, 0x18 bytes:

off type field
0x00 u64 presence mask: bit i = message i is in the packet; bit 26 + k = an acknowledge for the k-th reliable type is in the packet; bit 63 = not a battle packet (lobby dispatch 0x1403e8850: see the session, mesh and lobby section)
0x08 u32 sender’s player index
0x0C u32 sender’s elapsed tick / 2
0x10 u32 clock lead report (see Clock)
0x14 u32 value of 0x140184730 (voice / role state; L)

Then, in table order, each present message: its payload, followed by a u32 sequence number when the type is reliable. Then, for each acknowledge bit, one u32 sequence number. There is no per-message length or type byte: the mask and the table sizes define the layout. A packet holds at most one message of each type. In the staging buffer each message is led by a u32 destination mask (bit per player index, from the in-battle flags); in practice every message is addressed to all peers in the battle.

Reliability (own layer above the datagrams):

Clock

Messages

All multi-byte fields little-endian. “C” is a character, “local” means simulated on this machine.

0 Position and state (unreliable, in every game packet; builder 0x1402502a0; sent while C + 0x28 is set):

off type field
0x00 u64 status mask: bit s = status slot s is active (47 slots)
0x08 f32[3] position
0x14 s32 knockout tick (C + 0x68), −1 = alive
0x18 u16 facing (15-bit angle units) (netmsg: captured values use the full 16 bits, 0..65535 a turn)
0x1A s16 forced environment skill id: only in mode 5 (0x1404bc5dc) from the session owner, else −1
0x1C s16 looping id C + 0x13b34 (L)
0x1E s16 looping id C + 0x13b48 (L)
0x20 u8 action id (C + 0x12fc4)
0x21 u8 animation frame (whole part)
0x22 u8 aura (whole part)
0x23 u8 aura level
0x24 s8 lock target index (C + 0x13f20) (netmsg: in a captured 1v1 it is the opponent’s index from tick 0 to the knockout, lock held or not)
0x25 s8 health
0x26 u8 cards left in the deck
0x27 u8 1 = the sender’s draw countdown has run out

Receiver: the sample goes to the remote state (below); health and deck count are written at once; a knockout tick going from set back to −1 revives the body (C + 0x24 = 1); a set byte 0x27 forces the own draw countdown to 0. Position carries no velocity and no input.

1 Button cards (unreliable, every packet): s16[4], the skill id on each button, −1 = empty. Receiver 0x14024dd90 writes the remote player’s slot ids and states.

2 Fire start (sender 0x14025ca20, when the local character starts a cast action):

off type field
0x00 u32 cast id (the character’s counter C + 0x48)
0x04 u32 tick
0x08 f32[3] position
0x14 s16 skill id
0x16 u16 action object + 0x88
0x18 s8 target object index into 0x1404bcb50[32], −1 = none
0x19 u8 action state

Receiver 0x14018fae0 queues it (8 entries, duplicates by cast id against the last 8 applied dropped); the remote update applies it (0x14018fd50): position, skill, target, the cast action starts (0x14025a3e0) and holds until its tick.

3 Fire (sender 0x1402632b0, when the local character’s skill object is created):

off type field
0x00 u32 cast id
0x04 u32 tick
0x10 f32[16] spawn parameters: four 4-float vectors (start point and aim data as the spawn routine takes them)
0x50 s16 skill id
0x52 s16 parameter
0x54 u16 uses left on the button
0x56 u16 C + 0x12f6c
0x58 u16 facing
0x5A u16 parameter
0x5C u8 button index
0x5D s8 target player index when the record’s 0x52 is 1, else −1
0x5E u8 slot object + 0x48

Receiver 0x14018fc70 queues it (8, same duplicate rule); applied by 0x14018ff00: lock target and use count set, then the skill object(s) are spawned with the same routine the shooter used (0x140263a00), one per muzzle point (count from 0x14018a310, object ids cast id + n). From there each peer flies the shot itself.

4 Skill object control (sender 0x14026d7d0): {u32 object id, f32[3] vector @4, f32 @0x10, s32 @0x14, u8 owner @0x18, s8 target index @0x19}. The receiver finds the owner’s object by id and stores the values, the target and object state 2 (0x14026d890; used by behaviours 7, 0xF, 0x10 of set 0: the steered and re-aimed kinds).

5 Skill object end (sender 0x14026da70, from the end routine 0x14026cd70 when the object’s flag 0x1000 is set): {u32 object id, 64 bytes final state @0x10, u8 owner @0x50, u8 end reason @0x51, u8 @0x52}. Receiver 0x14026db30 accepts it when the object waits for its owner’s word (flag bit 13 and sender = owner) or for anyone’s (bit 14), copies the state and runs the end routine with that reason. So for the kinds that set flag 0x1000 (kinds 3, 0xC, 0xD, 0xE when the owner is local) the end of the object is announced instead of left to each peer’s own flight. (netmsg: in the capture most of these messages come from the victim’s machine for the attacker’s object, reason 2 with its hit; the owner’s own carry reason 1.)

6, 7 Stage (reliable, built in place, not queued): 6 = hit reaction records (28 B) from 0x14059ca30 while the count 0x140530cc4 is non-zero (receiver 0x1402020f0); 7 = a first-in-first-out list at 0x14059ba30 (count 0x140530cc0) of 32-byte stage object events, handed to that stage object (0x1401fd330). (Corrected, stageobj2: the field layouts given here earlier were wrong; the record layouts, codes, writers and the time-stamp rule are in “Stage objects: other families”, “Stage events on the net and the stage clock”.)

8 Capsule state (sender 0x14014fb30, only for the local player’s own capsules):

off type field
0x00 u32 tick
0x04 u16 timer
0x06 s16 skill id, −1 = taken / empty
0x08 s8 player
0x09 s8 capsule index 0..2
0x0A u8 1 = play the appear effect

Receiver 0x14014fbe0 writes that player’s capsule record (waiting with timer / present / empty).

9, 10, 11 Environment entry, capture request, card into a button: as in “Status slots, hit effects and environments in full”. 11 = {u16 skill id (0xFFFF = clear), s8 target player @2, s8 button @3}; acted on only by the target player’s own machine (0x140261a00 puts the card, 0x140262fc0 clears).

12 Capsule point move: {f32[3] position, s8 player @0xC, s8 capsule index @0xD} into the capsule position table 0x140585c90.

13 Change on another player: {s8 target player, s8 health change, s8 aura change, s8 level change}; acted on only by the target’s own machine (steals and gifts from hit effects).

14 Status slot: {u16 ticks, s8 player @2, s8 slot @3, s8 timed value @4, s8 base value @5}; sent by the slot refresh 0x14024d6d0 for local characters and slots 0..3 only (the four stat slots, whose values matter); every receiver writes it. All other slots travel as the mask in message 0.

15 Draw countdown restart: payload unused. The countdown (0x1404bc94c) goes back to 3600 when it is running (0x14012a6c0; raised by a capsule take, a health change, environment events and hit effects). When it reaches 0 the match clock is cut to 1800 if it is larger; that expiry also travels in message 0 byte 0x27.

16, 17, 18 Player capture (a knocked-out player taken into a button and revived):

19 No-damage timer: {u32 ticks} (sender 0x140252400: pit return, respawn); sets the sender’s timer C + 0x6434 on every peer.

20 Damage effect: {s16 effect id, s16 kind, s16 cue id} (sender 0x1402594b0, local character); the receiver plays it on the sender’s body (0x1402506c0).

21 Warp: {f32[3] position, f32[3] vector @0xC, s16 @0x18, s16 @0x1A}, sent inside the action start 0x140257e90 by the mover; the receiver sets position and previous position and starts the same action (teleports skip the interpolation this way).

22 Ready to start: {u32 C + 0x60 (L), u32 0x1404bc8a8[player] when 0x1404bcb34 is set, else 0}; sent once (latch 0x1404bca24) from the phase 2 wait 0x140129fb0 when the own loading is done. Receiver 0x14012d780 (phase 2 only) stores both and sets ready 0x1404bbe10[sender]; the match starts (0x1404bbca4) when every present player is ready.

23 Knockout tally: s8[4] = the sender’s column of the tally 0x1404bc970 (tally[attacker] [victim]); sent by the knocked-out player’s machine from its knockout routine 0x140250b60 after it adds one for its last attacker (C + 0x12e90).

24 Hit log line: {s16 skill id, s16 damage, s8 attacker, u8 effect flag}; sent by the victim’s machine from the hit routine; the receiver adds the HUD hit-log entry (0x140157b80) and, when the attacker is local, keeps the largest damage dealt.

25 Player out: {u32 knockout tick}; sent when the local player retires or leaves (pause menu, flow cases of 0x14012a380) after setting the own health to 0; receivers (phase 2..6) set retired 0x1404bca08[sender] and the knockout tick if unset.

Remote characters

Remote state R = C + 0x16900:

off field
0x00 playback tick
0x04 newest sample tick
0x08 previous sample tick, −1 = none
0x0C action hold tick (from fire messages)
0x10 f32 animation speed
0x18 initialised
0x20 the character
0x28 16 samples of 0x38 bytes, newest first

Authority

decision who decides how the others learn
A cast and its shot the caster messages 2, 3 (4, 5 for some kinds); everyone flies the shot
Hit and damage on a player the victim’s machine: shots are tested against a body only when it is present, alive and local (loops at 0x140263f5a, 0x14026e760, 0x140265fb7 → 0x14026c1c0 → 0x14026f870) health in message 0, log in 24, effect in 20
Knockout the victim (stamps its knockout tick) knockout tick in message 0, tally in 23
Status on oneself the affected player mask in 0, values in 14
Steals, card moves onto another player the affected player applies, the attacker’s side asks 11, 13
Capsules (appear, taken) the owner of the capsules 8, 12
Environment capture the environment’s owner 10 → 9 + 11
Player capture the captured player, first request wins 16 → 17
Clock each peer its own, held together by the stall rule none (15 for the draw countdown)
Match end every peer on its own, from the health and knockout ticks it holds (0x14012c510) none

What a compatible peer needs, and how ours differs

A second implementation that joins the original’s battle would need all of:

  1. The platform session and mesh below the datagram send (finding peers, the connection handshake, the 8-byte wrapper, the lobby packet types and the character / deck exchange before phase 2). Not decoded here, and the session part runs through an online service.
  2. The packet: 0x18 header, presence mask, table order, sizes; the reliability layer (sequence, acknowledge, resend after 6, the 10 + 50 duplicate lists); 15 packets per second; tick / 2 and the lead report with the stall rule.
  3. All 26 receivers and their senders, with the game’s ids (skill ids, action ids, effect and cue ids, stage object indices).
  4. The same shot simulation: message 3 only gives spawn parameters, so path, speed, homing, size and lifetime of every skill kind must match the game closely enough that a shot hits or misses the same way on the victim’s machine. This is the heavy part and it is the 1:1 skill work the rebuild does anyway.
  5. Victim-side hit decisions, own capsules and deck, the 47-slot status mask, the draw countdown, player capture and the 4-player tally.

Our protocol (godot/NETPLAY.md) differs in kind, not in detail:

original ours
topology full mesh, 2..4 peers, no authority one host, one client
who simulates each peer its own body; all peers every shot the host everything; the client predicts its own body
what travels position samples 15 /s + reliable events inputs up 60 /s, snapshots down 20 /s, reliable events
hits the victim decides the host decides
randomness none shared a seed from the host
decks, capsules each peer its own dealt by the host
remote bodies blend between the last two samples, no extrapolation snapshot interpolation
late peers the others stall the host does not wait
transport own sequence / acknowledge on datagrams ENet channels

So interoperation is not a matter of a packet translator: a compatible mode would be a second net mode in which our build runs peer-authoritative (own body only, victim-side hits, own deck and capsules) and speaks the 26 messages. The combat core can serve both when “who decides a hit” and “who owns deck and capsules” are switches and not assumptions.

Not decoded

The lobby packets (dispatch 0x1403e8850, senders through 0x140191570) and where characters and decks are exchanged; the session / mesh layer and the two constant words of the wrapper; header 0x14; message 0 fields 0x1C / 0x1E; message 22’s first value; the stage messages 6 / 7 (fields, writers); which skill kinds set the “announce my end” flag 0x1000 beyond the four seen; the spawn parameter vectors of message 3 by name; whether reliable messages of one type can overtake each other in practice.

Implementation notes for the rebuild

  1. Nothing here changes the current host-authoritative netplay. Use the table as the checklist of events it must carry: cast start, spawn, object control / end, capsule state and move, environment entry and capture, card into a button, steals, status values for slots 0..3 plus a mask for the rest, draw countdown restart, player capture / answer / revive, no-damage timer, damage effect, warp, knockout tally, hit log, player out.
  2. Remote bodies in the game are shown by a two-sample blend of 15 Hz samples carrying action id and animation frame; our ghosts can take action and frame from the snapshot the same way (this is also what the missing remote reaction animations need).
  3. Keep “who decides a hit” and “who owns deck and capsules” behind one interface in the combat core, so that a peer-authoritative mode stays possible.
  4. A compatible mode, if wanted, is its own project in this order: lobby packet decode (characters, decks, phase changes), wrapper and mesh handshake, packet + reliability, message 0 / 1 exchange with a remote body shown, then casts and victim-side hits.
  5. The stall rule (ahead / 4 against 4, 8, 16, 32) and the 60-tick hard wait are the game’s whole lag handling; a 30 Hz fixed tick is required for either.