Skip to content

Commit

Permalink
Add networking examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Feb 22, 2024
1 parent 603f305 commit 01a0217
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/src/multiplayer/connector/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,22 @@ participants. This is indicated by the fourth highest bit of the flags byte

Package payload comprises the user data intended for delivery.

For example, the datagram carrying a semi-reliable package with ID 107907,
targeted to the server and containing the payload bytes `0x12 0x34 0x56`, would
look like this: `0x50 0x01 0xA5 0x83 0x12 0x34 0x56`.

1. `0x50` (`0b0101_0000`) – flags: semi-reliable, server targeted.
1. `0x01 0xA5 0x83` – package ID: 107,907
1. `0x12 0x34 0x56` – package payload

## Protocol Control

Currently, the only type of control datagram is the delivery confirmation
datagram. All bits in the header of these datagrams, except for the first one,
are set to 0. The payload consists of IDs for all user data datagrams that have
been sent reliably and delivered successfully. Each ID is encoded using 3
bytes.

Datagram with confirmation of 3 packages with IDs 1238, 17 and 2443
respectively would look like this `0x80 0x00 0x00 0x00 0x00 0x04 0xD6 0x00 0x00
0x11 0x00 0x09 0x8B`.

0 comments on commit 01a0217

Please sign in to comment.