UT3 query protocol

From UnrealAdminWiki

(Difference between revisions)
Revision as of 09:26, 21 November 2007
Panthera ( | contribs)
Packet 4: Server information response
← Previous diff
Revision as of 10:54, 24 November 2007
Cruz ( | contribs)
Packet 4: Server information response
Next diff →
Line 78: Line 78:
This is taken from a Multiplay server, the first 16 bytes of the response packet are stripped, these included the 6 bytes mentioned above, and 10 bytes containing "splitnum" and some other weird bytes. This data is the exploded, meaning that the \0 character is used to separate different values. This is taken from a Multiplay server, the first 16 bytes of the response packet are stripped, these included the 6 bytes mentioned above, and 10 bytes containing "splitnum" and some other weird bytes. This data is the exploded, meaning that the \0 character is used to separate different values.
-These values can be combined as "value n" => "value n+1", resulting in:+These values can be combined as "value n" => "value n+1", resulting in these values (updated for UT3 final release with 1st patch):
{| {|
Line 86: Line 86:
|- |-
|hostname |hostname
-|Multiplay#83+|
|This is currently the OwningPlayerName. This is clearly a bug, it should either be the server's IP address or the hostname (though IP address would be better) |This is currently the OwningPlayerName. This is clearly a bug, it should either be the server's IP address or the hostname (though IP address would be better)
|- |-
Line 103: Line 103:
|gamemode |gamemode
|openplaying |openplaying
-|Can be 'openplaying' or 'closedplaying', depends on the "bAllowJoinInProgress" setting+|Can be 'openplaying' or 'closedplaying', depends on the "bAllowJoinInProgress" setting (?)
 +|-
 +|mapname
 +|<comma seperated list of ALL these variables and their values>
 +|Seems like this is a bug. It definitely isn't a map name.
|- |-
|OwningPlayerId |OwningPlayerId
Line 112: Line 116:
|24 |24
|Maximum number of players |Maximum number of players
-|- 
-|NumPrivateConnections 
-|0 
-|Maximum number of spectators 
-|- 
-|NumOpenPublicConnections 
-|20 
-|Player slots available 
-|- 
-|NumOpenPrivateConnections 
-|0 
-|Spectator slots available 
|- |-
|bUsesStats |bUsesStats
Line 136: Line 128:
|Multiplay#83 |Multiplay#83
|Should be linked to the OwningPlayerId above |Should be linked to the OwningPlayerId above
-|- 
-|PingInMs 
-|0 
-|Seems to be unsupported; Ping to what? 
|- |-
|AverageSkillRating |AverageSkillRating
-|0.000000+|1000.000000
-|Will probably be used for the feature where players join a server of similar skill level+|Is used for the feature where players join a server of similar skill level
|- |-
|s32779 |s32779
Line 159: Line 147:
|s6 |s6
|1 |1
-|? (1=Standard Server, 0=Mutators Loaded)+|Pure server (1) or 'tainted' with mutators (0)
|- |-
|s7 |s7
Line 175: Line 163:
|s10 |s10
|0 |0
-|Forced Respawn+|Forced Respawn (1) or not (0)
|- |-
|s11 |s11
Line 211: Line 199:
|p1073741827 |p1073741827
|Deathmatch (24 Player) |Deathmatch (24 Player)
-|Server description+|Server name in browser
|- |-
|p268435717 |p268435717
|0 |0
-|? (normally 0, is 8 on iCTF servers)+|? (normally 0, is 8 on iCTF servers, also seen to be 65600)
|- |-
 +|p1073741828
 +|
 +|? Has been added after patch 1, so far it's always empty
|} |}
- 
- 
-Bear in mind that the server name in the in-game browser will be "(OwningPlayerName): (p1073741827)". 
==See also:== ==See also:==

Revision as of 10:54, 24 November 2007

Contents

Basics

The query port (on the server) seems to be a random port number by default, contrary to the UT2003/4 situation where it was one port above the gameport. The protocol is Gamespy Query Protocol version 4, which uses UDP to send datagrams.

The UT3 query protocol is quite different from the UT2003/2004 query protocols, which were proprietary.

This is the basic schema:

  1. Client sends request to Server
  2. Server replies with a unique number
  3. Client sends new request to Server, including said number
  4. Server replies with query information


These are the specifications of the packets:

Packet 1: Initial request

FE FD 09 XX XX XX XX

The first 2 bytes (FE FD) are protocol identifier. In this case, they represent the Gamespy Query Protocol version 4.

Byte 3 (09) indicate that the client wishes to receive the challenge string.

