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

The TetriNET protocol specifies the following message types for communication sent from the client to the server it is connected to:

(Note: “local player” is a convention referring to the user of the client sending the message.)

Connecting

Login:

see logging in to a server

Team Name:

team <number> <team name>

Sent to the server immediately after the local player’s player number is received. Identifies the name of the team the local player plays for.

arguments type values meaning
number integer 16 the local player’s player number
team name string the name of the local player’s team

Client Info:

clientinfo <client name> <client version>

(Optional; not part of the protocol)

Used to send the name and version of the client application to the server. Not all servers will accept this message—those that do will request it by sending a Client Info Request (see tetrinet protocol: server-to-client messages.)

arguments type values meaning
client name string the name of the client application (e.g., “iTetrinet”)
client version string the client application’s version number, as a string (e.g., “1.0.0”)

Player Communication

Partyline Chat Message:

pline <sendernum> <message>

Used to send partyline chat messages from the local player to the other players on the server. This message is usually echoed to all other connected clients, but many servers support the use of slash commands, (such as /list or /whisper) which are handled by the server and not echoed. Note that /me is not a server-side slash command; see “Partyline Chat Action,” below.

arguments type values meaning
sendernum integer 16 the local player’s player number
message string the contents of the message to send. may contain formatting characters

Partyline Chat Action:

plineact <sendernum> <action>

Used to send partyline actions (messages beginning with /me, also known as emotes) from the local player to the other players on the server. These messages should not contain the /me token.

arguments type values meaning
sendernum integer 16 the local player’s player number
message string the message contents following the /me token

Game Chat Message:

gmsg <message>

Used to send a game message (i.e., a message entered in the chat field underneath the gameplay areas) from the local player to the other players on the server. Note that this message does not contain the local player’s player number, and, as a result, the receiving client does not know from whom it came. It is recommended that clients append the local player’s nickname to the front of the message contents before sending it.

arguments type values meaning
message string the contents of the chat message, perhaps with the local player’s nickname appended in front

Gameplay

Start/Stop Game:

startgame <state> <playernum>

Used to start a new game, or stop a game in progress. Servers will only respond to this message if it is sent by the channel operator, i.e., the connected player with the smallest player number.

arguments type values meaning
state boolean 1 or 0 indicates whether the game should be started or stopped: 1 signifies “start game,” 0 signifies “stop game”
playernum integer 16 the local player’s player number; must be the smallest player number among players in the server for this message to work

Field Update:

See field updates

Level Update:

lvl <playernum> <levelnum>

Sent when the local player reaches a higher level in the game, which occurs when the local player completes a certain number of lines, specified in the new game rules string at the beginning of the game.

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

Send Special:

sb <targetnum> <specialtype> <sendernum>

Sent when the local player uses a special on another player.

arguments type values meaning
targetnum integer 16 the player chosen by the local player to receive the special
specialtype char a, b, c, g, n, o, q, r, or s the type of special used (see special blocks)
sendernum integer 16 the local player’s player number

Send Classic-Style Add-Lines:

sb 0 cs<numlines> <sendernum>

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

Sent when the local player completes multiple lines simultaneously in a game with “classic mode” enabled, (see new game rules string) triggering a classic-style add. The targetnum field of the message 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 other players’ fields; see classic-style adds
sendernum integer 16 the local player’s player number

Player Lost:

playerlost <playernum>

Sent when the local player loses the game; i.e., when his or her field is full to the point that the next block cannot be moved onto it.

Implementation note: some servers (Jetrix for instance) expect the client to send a randomly-filled “death field” (via a field update message) after the player loses, but before sending the “player lost” message.

arguments type values meaning
playernum integer 16 the local player’s player number

Pause/Resume Game:

pause <state> <playernum>

Used to pause or resume a game in progress. Like the Start/Stop Game message, servers will only respond to this message if it is sent by the channel operator.

arguments type values meaning
state boolean 1 or 0 indicates whether the game should be paused or resumed: 1 signifies “pause,” 0 signifies “resume”
playernum integer 16 the local player’s player number; must be the smallest player number among players in the server for this message to work
⚠️ **GitHub.com Fallback** ⚠️