Game Server Query Protocol
What is a Server Query?
A query is a request for information from a single gameserver instance, the server should then respond with a set of information that is constantly updated and refreshed. Each value is refreshed but the fields returned stay the same. This is normally accomplished over UDP.
The most popular type of query is a2s which is used by most steam games as it was first introduced with Halflife, adopted as part of the SteamSDK and now natively supported in many other game engines.
The implementation in this document means that the gameserver will directly respond to the requests
a2s Query Protocol
a2s can be enabled various ways in different game engines, the main requirements are https://developer.valvesoftware.com/wiki/Server_queries
Clanforge Requirements for a2s
If you were to manually add a2s, Clanforge needs the gameserver instance to respond to the minimum of:
Players and Max Players needs to be valid amounts as Clanforge monitoring works on the amount of players and maxplayers of a server to calculate resource usages. The gameserver must respond with maxplayers => players There must be valid map returned however it can be a can be a static string, however Clanforge can track crashes based on maptype, so its highly advisable to include accurate data here.
- Only supports queries as a single packet. Can support multiple packets at once.
- Response packets with large payloads will be split at approximately 1248 bytes (total packet size will be < 1400 bytes)
- Does not support packet compression
- The query implementation should interact with the main game loop, this is because Clanforge can then detect if the process is unresponsive.
- Any A2S_INFO, A2S_RULES or A2S_PLAYER should request a A2S_SERVERQUERY_GETCHALLENGE if one has not been sent or requested, this is to avoid DDoS amplification.
Other Query Protocols
There are other types of query protocol and you can even write you own. To test a query protocol you can use our open source tool qstat here: https://github.com/multiplay/qstat and also see the other query types we support.
The below is a Counter-Strike, Global Offensive Server, which runs the a2s protocol via steamworks.
Command: qstat -xml -a2s 18.104.22.168:27115 <qstat> <server type="A2S" address="22.214.171.124:27115" status="UP"> <hostname>126.96.36.199:27115</hostname> <name>1v1 Aim Arena #16 [Moscow]</name> <gametype>csgo</gametype> <map>am_ramps</map> <numplayers>18</numplayers> <maxplayers>24</maxplayers> <numspectators>0</numspectators> <maxspectators>0</maxspectators> <ping>53</ping> <retries>0</retries> </server> </qstat>