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.)
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 | 1 – 6 |
the local player’s player number |
team name |
string | the name of the local player’s team |
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”) |
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 | 1 – 6 |
the local player’s player number |
message |
string | the contents of the message to send. may contain formatting characters |
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 | 1 – 6 |
the local player’s player number |
message |
string | the message contents following the /me token |
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 |
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 | 1 – 6 |
the local player’s player number; must be the smallest player number among players in the server for this message to work |
See field updates
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 | 1 – 6 |
the local player’s player number |
levelnum |
integer | the local player’s new game level |
sb <targetnum> <specialtype> <sendernum>
Sent when the local player uses a special on another player.
arguments | type | values | meaning |
---|---|---|---|
targetnum |
integer | 1 – 6 |
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 | 1 – 6 |
the local player’s player number |
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 | 1 – 6 |
the local player’s player number |
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 | 1 – 6 |
the local player’s player number |
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 | 1 – 6 |
the local player’s player number; must be the smallest player number among players in the server for this message to work |