GameAgent.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. GameAgent is the replacement for gameserver management, such as the serverlist.
  2. Querying the masterserver can be done using UDP packets the following way:
  3. UDP Masterserver:9005 {
  4. char 'e'
  5. }
  6. This will make the masterserver respond with a list of servers currently joined and alive in the following way:
  7. UDP {
  8. char 's'
  9. 4 bytes of the IP (0x7F 0x00 0x00 0x01 would be 127.0.0.1)
  10. short of the port
  11. }
  12. To query gameservers for their current status, use their enumeration port (server port + 1):
  13. UDP Gameserver:25601 {
  14. byte 0x02
  15. }
  16. An example response would be:
  17. UDP {
  18. char '0'
  19. string ";players;8"
  20. string ";maxplayers;16"
  21. string ";level;Yodeller"
  22. string ";gametype;Fragmatch"
  23. string ";version;1.10"
  24. string ";gamename;serioussamse"
  25. string ";sessionname;Awesome Server"
  26. }
  27. Note: strings in this documentation are not null terminated unless pointed out otherwise.
  28. This particular server would be a fragmatch server called "Awesome Server", having 8 out of 16 players, playing on Yodeller running on version 1.10.
  29. To query a gameserver for the players, you would do the following:
  30. UDP Gameserver:25601 {
  31. byte 0x03
  32. }
  33. An example response would be:
  34. UDP {
  35. byte 0x01
  36. "players"
  37. byte 0x02
  38. "8"
  39. byte 0x03
  40. { // for each player
  41. "player_0"
  42. byte 0x02
  43. "Angelo"
  44. byte 0x03
  45. "frags_0"
  46. byte 0x02
  47. "14"
  48. byte 0x03
  49. "ping_0"
  50. byte 0x02
  51. "80"
  52. byte 0x03
  53. }
  54. byte 0x04
  55. }
  56. Where "0" after the "player_" and "frags_" is the index of the player in the server, not a counter.
  57. Note: Players can be sent in multiple packets. Wait for the last 0x04 byte in a packet.
  58. The player querying is done differently than the server status query to work around issues with seperator characters in player names.
  59. Some useful things to remember when working with this packet:
  60. Byte 0x01 in ASCII is SOH; start of header.
  61. Byte 0x02 in ASCII is STX; start of text.
  62. Byte 0x03 in ASCII is ETX; end of text.
  63. Byte 0x04 in ASCII IS EOT; end of transmission.
  64. Invalid player names are indicated by either byte 0x11 or 0x12 as the player name (in "player_0").