Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Joining a match

What passes between a client and a server from connection until play begins, in order.

Starting a client

A client learns where to connect from its command line. It takes three arguments it needs nothing in, which can be empty, and then a fourth holding four words separated by single spaces: the server’s IPv4 address, its UDP port, the key (see Transport), and the player id the client registers as. The client connects to that address and port, registers as that player, and enciphers its proof under that key.

A client finds each argument between a pair of double quotes, and reads nothing outside them.

In 0.8.13.26–0.9.22.13

A client whose command line holds no double quote ends.

In 0.9.25.24–1.0.0.24

Any whitespace separates the words of the fourth argument. A client whose command line holds no double quote takes the command line it saved on an earlier run instead, and one holding .rep anywhere plays a replay rather than connecting.

Registering

A client’s first payload is Register, on the registration channel. The note on Registered says what a server answers with: one answer for every seat.

A client knows the answer meant for it by the player id it registered as, not by the client id, and takes the client id that answer carries as its own. Every other answer tells it which client id stands for which player.

In 0.8.13.26–0.9.22.13

A client waits for the answer naming its own player id as long as it takes, and offers its player no choice.

In 0.9.25.24–1.0.0.24

A client waits 30 seconds for the answer naming its own player id. Then it offers its player to wait another 30 seconds or to give up, and leaves on giving up.

Asking whether a server is ready

A client then sends QueryStatus over and over. A server MUST answer each one with QueryStatusAnswer, at least until it has answered that it is ready. While the answers say the server is not ready, a client stays on a black screen and keeps asking. A server that needs time before a match can begin answers that it is not ready until it is.

A client stops asking once an answer says the server is ready, and a query it sends after that answer needs none.

Stating a build

Once an answer says the server is ready, a client sends ClientVersion once. A server answers with VersionSync, and a client loads only where its agreement says the builds agree.

In 0.8.13.26–0.9.22.13

VersionSync names neither the map nor anyone at the match: a client loads the map its own configuration names (see The client’s data).

In 0.9.25.24–1.0.0.24

VersionSync names the map to load and everyone at the match.

Taking a seat

Straight after VersionSync, a client sends JoinSide on the roster channel. A server answers with one Roster, then a SeatName and a SeatChampion for each seat a player holds.

Loading

A client reports how far loading has got with LoadingProgress, repeatedly through loading. A server answers each report with SeatLoadProgress on the transient channel, carrying the report’s figures under the seat that reported. A client goes on reporting after its progress reaches 100, until play begins.

A client waits on no other seat. SpawnStart, SpawnEnd and StartGame are what move a client on, and StartGame alone ends its loading. A server that means its players to begin together sends StartGame to none of them until every client has sent ClientReady.

In 0.9.25.24–1.0.0.24

A client writes zero where its player id goes in LoadingProgress.

In 0.9.25.24–0.9.25.35

A server MUST put the seat’s player id in SeatLoadProgress: the loading screen shows a seat’s card from the VersionSync seat with that id.

The spawn run

Once a character is settled, a client sends CharacterSelected, once.

A client drops nothing for arriving before CharacterSelected.

A server answers with SpawnStart, states everything on the field as play opens, and closes the run with SpawnEnd. A run carries:

A client takes these in any order within the run.

A run MUST carry at least SpawnStart, the CreateChampion carrying the client’s own client id, and SpawnEnd. Given only those, a client still enters play, showing its champion’s portrait, health, resource and spells. It draws the champion on the map only once an EnterSight places it there, with its name and health bar over it.

A client answers each Replication batch with a TransientAck naming that batch’s syncId. It sends one answer for each batch, in the order the batches came, including a batch that repeats the syncId of the batch before it.

In 0.9.25.24–1.0.0.24

A client answers a batch as soon as it arrives, within the run or not, and never answers one naming a unit it does not hold.

Starting play

A client sends ClientReady after SpawnEnd and after its answers to the run’s batches, while it is still reporting its loading. A server MUST answer with StartGame, and later sends MatchStarted, with other messages free to come between them; MatchStarted carries 0 (see Time).

A client sends ClientReady as soon as SpawnEnd arrives, and StartGame alone moves it into play.

In 0.9.25.24–1.0.0.24

A client whose connection drops before play begins ends rather than connecting again.

Messages

Each message of this system in this book, with each layout it has across the book’s patches and every note its definition carries. A layout is the message’s body, after the header its channel’s family puts in front (see Messages).

Register

What a client sends first. It arrives before the connection has a cipher state, so the payload travels in the clear apart from the proof.

Definition.

In every range of this book

Command 0 on registration, sent by the client, reliable.

FieldTypeWhat it is
leadingbytes, 3Arbitrary; it carries no meaning.
clientIdu32A client writes zero here.
playerIdi64Who the sender claims to be, as its launch line names the player. The proof is what settles the claim.
proofi64The player id enciphered with the 16-byte key both ends already hold; a plain copy where the client has no key.

