Ali Şahan Yalçın
DocsLobby data

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:

  1. It carries settings every member should see, like the map and game mode.
  2. 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:

KeyValue
nameAlisahan's game
mapWarehouse
modedeathmatch
version1.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.
WARNING: Steam does not move anybody. It only tells them where to go. A game that publishes a server and does not handle On Lobby Game Created on the clients is the reason "the host started the match and nobody followed" happens.

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.

INFO: All of this is done for you by the session layer. Start Match publishes the address, and joiners follow on their own. Build it by hand only if you want control the session layer does not give you.

Version gating

Publishing your build version as lobby data lets you keep incompatible players out before they join rather than after:

  1. Host publishes version.
  2. Searchers compare it to their own version.
  3. 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.

Where to go next

Chat and invites.