Bytes 4 to 7 (XX XX XX XX) are a timestamp, in milliseconds. It is overall and per byte big-endian. According to the available data on Gamespy protocol, this can be any value, and is only used as an identifier to distinguish between multiple packets from the same server. Apparently UT3 uses time to generate these timestamps.


Packet 2: First response

09 XX XX XX XX YY YY YY YY YY YY YY YY YY YY YY YY

The first byte (09) indicates this is a reply to the initial request.

Bytes 2 to 6 (XX XX XX XX) are the sequence number that was in the initial request.

Bytes 7 to 18 (YY YY YY YY YY YY YY YY YY YY YY YY) is an ASCII represented number. This number can start with a - sign (2D), and is padded with 00's at the end.


Packet 3: Second request

FE FD 00 WW WW WW WW ZZ ZZ ZZ ZZ FF FF FF 01

The first two bytes (FE FD) again indicate the query protocol.

Byte 3 (00) indicates that this is a request for server information.

Bytes 4 to 7 (WW WW WW WW) is a new timestamp. It normally only changes in the first byte, as the 3rd request is usually sent within milliseconds of the first request.

Bytes 8 to 11 (ZZ ZZ ZZ ZZ) is the hexadecimal representation of the number received from Packet 2. If that number was negative, it needs to be subtracted from 4294967296 before it is transcoded into the hexadecimal value.

Bytes 12 to 15 are always (FF FF FF 01).


Or, in code (source):

 // $challenge was the number received from Packet 2,
 // We assume the timestamp is 10 20 30 40:
 $query = sprintf(
  "\xFE\xFD\x00\x10\x20\x30\x40%c%c%c%c\xFF\xFF\xFF\x01",
  ( $challenge >> 24 ),
  ( $challenge >> 16 ),
  ( $challenge >> 8 ),
  ( $challenge >> 0 )
 );
 // Now you can send $query and receive the server details.

Packet 4: Server information response

00 WW WW WW WW *DATA*

Byte 1 (00) indicates that this is a reply for a server information request.

Bytes 2 to 5 (WW WW WW WW) are the new timestamp, sent in Packet 3.


What follows is server information, in the following format:

This is taken from a Multiplay server, the first 16 bytes of the response packet are stripped, these included the 6 bytes mentioned above, and 10 bytes containing "splitnum" and some other weird bytes. This data is the exploded, meaning that the \0 character is used to separate different values. These values can be combined as "value n" => "value n+1", resulting in these values (updated for UT3 final release with 1st patch):

Variable Value Comment
hostname This is currently the OwningPlayerName. This is clearly a bug, it should either be the server's IP address or the hostname (though IP address would be better)
hostport 8277 The server port
numplayers 4 Current number of players
maxplayers 24 Maximum number of players
gamemode openplaying Can be 'openplaying' or 'closedplaying', depends on the "bAllowJoinInProgress" setting (?)
mapname <comma seperated list of ALL these variables and their values> Seems like this is a bug. It definitely isn't a map name.
OwningPlayerId 113350319 "Owning" Player ID
NumPublicConnections 24 Maximum number of players
bUsesStats True Stats enabled (True/False)
bIsDedicated True Dedicated (True/False)
OwningPlayerName Multiplay#83 Should be linked to the OwningPlayerId above
AverageSkillRating 1000.000000 Is used for the feature where players join a server of similar skill level
s32779 0 ? (varies from 0 to 5)
s0 2 The bot skill level, 1 for Novice, incrementing for Average, Experienced, Skilled, Adept, Masterful, Inhuman, Godlike
s1 0 ? (always 0)
s6 1 Pure server (1) or 'tainted' with mutators (0)
s7 0 Private server (requires password) (0), or public server (1)
s8 0 "Vs Bots" with the options "Disabled" (0), "" (1), "1:1" (2), "3:2"(3), "2:1" (4)
s9 0 ? (always 0)
s10 0 Forced Respawn (1) or not (0)
s11 0 ? (always 0)
s12 0 ? (varies between 0/1)
s13 0 ? (varies between 0/1)
p1073741825 DM-SHANGRILA Map name
p1073741826 UTGame.UTDeathmatch Gametype (can also be "UTGameContent.UTVehicleCTFGame_Content" or "UTGame.UTTeamGame")
p268435704 0 Frag/score limit
p268435705 15 Time limit (minutes)
p268435703 5 Number of bots
p1073741827 Deathmatch (24 Player) Server name in browser
p268435717 0 ? (normally 0, is 8 on iCTF servers, also seen to be 65600)
p1073741828 ? Has been added after patch 1, so far it's always empty

See also:

Cruz's UT3 Server Query Script

the UnrealAdmin Page
History
  • UT3 query protocol