Registered

What a server answers a registration with, naming a player in the match and the seat they occupy. It shares its command value with the request it answers, which travels the other way, and it is one fixed size.

Definition.

In every range of this book

Command 0 on registration, sent by the server, reliable.

FieldTypeWhat it is
leadingbytes, 3Unused; a server writes zero.
clientIdu32The client id playerId holds. Where playerId is the client’s own, the client takes this client id as its own and goes on.
playerIdi64Who occupies that seat. A client keeps the pair of clientId and playerId from every answer, and takes the answer as its own only where this is its own player id; it reads nothing after it.

QueryStatus

What a client sends to ask a server for its state. It carries nothing of its own. The header names no object: it carries zero.

Definition.

In every range of this book

Command 3 on requests, sent by the client, reliable.

No body.

QueryStatusAnswer

What a server returns when asked whether it is ready. The header names no object: a server writes zero.

Definition.

In every range of this book

Command 4 on events, sent by the server, reliable.

FieldTypeWhat it is
readyu8Whether the server is ready; any value but zero ends the client’s wait. While answers say it is not, a client keeps asking and goes no further, which Joining a match sets out. Values: 0 no, 1 yes.

ClientVersion

What a client sends to state which build it is. The header names no object: it carries zero.

Definition.

In every range of this book

Carried on requests, sent by the client, reliable, under these commands:

BuildsCommand
0.8.13.26–0.9.22.1371
0.9.22.14–1.0.0.2467
FieldTypeWhat it is
clockf32The client’s own clock as it sends this, in seconds.
clientIdu32The client id the sender holds: that of the client reporting.
texttext, 256 bytesThe build the client runs, as text ending at a zero byte; the bytes after that zero carry nothing.
Vectors (1)

one-on-0-8-13-26

VersionSync

What a server sends once a client has said which build it runs, saying whether the two agree. The header names no object: it carries zero.

Definition.

In 0.8.13.26–0.9.22.13

Command 72 on events, sent by the server, reliable.

It carries only agreement and build.

FieldTypeWhat it is
agreementu81 lets the client go on into the game. For 0 a client shows both versions and leaves; for any other value it leaves, showing nothing.
buildtext, ended by a zero byteThe server’s version, ended by a zero byte; the two take at most 512 bytes, and a client fails on a longer one.
Vectors (1)

one-on-0-8-13-26

In 0.9.22.14–1.0.0.24

Command 68 on events, sent by the server, reliable.

It also says which map to load, who is at the match, and everything else settled before play.

FieldTypeWhat it is
agreementu8Nonzero where the builds agree, letting the client go on into the game. For 0 a client shows both versions, reports a build mismatch and leaves.
mapi32Which map to load. Space keys the path origins by the same maps.
seats12 × SeatEvery place at the match, held or empty.
buildtext, 256 bytesWhich build the server serves, shown and not checked. Written out in full and padded with zero bytes to the width above; a client reads it up to the first zero byte.

JoinSide

What a client sends to ask for a seat on one of the two sides while the match is being put together.

Definition.

In 0.9.22.14–1.0.0.24

Command 100 on roster, sent by the client, reliable.

FieldTypeWhat it is
paddingbytes, 3Arbitrary; it carries no meaning.
clientIdu32The client id the sender holds, that is, the id of the client asking.
sideu32The side it asks for; a client asks for 100.

Roster

What a server sends to lay out both sides and who is on them, while the match is being put together.

Definition.

In 0.9.22.14–1.0.0.24

Command 103 on roster, sent by the server, reliable.

FieldTypeWhat it is
paddingbytes, 3Unused; a client reads nothing here.
sideRoomu32How many seats side 100 has room for.
otherSideRoomu32How many side 200 has room for.
gapbytes, 4Unused; a client reads nothing here.
side24 × i64The players on side 100, twenty four places of a player identifier’s width; the client copies as many as sideRoom says, so a server keeps sideRoom at 24 or less; a larger one has no defined effect. sideTaken says how many of the leading places carry a player, and the rest hold zero.
otherSide24 × i64The players on side 200, read the same way under otherSideRoom and otherSideTaken, with otherSideRoom kept at 24 or less.
sideTakenu32How many of side 100’s places carry a player.
otherSideTakenu32How many on side 200.

SeatName

What a server sends to say what a seat is called, while the match is being put together.

Definition.

In 0.9.22.14–1.0.0.24

Command 102 on roster, sent by the server, reliable.

FieldTypeWhat it is
paddingbytes, 7Unused; a client reads nothing here.
playeri64Whose name this is. It has a player identifier’s width.
skini32Which look the seat’s champion wears. A client reads nothing here.
nameLengthu32How many bytes the name below occupies, counting the byte that ends it. A client reads nothing here, and takes the name up to its first zero byte.
nametext, sized by nameLength minus 1What the seat is called. It is not padded.
terminatorbytes, 1A zero byte closing the text, which the length above counts.

