Lobbies
Lobby data
The shared key and value store every member can read, and searches can filter on.
Lobby data is a small store of text keys and values attached to a lobby. It does two jobs:
- It carries settings every member should see, like the map and game mode.
- It is what lobby searches filter on.
Anything you want visible in a lobby browser has to live here, because a search reads lobby data and nothing else.
Writing
Set Lobby Data takes a lobby, a key and a value. Host only.
Typical use, straight after creating a lobby:
| Key | Value |
|---|---|
name | Alisahan's game |
map | Warehouse |
mode | deathmatch |
version | 1.4.2 |
The keys are entirely your choice. Pick a set, write them down, and use the same ones in your search filters.
Reading
- Get Lobby Data reads one key.
- Get All Lobby Data returns everything as a map, which is what you usually want when building a browser row.
- Delete Lobby Data removes a key. Host only.
Search results already include this map, so you do not need to call anything extra for lobbies you found through a search.
Size limits
Steam caps a single value at 8192 bytes, and keys at 255 characters. Lobby data is for small settings, not for content.
If you need to move more than that, send it over the networking layer once players are connected.
Publishing a game server
When the host starts the match, they publish where everyone should connect:
- Set Lobby Game Server takes an address and port, a Steam ID, or both.
- Every member receives On Lobby Game Created.
- Each member then travels themselves. Travel To Lobby Game Server does that for you.
Travel To Lobby Game Server picks how to address the host from your project's networking. With a Steam net driver configured it connects by Steam ID through Valve's relay, and otherwise by the published address. Publish both and the same call works either way. See playing over the internet.
Version gating
Publishing your build version as lobby data lets you keep incompatible players out before they join rather than after:
- Host publishes
version. - Searchers compare it to their own version.
- Grey out mismatched lobbies rather than hiding them, so a player can see their friend's lobby and understand why they cannot join it.
The Sessions layer does this for you if you would rather not build it.