Skip to content

Commit

Permalink
Fix networking documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Feb 22, 2024
1 parent b852f49 commit 28627df
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions docs/src/multiplayer/connector/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,23 @@ can be encoded within three bytes, after which the counter resets to 0. The ID
sequence for reliable and unreliable packages are independent. Each connection
/ client has independent reliable package numbering.

Packages can be transmitted in either reliable or non-reliable mode.
Reliability is signaled by the second highest bit of the flags byte
(represented by the mask `0b0100_0000`). Packages sent in reliable mode always
receive confirmation from the receiving party and are retransmitted multiple
times, with the time delay exponentially increasing until a confirmation is
obtained. Reliably sent packages are automatically deduplicated.

Packages can be targeted to the server. This is signaled by the third highest
bit of the flags byte (represented by the mask `0b0010_0000`). All other
Packages can be transmitted in several reliability modes as listed below. The
second and the third bit (represented by the mask `0b0110_0000`) of the flags
byte control the reliability.

* Unreliable (bits `00`) – these packages may be lost, delivered multiple times
or delivered out of order with respect to other packages.
* Unordered (bits `01`) – non-duplicate delivery of these packages is
guaranteed. There are not guarantees on ordering of these packages with
respect to other packages.
* Semi-ordered (bits `10`) – non-duplicate delivery of these packages is
guaranteed. The packages are also guaranteed to be delivered after all
previously reliably sent packages (id est all unordered and semi-ordered
packages sent by the same client before a semi-ordered package are always
delivered before the semi-ordered package).

Packages can be targeted to the server. This is signaled by the fourth highest
bit of the flags byte (represented by the mask `0b0001_0000`). All other
packages are targeted to all other players who joined the same game.

Package payload comprises the user data intended for delivery.
Expand Down

0 comments on commit 28627df

Please sign in to comment.