SeatChampion

What a server sends to say which champion a seat is playing, while the match is being put together.

Definition.

In 0.9.22.14–1.0.0.24

Command 101 on roster, sent by the server, reliable.

FieldTypeWhat it is
paddingbytes, 7Unused; a client reads nothing here.
playeri64Whose champion this is. It has a player identifier’s width.
skini32Which look the champion wears.
assetLengthu32How many bytes the name below occupies, counting the byte that ends it. A client reads nothing here, and takes the name up to its first zero byte.
assettext, sized by assetLength minus 1The champion the seat plays, as the name the client loads the champion’s data under. It ends with a zero byte and is not padded.
terminatorbytes, 1A zero byte closing the text, which the length above counts.

LoadingProgress

What a client sends while a match loads, saying how far it has got. The header names no object: it carries zero.

Definition.

In 0.9.22.14–1.0.0.24

Command 113 on requests, sent by the client, unreliable.

FieldTypeWhat it is
clientIdu32The client id the sender holds, that is, the id of the client reporting.
playerIdi64Zero.
percentf32How far loading has got, from zero to one hundred.
etaf32How many seconds the client expects loading still to take.
status4-byte bits
status.countbit 0 to 15It rises with each report, not always by one, until it wraps.
status.pingbit 16 to 30The round trip time the client measures, in milliseconds.
status.unusedbit 31Never written by a client; it carries nothing.
done1-byte bits
done.loadedbit 0Set once loading is done.
done.unusedbit 1 to 7Carries nothing; a client never writes these bits.
texttext, ended by a zero byteA text the client also keeps, at most 63 characters, ended by a zero byte. What it says is not recorded; a server ignores it.

SeatLoadProgress

What a server sends to tell everyone how far one seat has got through loading, and how it is holding up. A later report supersedes an earlier one, so losing one costs nothing. The header names no object: a server writes zero.

Definition.

In 0.9.22.14–1.0.0.24

Command 114 on transient, sent by the server, unreliable.

FieldTypeWhat it is
clientIdu32The client id this is about.
playeri64Who occupies it.
progressf32How far through loading it is, from zero to one hundred.
secondsLeftf32How much longer it is expected to take, in seconds.
status4-byte bitsOnly ping is read.
status.unusedLowbit 0 to 15Unused; a server writes zero.
status.pingbit 16 to 30Drawn as the seat’s ping indicator.
status.unusedHighbit 31Unused; a server writes zero.
done1-byte bits
done.loadedbit 0Where set, a client shows secondsLeft as zero.
done.unusedbit 1 to 7Unused; a server writes zero.
statusTexttext, 64 bytesRead once done.loaded is set and the bar is nearly full: a client compares it, ignoring case, with a fixed phrase saying champions are being spawned, and shows a spawning label where it matches and a ready label otherwise. Padded with zero bytes.

SpawnStart

What a server sends to open the run of units a client is about to be told about. The header names no object: a server writes zero.

Definition.

In every range of this book

Command 5 on events, sent by the server, reliable.

FieldTypeWhat it is
countu8A client reads nothing here. A server writes zero.

SpawnEnd

What a server sends to close the run of units it opened with. The header names no object: a server writes zero.

Definition.

In every range of this book

Command 12 on events, sent by the server, reliable.

A client answers it at once with ClientReady.

No body.

StartGame

What a server sends to begin play. The header names no object: it carries zero.

Definition.

In every range of this book

Command 13 on events, sent by the server, reliable.

No body.

ClientReady

What a client sends once it has loaded and is ready to play. The header names no object: it carries zero.

Definition.

In every range of this book

Command 16 on requests, sent by the client, reliable.

The message is the header alone. A client sends it at once on SpawnEnd.

No body.

CharacterSelected

What a client sends once a character is settled on. It carries nothing of its own. The header names no object: it carries zero.

Definition.

In every range of this book

Command 15 on requests, sent by the client, reliable.

No body.

MatchIdentity

What a server sends to tell a client which match this is and what its player is called. The header carries zero.

Definition.

In every range of this book

Carried on events, sent by the server, reliable, under these commands:

BuildsCommand
0.8.13.26–0.9.22.13113
0.9.22.14–1.0.0.24111
FieldTypeWhat it is
gamei64The match’s identifier. A client only logs it.
nametext, 128 bytesThe player’s name, padded with zero bytes. A client reads nothing of it.
Vectors (1)

one-on-0-8-13-26

ResyncEnded

What a server sends to end the resynchronising a client began on its own Reconnected, after which it takes spawns again as they come.

Definition.

In 0.9.22.14–1.0.0.24

Command 119 on events, sent by the server, reliable.

No body.