SReverseby Simpa Labs

Unity protocols

Rebuilding a Unity game’s network protocol as a working client

A useful protocol client completes the same task as the game: sign in, send the right messages and read the result. Recovering the message format is the first step toward that working flow.

Follow one complete exchange

Start with an action whose result you can check, such as reading an inventory. Record the connection setup, login exchange, inventory request and reply. Match those events to the app’s transport code. A capture provides the bytes; the code helps explain where fields come from and how the app uses the answer.

A Unity build can use HTTP, WebSocket, UDP or a custom TCP protocol. Choose the parser after identifying that transport. For an IL2CPP build, pair the executable with its matching metadata before following the send and receive methods. Our IL2CPP backend analysis covers that link between recovered methods and observed calls.

A TCP read is not a whole message

A message can arrive across several reads, and one read can contain several messages. The Python socket guide explains why a protocol needs its own message boundaries. Read the app’s framing code to establish the length field, byte order and header size.

Our downloadable teaching fixture uses a four-byte, big-endian payload length. It buffers partial data, emits complete frames and keeps the remaining bytes for the next read. This is an owned example format, not a claim about Unity’s default networking.

00 00 00 0f | hello:session-A
00 00 00 07 | stock:7

The test splits the combined stream at every byte position. It also feeds it one byte at a time. Both paths must return the same two messages. A length above the fixture’s limit fails before the parser waits for that much data.

Recover field meaning through changes

Change one input and compare the request and reply. An integer that stays fixed across two captures is a candidate message type, not proof. Confirm it in the dispatcher or through more controlled exchanges. Separate sequence numbers, timestamps and session values from business fields.

Keep an evidence table beside the client: byte range, proposed type, source method and observed effect. Mark unresolved fields as unresolved. This avoids giving a useful-looking name to a value that later breaks another message.

Reconnect with the right state

A new connection needs its own receive buffer. Feeding a partial old frame into the next connection corrupts the new session. Then follow the app’s login or resume exchange and restore the server’s sequence rules. Retry a read differently from an action that spends currency or changes account state.

The fixture checks a discarded partial frame and a fresh session greeting. A production client also needs tests against the app’s actual timeout, heartbeat and reconnect paths. Save the request ID and confirmed result so a lost response does not trigger a repeated action.

The finished result

The delivery is a client with usable methods, decoded responses and session handling, plus the protocol notes and tests behind those methods. For a custom transport, the executable client carries the protocol; the documentation explains it. See binary protocol reconstruction and delivery formats.

Download the owned protocol and state tests. Run python3 verify.py. The tests exercise framing and state logic locally; they do not connect to a game server.

Reviewed 22 October 2026 · SReverse research desk

Start your full APK reconstruction

Send the full APK

Projects start at $70. Choose WhatsApp or email, then attach the APK in the app that opens. We reply within one hour with the next step and send the fixed quote after review.

Want us to contact you?