User:Monster Iestyn/SRB2 Network Documentation

From SRB2 Wiki
Jump to: navigation, search
Test.png This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

Stuff possibly to go in SRB2 network documentation and pages related.

Packet types & info

PT_SERVERCFG

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
version Unsigned 8-bit Integer The VERSION of SRB2 the game is running. This usually corresponds to the first two digits of the version string. 210 (0xD2) Corresponds to the 2.1 in version 2.1.17.
subversion Unsigned 8-bit Integer The SUBVERSION of SRB2 the game is running. This usually corresponds to the last digit(s) of the version string. 17 (0x11) Corresponds to the 17 in version 2.1.17.
serverplayer Unsigned 8-bit Integer The number of the server player's node on the server. This is usually the first node, node 0. (?) 0 (0x00) The server player is using node 0.
totalslotnum Unsigned 8-bit Integer The number of node slots used in the server currently (?); this is the highest player number in use plus one. 2 (0x00 There are two node slots in use in the server. The highest player number in use is currently 1.
gametic Unsigned 32-bit Integer The game tic currently being run. This is not the level time in tics, but a separate variable related to ticcmds (?).
clientnode Unsigned 8-bit Integer The number of the node the client recieving the PT_SERVERCFG packet will use when joining the server. This is determined by the server on receiving a PT_CLIENTJOIN packet from the client beforehand, getting the first node that is free (i.e. not used in-game). 1 (0x01) The client will be using node 1 in the server.
gamestate Unsigned 8-bit Integer The number of the current game state; e.g.: 1 indicates a level is being played, 2 indicates the server is currently at an intermission screen. A list of all game states can be found here; the numbers are not given but can be deduced from the order of the named constants. 1 (0x01) A level is currently being played.
playerskins 32-byte array of 8-bit Integers An array containing the skins that all 32 nodes in the server are using, in numeric form. A value of 255 indicates a node is not used. No example
playercolors 32-byte array of 8-bit Integers An array containing the skin colors that all 32 nodes in the server are using, in numeric form. A value of 255 indicates a node is not used. No example
gametype Unsigned 8-bit Integer The current gametype. A list of gametype numbers can be found here. 3 (0x03) The server is playing Match.
modifiedgame Unsigned 8-bit Integer Is the game modified or not? Set to 1 if the game is modified, 0 if not. 0 (0x00) The game is not modified.
adminplayer Signed 8-bit Integer The number of the current verified node on the server, or -1 if no nodes are verified. -1 (0xFF) No players are verified on the server.
server_context 8-byte String The unique context string for the server. This is randomly generated by the server, containing a mix of uppercase and uppercase letters. No example
varlengthinputs Header for variable length input From this point onwards, player names and netvars (console variables with the CV_NETVAR flag) are saved into the packet. No example

PT_CLIENTCMD/PT_CLIENTMIS

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
client_tic Unsigned 8-bit Integer
resendfrom Unsigned 8-bit Integer
consistancy Signed 16-bit Integer
cmd 8-byte ticcmd_t structure No example

PT_CLIENT2CMD/PT_CLIENT2MIS

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
client_tic Unsigned 8-bit Integer
resendfrom Unsigned 8-bit Integer
consistancy Signed 16-bit Integer
cmd 8-byte ticcmd_t structure No example
cmd2 8-byte ticcmd_t structure No example

PT_NODEKEEPALIVE/PT_NODEKEEPALIVEMIS

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
client_tic Unsigned 8-bit Integer
resendfrom Unsigned 8-bit Integer

PT_SERVERTICS

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
starttic Unsigned 8-bit Integer
numtics Unsigned 8-bit Integer
numslots Unsigned 8-bit Integer
cmds Variable length array of 8-byte ticcmd_t structures The number of ticcmd_t structures sent is numtics × numslots. No example
textcmds Variable amount of extra data The list of net commands sent by each player currently in-game, for each tic sent. No example

PT_SERVERREFUSE

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
reason Variable length String The message giving the reason for the client being refused to join. Length is the length of the message plus one byte for the null terminator – maximum is 255 bytes. "You have been banned\nfrom the server" The client is banned from the server.

PT_SERVERSHUTDOWN/PT_CLIENTQUIT

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example

PT_FILEFRAGMENT

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
fileid Unsigned 8-bit integer
position Unsigned 32-bit integer The first 31 bits indicate the position of the file fragment in the full file.

The 32nd bit (0x80000000) is set if the fragment sent is the last fragment of the file in position order. The total size of the file can then be calculated as position + size using this file fragment's data when recieved.

size Unsigned 16-bit integer The size of the file fragment sent, in bytes.
data Header for variable length input No example

PT_TEXTCMD/PT_TEXTCMD2

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
size Unsigned 8-bit Integer The amount of extra data to be sent, in bytes.
extra data Variable amount of extra data A list of net commands to be sent. See below for more info. No example

extra data structure

Data name Data type Description Sample data Sample meaning
id Unsigned 8-bit Integer The type of the net command sent (see #Net commands) 1 (0x01) The extra data sent is for a XD_NAMEANDCOLOR net command.
params Variable amount of raw data The net command's parameters buffer, written to an 8-bit integer array. The contents of this vary depending on the type of net command being sent. No example
separator Null byte A padding byte separating each net command in the buffer. Note that there is no padding byte after the last net command in the buffer. 0 (0x00)

PT_CLIENTJOIN

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
version Unsigned 8-bit Integer The VERSION of SRB2 the game is running. This usually corresponds to the first two digits of the version string. 210 (0xD2) Corresponds to the 2.1 in version 2.1.17.
subversion Unsigned 8-bit Integer The SUBVERSION of SRB2 the game is running. This usually corresponds to the last digit(s) of the version string. 17 (0x0E) Corresponds to the 17 in version 2.1.17.
localplayers Unsigned 8-bit Integer The number of local players requesting to join. If playing with splitscreen mode or with a bot, this is set to 2. Otherwise, this is set to 1.
Note: it is not possible for two players to join a netgame through the same client, so in this context only 1 is valid.
1 (0x01) One local player is requesting to join.
mode Unsigned 8-bit Integer Unused (?) No example

PT_RESYNCHEND

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
randomseed Unsigned 32-bit Integer
flagplayer 2-byte array of 8-bit Integers
flagloose 2-byte array of 32-bit Integers
flagflags 2-byte array of 32-bit Integers
flagx 2-byte array of 32-bit Integers
flagy 2-byte array of 32-bit Integers
flagz 2-byte array of 32-bit Integers
ingame Unsigned 32-bit Integer
ctfteam 32-byte array of 32-bit Integers
score 32-byte array of 32-bit Integers
numboxes 32-byte array of 16-bit Integers
totalring 32-byte array of 16-bit Integers
realtime 32-byte array of 32-bit Integers
laps 32-byte array of 8-bit Integers

PT_RESYNCHGET

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
playernum Unsigned 8-bit Integer

PT_RESYNCHING

Data name Data type Description Sample data Sample meaning
(header) 8 bytes The required header for all SRB2 packets. No example
playernum Unsigned 8-bit Integer
playerstate Unsigned 8-bit Integer
pflags Unsigned 32-bit Integer
panim Unsigned 8-bit Integer
aiming Unsigned 32-bit Integer
currentweapon Signed 32-bit Integer
ringweapons Signed 32-bit Integer
powers 23-byte array of 16-bit Integers
health Signed 32-bit Integer
lives Signed 8-bit Integer
continues Signed 8-bit Integer
scoreadd Unsigned 8-bit Integer
xtralife Signed 8-bit Integer
pity Signed 8-bit Integer
skincolor Unsigned 8-bit Integer
skin Signed 32-bit Integer
normalspeed Signed 32-bit Integer
runspeed Signed 32-bit Integer
thrustfactor Unsigned 8-bit Integer
accelstart Unsigned 8-bit Integer
acceleration Unsigned 8-bit Integer
charability Unsigned 8-bit Integer
charability2 Unsigned 8-bit Integer
charflags Unsigned 32-bit Integer
thokitem Unsigned 32-bit Integer
spinitem Unsigned 32-bit Integer
revitem Unsigned 32-bit Integer
actionspd Signed 32-bit Integer
mindash Signed 32-bit Integer
maxdash Signed 32-bit Integer
jumpfactor Signed 32-bit Integer
speed Signed 32-bit Integer
jumping Unsigned 8-bit Integer
secondjump Unsigned 8-bit Integer
fly1 Unsigned 8-bit Integer
glidetime Unsigned 32-bit Integer
climbing Unsigned 8-bit Integer
deadtimer Signed 32-bit Integer
exiting Unsigned 32-bit Integer
homing Unsigned 8-bit Integer
skidtime Unsigned 32-bit Integer
cmomx Signed 32-bit Integer
cmomy Signed 32-bit Integer
rmomx Signed 32-bit Integer
rmomy Signed 32-bit Integer
weapondelay Signed 32-bit Integer
tossdelay Signed 32-bit Integer
starpostx Signed 16-bit Integer
starposty Signed 16-bit Integer
starpostz Signed 16-bit Integer
starpostnum Signed 32-bit Integer
starposttime Unsigned 32-bit Integer
starpostangle Unsigned 32-bit Integer
maxlink Signed 32-bit Integer
dashspeed Signed 32-bit Integer
dashtime Signed 32-bit Integer
angle_pos Unsigned 32-bit Integer
old_angle_pos Unsigned 32-bit Integer
bumpertime Unsigned 32-bit Integer
flyangle Signed 32-bit Integer
drilltimer Unsigned 32-bit Integer
linkcount Signed 32-bit Integer
linktimer Unsigned 32-bit Integer
anotherflyangle Signed 32-bit Integer
nightstime Unsigned 32-bit Integer
drillmeter Signed 32-bit Integer
drilldelay Unsigned 8-bit Integer
bonustime Unsigned 8-bit Integer
mare Unsigned 8-bit Integer
lastsidehit Signed 16-bit Integer
lastlinehit Signed 16-bit Integer
losstime Unsigned 32-bit Integer
timeshit Unsigned 8-bit Integer
onconveyor Signed 32-bit Integer
hasmo Unsigned 8-bit Integer Does the player currently have a body? Set to 1 if the player's object currently exists in-game, 0 if not.
Note: if the player's object does not exist, the remainder of this structure after this setting should be ignored.
angle Unsigned 32-bit Integer
x Signed 32-bit Integer
y Signed 32-bit Integer
z Signed 32-bit Integer
momx Signed 32-bit Integer
momy Signed 32-bit Integer
momz Signed 32-bit Integer
friction Signed 32-bit Integer
movefactor Signed 32-bit Integer
tics Signed 32-bit Integer
statenum Unsigned 32-bit Integer
flags Unsigned 32-bit Integer
flags2 Unsigned 32-bit Integer
eflags Unsigned 16-bit Integer
radius Signed 32-bit Integer
height Signed 32-bit Integer
scale Signed 32-bit Integer
destscale Signed 32-bit Integer
scalespeed Signed 32-bit Integer

PT_PING

Data name Data type Description
(header) 8 bytes The required header for all SRB2 packets.
pingtable 0 Unsigned 32-bit Integer Player 0's ping
pingtable 1 Unsigned 32-bit Integer Player 1's ping
pingtable 2 Unsigned 32-bit Integer Player 2's ping
pingtable 3 Unsigned 32-bit Integer Player 3's ping
pingtable 4 Unsigned 32-bit Integer Player 4's ping
pingtable 5 Unsigned 32-bit Integer Player 5's ping
pingtable 6 Unsigned 32-bit Integer Player 6's ping
pingtable 7 Unsigned 32-bit Integer Player 7's ping
pingtable 8 Unsigned 32-bit Integer Player 8's ping
pingtable 9 Unsigned 32-bit Integer Player 9's ping
pingtable 10 Unsigned 32-bit Integer Player 10's ping
pingtable 11 Unsigned 32-bit Integer Player 11's ping
pingtable 12 Unsigned 32-bit Integer Player 12's ping
pingtable 13 Unsigned 32-bit Integer Player 13's ping
pingtable 14 Unsigned 32-bit Integer Player 14's ping
pingtable 15 Unsigned 32-bit Integer Player 15's ping
pingtable 16 Unsigned 32-bit Integer Player 16's ping
pingtable 17 Unsigned 32-bit Integer Player 17's ping
pingtable 18 Unsigned 32-bit Integer Player 18's ping
pingtable 19 Unsigned 32-bit Integer Player 19's ping
pingtable 20 Unsigned 32-bit Integer Player 20's ping
pingtable 21 Unsigned 32-bit Integer Player 21's ping
pingtable 22 Unsigned 32-bit Integer Player 22's ping
pingtable 23 Unsigned 32-bit Integer Player 23's ping
pingtable 24 Unsigned 32-bit Integer Player 24's ping
pingtable 25 Unsigned 32-bit Integer Player 25's ping
pingtable 26 Unsigned 32-bit Integer Player 26's ping
pingtable 27 Unsigned 32-bit Integer Player 27's ping
pingtable 28 Unsigned 32-bit Integer Player 28's ping
pingtable 29 Unsigned 32-bit Integer Player 29's ping
pingtable 30 Unsigned 32-bit Integer Player 30's ping
pingtable 31 Unsigned 32-bit Integer Player 31's ping

Net commands

(I think XD stands for "eXtra Data"?)

Decimal ID Hex ID Name Purpose
0 0x00 none Unused
1 0x01 XD_NAMEANDCOLOR Sends a player's current name, color and skin. This is sent whenever name, skin, or color are modified. This is also sent by players joining the server.
2 0x02 XD_WEAPONPREF Sends other player preferences. This is sent whenever flipcam or analog are modified. This is also sent by players joining the server.
3 0x03 XD_KICK Sent by the server or admin to kick a player from the server.
4 0x04 XD_NETVAR Sent by the server or admin when a networked console variable is changed.
5 0x05 XD_SAY Sends a say command. This is sent when say, sayto, sayteam, csay or chat mode are used.
6 0x06 XD_MAP Sent by the server or admin when the map is changed. This is sent when the last map played has finished and the game is changing to the next map, the map command is used, or when the server or admin changes the map from the menu.
7 0x07 XD_EXITLEVEL Sent by the server or admin to finish the level. This is sent when all players have finished the current level, or when the exitlevel command is used.
8 0x08 XD_ADDFILE Sent by the server to add a file to the netgame. This is sent when the addfile command is used.
9 0x09 XD_PAUSE Sends a pause command. Normally this can only be sent by the server or admin to pause the game; however, if pausepermission is enabled, anyone is allowed to pause the game. This is sent when the pause command or the Pause control is used.
10 0x10 XD_ADDPLAYER Sent by the server or admin(?) to add a joining player to the netgame.
11 0x11 XD_TEAMCHANGE Sends a team change command. This is sent when the teamchange or serverteamchange commands are used, or a player changes their team from the menu.
12 0x12 XD_CLEARSCORES Sent by the server or admin to clear all players' scores. This is sent when the clearscores command is used.
13 0x13 XD_LOGIN Sends a login request to the server. This is sent when the login command is used.
14 0x14 XD_VERIFIED Sent by the server to give admin privileges to a player. This is sent when the verify command is used.
15 0x15 XD_RANDOMSEED Unused - This was formerly sent by the server to set a new random seed when the map is changed, but since v2.1 this is handled by XD_MAP, making this net command type deprecated.
16 0x16 XD_RUNSOC Sent by the server or admin to run a SOC file. This is sent when the runsoc command is used.
17 0x17 XD_REQADDFILE Sent by an admin to request the server to add a file to the game.
18 0x18 XD_DELFILE Sent by the server or admin to delete a file from the game. This is unused, as all code relating to deleting files is disabled in SRB2.
19 0x19 XD_SETMOTD Sent by the server or admin to set the Message of the day. This is sent when the motd command is used.
20 0x20 XD_SUICIDE Sends a suicide command. This is sent when the suicide command is used.
21 0x21 XD_LUACMD Sent by the server when a networked Lua-defined console command is used.
22 0x22 XD_LUAVAR Unimplemented – This is intended to be sent by the server when a Lua-defined console variable is changed, and a function for it is to be called.