tetrinet protocol: server to client messages - xale/iTetrinet GitHub Wiki

The TetriNET protocol specifies the following message types for communication sent from the server to its connected clients:

Players

Player Number:

playernum <number> or )#)(!@(*3 <number>

(The first format is used by the original TetriNET protocol, and the second by the newer Tetrifast protocol.)

Sent to a single client immediately after that client connects, and to any number of clients whenever the server wishes to rearrange the ordering of its connected clients. Specifies the client’s “player number”. The player with the lowest number is the channel operator, who can start, stop, pause and resume games, and who may have other powers, depending on the server and its settings.

arguments type values meaning
number integer 16 the player number for the new client’s player

Player Joined:

playerjoin <number> <nickname>

Sent to all connected clients (including, with some servers, the client joining) when a new player joins the server. Connecting clients are also sent one of these messages for each player already connected to the server. Note that some servers will send this message to the joining client immediately after he or she joins.

arguments type values meaning
number integer 16 the new player’s player number
nickname string the new player’s nickname

Player Left:

playerleave <number>

Sent to all connected clients whenever a player leaves the server.

arguments type values meaning
number integer 16 the number of the player leaving

Player Team:

team <number> <team name>

Sent to all clients except the client with the corresponding player whenever a player joins the game and identifies his or her team, and when a player changes his or her team.

arguments type values meaning
number integer 16 the number of the player whose team changed
team name string the name of the player’s new team; may be blank (indicates “no team”)

Winlist:

winlist <type><name>;<score> <type><name>;<score> ... <type><name>;<score>

(Variable-length list of arguments, spaces between each set of three.)

Sent to a single client immediately after that client connects, and to all clients after the end of a game. Specifies the list of players and teams that hold the highest scores on the server.

arguments type values meaning
type char t or p specifies whether the entry is a team (t) or a player (p)
name string the name of the player or team; note that if this is a team name, it may contain spaces
score integer the player’s or team’s score

Player Communication

Partyline Chat Message:

pline <sendernum> <message>

Sent to all players (excluding the original message sender) whenever a chat message is sent to the partyline (the main chat window.)

arguments type values meaning
sendernum integer 06 the player number of the message sender (0 indicates messages sent by the server)
message string the contents of the message. may contain formatting characters

Partyline Chat Action:

plineact <sendernum> <action>

Sent to all players (excluding the original message sender) whenever an “action” message (a message beginning with /me, also known as an emote) is sent to the partyline.

arguments type values meaning
sendernum integer 16 the player number of the message sender (I do not believe the server can send action messages)
message string the message contents following the /me token

Game Chat Message:

gmsg <message>

Sent to all players (including the original message sender) whenever a message is sent to the game chat field. Note that the sender’s player number is not sent along with the message; clients generally include the player’s nickname in the message itself.

arguments type values meaning
message string the contents of the chat message

Gameplay

New Game:

See new game rules string

In-Game:

ingame

Sent to a single client when that client connects. Indicates that there is a game in-progress on the server.

arguments type values meaning
(no arguments)

Field Update:

See field updates

Level Update:

lvl <playernum> <levelnum>

Sent to all clients (including the original sender) whenever a player’s game level changes.

arguments type values meaning
playernum integer 16 the player number whose game level has changed
levelnum integer the player’s new game level

Special Used:

sb <targetnum> <specialtype> <sendernum>

Sent to all clients (excluding the sender of the special) whenever a special block is used.

arguments type values meaning
targetnum integer 06 the number of the player who is the target of the special (0 indicates all players)
specialtype char a, b, c, g, n, o, q, r, or s the type of special used (see special blocks)
sendernum integer 06 the number of the player who sent the special (0 indicates specials sent by the server, which is unusual, but possible.)

Classic-Style Add-Lines:

sb 0 cs<numlines> <sendernum>

(A minor variation of the “Special Used” message, above.)

Sent to all clients (excluding the sender) whenever a player completes multiple lines in a game with “classic mode” enabled, (see new game rules string) triggering a classic-style add. The targetnum argument should always be 0, since classic-style adds affect all players except the sender.

arguments type values meaning
numlines char 1, 2, or 4 the number of lines added to field (not necessarily the same as the number of lines cleared)
sendernum integer 06 the number of the player who cleared the lines (0 indicates lines added to everyone’s fields by the server)

Player Lost:

playerlost <playernum>

Sent to all clients (including the player in question) when a player’s field fills up and he or she loses the game in progress.

arguments type values meaning
playernum integer 16 the number of the player who has lost the game

Player Won:

playerwon <playernum>

Sent to all players when all but one player has lost the current game, leaving only the winning player.

arguments type values meaning
playernum integer 16 the number of the winning player

Pause/Resume Game:

pause <state>

Sent to a single client immediately after an ingame message to indicate whether or not the game in-progress when that client joins is paused, and to all connected clients (including the client that originally sent the pause request) whenever the game is paused or resumed. Note that unlike the client-to-server version, (see tetrinet protocol: client-to-server messages) this message does not include a player number.

arguments type values meaning
state boolean 1 or 0 the “pause state” of the game: 1 indicates pause, 0 indicates resume

End Game:

endgame

Sent to all clients at the end of a game. Games end when all but one player has been eliminated, or when the operator ends the game early.

arguments type values meaning
(no arguments)

Miscellaneous

No Connecting:

noconnecting <reason>

Sent to a single client when it attempts to connect to a server, as an error message telling the client that it cannot connect to the server at this time.

arguments type values meaning
reason string an error message detailing why the server has refused the client’s connection

Client Info Request:

lvl 0 0

(Optional; not part of the protocol)

A modified level-update message, this message is sent by some servers to a single client after that client connects. It is used as a request for the client’s application info; see “Client Info” under tetrinet protocol: client-to-server messages

arguments type values meaning
(no arguments)

Heartbeat:

(Optional; not part of the protocol)

A blank message (just a terminator character) sent to all clients periodically to keep the connection open. No action is required, but clients will probably want to send a heartbeat of their own, to keep the server’s read socket open.

arguments type values meaning
(no arguments)
⚠️ **GitHub.com Fallback** ⚠️