GameSpy query protocol version 2 has only a single query packet allowing queries for server information (including rules), players and/or teams.
FE FD 00 43 4F 52 59 FF FF 00 þý.CORYÿÿ.
The first three bytes are always FE FD 00. The next four bytes indicate a unique identifier that helps correlate responses to query requests. You can choose the four byte value yourself. Responses echo these four bytes. The final three bytes indicate which information (server, players, teams) is requested. The values are either 0x00 (no) or 0xFF (yes).
Query response structure
A query response consists of four possible parts.
- Header (always present)
- Server information and rules (when requested)
- Player information (when requested)
- Team information (when requested)
The header consists of a single byte (0x00) delimiter followed by the echo of the four bytes of the query request. Sections 2, 3 and 4 are only present when these have been requested. You do so by setting the each of the corresponding last three bytes to 0xFF.
00 43 4F 52 59 68 6F 73 74 6E 61 6D 65 00 55 53 .CORYhostname.US
Section 2 contains key/value pairs. Both key and value are string based. String values are zero delimited (0x00). This section is ended by an empty key/value pair (double 0x00).
00 64 65 64 69 63 61 74 65 64 00 31 00 73 74 61 .dedicated.1.sta
74 75 73 00 34 00 67 61 6D 65 5F 69 64 00 62 66 tus.4.game_id.bf
Section 3 and 4 start with a count followed by field descriptions. The count is a byte value indicating the number of players and teams. Each field is named with a trailing underscore (_) and are string based. The final field is delimited from the actual values by an additional zero byte (0x00). The values are repeated in the same order as the fields. All values are strings.
56 69 65 74 6E 61 6D 00 00 00 0A 70 6C 61 79 65 ;Vietnam....playe
72 5F 00 73 63 6F 72 65 5F 00 64 65 61 74 68 73 ;r_.score_.deaths
5F 00 70 69 6E 67 5F 00 74 65 61 6D 5F 00 6B 69 ;_.ping_.team_.ki
6C 6C 73 5F 00 00 41 72 6D 61 6E 64 65 20 48 61 ;lls_..Armande Ha
6D 6D 65 72 00 32 30 00 35 00 38 30 00 31 00 35 ;mmer.20.5.80.1.5
00
Resources
- http://int64.org/docs/gamestat-protocols/gamespy2.html
- http://www.codeproject.com/KB/game/gameserverinfo.aspx
-
http://gameq.sourceforge.net/