I haven't been following mainline GG2 development in a long time.
What exactly is the mod lobby, and more importantly, what do I have to do on my end to make sure my mod is compatible? Thanks in advance.
The mod lobby is a new protocol for sending things to the lobby and receiving data from there. The old one only had one fixed "name" field where all information had to be squeezed, the new one can be used to store basically any kind of extra data for the server (arbitrary fields). A few of those fields are standardized, e.g. "name" for the server name, "map" for the current map or "game" for the name of the game/mod.
The other difference is that incompatible games are now shown in the lobby list too. This way you can see when modded games are running, and the extra information helps you to find out which mod they use and where to get it.
Servers connecting with the old protocol still work, and the lobby tries to extract map name and player numbers from the server name.
Look at the current
lobby registration code to see how a registration is sent. You should be able to get the right idea from there, but just to be thorough, here's the protocol spec I wrote:
All multibyte values are big-endian. All strings are UTF-8.
+ 0 Registration protocol (UUID = b5dae2e8-424f-9ed0-0fcb-8c21c7ca1352)
Everything below here is only valid for this registration protocol ID
+ 16 Server ID (UUID)
A unique identification for this server. This will be used later to allow servers to register
alternative endpoints (probably only used for IPv6 endpoints). This means the ID does not need
to be persistent between server restarts, and can be generated at startup.
+ 32 Lobby ID (UUID = 1ccf16b1-436d-856f-504d-cc1af306aaa7 for GG2 and its mods)
This defines a kind of "community scope" of related games/mods
+ 48 Transport protocol (0=TCP, 1=UDP, needs to be 0 for now, other values are reserved)
+ 49 Port number (uint16)
If the transport protocol is TCP (the only option for now), this needs to be an open TCP port
reachable from the lobby. You cannot run multiple servers on the same port. If the lobby
receives a registration with the same IP, port and transport protocol as an existing server,
the existing entry will be replaced.
The port must not be 0 in TCP or UDP, since this is not a valid port number.
+ 51 Number of total player slots (uint16)
How many actual players (not bots) can be in the game?
+ 53 Number of occupied player slots (uint16)
How many actual players are in the game?
+ 55 Number of AI players (uint16)
Note that bots+players can be greater than player slot count. If you want a fixed number
of bots as well as a fixed maximum number of players per team, subtract the bot slots
from the player slots.
+ 57 Flags (uint16)
- :0 Password protected
- rest reserved
+ 59 Number of entries in key/value table (uint16)
+ 61 key/value table
Each entry consists of:
+ 0 key length (bytes) (uint8)
+ 1 key
+ n value length (bytes) (uint16)
+ n+2 value
There is a distinction between "specified" keys and "extension" keys. Specified keys have a
fixed meaning, which allows them to be used for collecting statistic information or generic server
browsers. Extension keys always start with "x-" to mark them as extension, e.g. "x-respawntime". Their
meaning is not specified and any game can define its own extension keys. The prefix is supposed to
prevent name clashes with new keys specified in the future.
It is mandatory to provide a server name, all other keys are optional.
The following specified keys exist:
protocol_id: A binary 16-byte UUID which can be used by clients to determine whether the server is
compatible and can be joined. This might be replaced with a more sophisticated system
later, since compatibility is sometimes one-way.
name: The server's plaintext identification (e.g. "Bacon Town 24/7").
game: The name of the game or mod this server is running. E.g. "Vindicator's Server Mod"
game_short: Abbreviated version of "game", for display in small space. E.g. "vinmod" or "gg2".
Should only be provided if "game" is present too. Can be left out if "game" is short
already.
game_ver: Short version string for the game, e.g. "v2.3.7b2"
game_url: URL with information about the game/mod
map: The map currently running on the server.
You need to send this to the Lobby at port 29944 as a UDP packet. Servers are dropped from the list after 70 seconds, so gg2 sends registration packets every 30 seconds to be on the safe side.
To query the current list, you connect to the lobby at TCP port 29944 and follow this protocol (quite similar to the registration one, so a bit condensed):
Client request:
+ 0 Requested list protocol (UUID = 297d0df4-430c-bf61-640a-640897eaef57)
Everything below here is only valid for this list protocol ID
+ 16 Requested lobby (UUID = 1ccf16b1-436d-856f-504d-cc1af306aaa7 for GG2 and its mods)
Lobby reply:
+ 0 Server count (uint32_t)
+ 4 Server list
For each server:
+ 0 Server data block length excluding this field (uint32)
+ 4 Transport protocol (0=TCP, 1=UDP, always 0 for now)
+ 5 IPv4 endpoint port number (uint16, 0 if no IPv4 endpoint known)
+ 7 IPv4 address (4 bytes, ignore if port is 0)
+ 11 IPv6 endpoint port number (uint16, 0 if no IPv6 endpoint known)
+ 13 IPv6 address (16 bytes, ignore if port is 0)
+ 29 Number of total player slots (uint16)
+ 31 Number of occupied player slots (uint16)
+ 33 Number of AI players (uint16)
+ 35 Flags (uint16)
- 31:0 Password protected
- rest reserved, ignore for now
+ 37 key/value table
Each entry consists of:
+ 0 key length (bytes) (uint8_t)
+ 1 key
+ n value length (bytes) (uint16_t)
+ n+2 value
I hope you can make any sense from that
Btw, even though it says that strings are UTF-8, Gang Garrison currently uses the local Windows encoding, so best not use any exotic characters.