Server query protocol

This page is a Stub. You can help us by expanding it.

All id Tech 4 engines have a means of querying servers to gather info about a particular server. Mostly the protocol is slightly different for different games.

Doom 3 version

The information in this section is specific to Doom 3 .

Querying the master server

Doom 3 - Master Server communications http://dev.kquery.com/index.php?article=44

Request

Send a UDP packet to master server for query a list of Doom 3 servers. The known master sever is idnet.ua-corp.com:27650 .

Data block

struct request_t { // 19 bytes
  uint16_t magic;              // 0xFFFF
  uint8_t get_servers_sig[11]; // "getServers\0"
  uint8_t ver;                 // 0x21 means Version 1.0
                               // 0x23 means Version 1.1
                               // 0x27 means Version 1.2
                               // 0x28 means Version 1.3
  uint8_t xxx1; // not tested yet
  uint8_t xxx2; // not tested yet
  uint8_t xxx3; // not tested yet
  uint8_t xxx4; // not tested yet
  uint8_t xxx5; // not tested yet
 };

Query packet representation in C launguage

static const uint8_t cMasterv_10[] = { // Query version 1.0 server (19 bytes)
    "\xFF\xFF" "getServers\0" "\x21\x00\x01\x00\x00\x0A"
};
static const uint8_t cMasterv_11[] = { // Query version 1.1 server (19 bytes)
    "\xFF\xFF" "getServers\0" "\x23\x00\x01\x00\x00\x0A"
};
static const uint8_t cMasterv_12[] = { // Query version 1.2 server (19 bytes)
    "\xFF\xFF" "getServers\0" "\x27\x00\x01\x00\x00\x0A"
};
static const uint8_t cMasterv_13[] = { // Query version 1.3 server (19 bytes)
    "\xFF\xFF" "getServers\0" "\x28\x00\x01\x00\x00\x0A"
};

Response

Receive a UDP packet from the master server.

Data block

struct server_addr_t { // 6 bytes
  uint32_t addr;  // network byte order: 45 0c 12 34 is 69.12.18.52
  uint16_t port;  // intel byte order: 12 6c is 27666
 };

struct response_t { // 10+ bytes
  uint16_t magic;          // 0xFFFF
  uint8_t servers_sig[8];  // "servers\0"
  server_addr_t servers[]; // cnt is arbitary. Read until end of packet.
 };

Querying a server

ET:QW version

The information in this section is specific to Enemy Territory: Quake Wars .

The version used in Enemy Territory: Quake Wars works slightly different. Because users are required to login, access to the master servers doesn’t seem to be possible for unauthenticated users.

Server Feed

Luckily, the list of servers is available from a second source. The current URLs for server lists are:

Demo server list

http://etqwdemo-ipgetter.demonware.net/ipgetter/

Full game

http://etqw-ipgetter.demonware.net/ipgetter/

Sending an HTTP GET request to one of these URLs will return an HTTP message with as content a list of <IP>:<PORT> pairs per line. Each entry is a functioning server and needs to be polled for extra information.

Data Block

The data block for each client is:

Code:

struct client_t {
  short ping;
  int rate;
  char name[32]; // NULL-terminated
  byte clanTagPosition; // 0: prefix, 1: suffix
  char clanTag[32]; // NULL-terminated
  byte isBot;
 };

The data block following all 32 clients is:
Code:

 struct serverInfo_t {
  int osMask;
  byte isRanked;
  int timeLeft;
  byte gameState;
 };

gameState is a bitfield of the following possible items:
For all gametypes (these are three mutually-exclusive):
1 = Warmup/Warmup countdown
2 = Game in progress
4 = Game over, in review screen

For stopwatch:
8 = The return match is active (ie, the second play of the map)

In Version 1.0 and 1.1 the Client Data Block was

struct client_t {
  short ping;
  int rate;
  char name[32]; // NULL-terminated
  byte isBot;
 };

Source