Lobbies
Lobby players and the host
List who is in a lobby, find the host, and react when people come and go.
Listing everyone
Call Get Lobby Members with a lobby ID. You get an array of Steam Lobby Member:
| Field | Meaning |
|---|---|
| Player | Their Steam ID |
| Persona Name | Their Steam display name, ready to show |
| Is Local Player | True for the player holding this copy of the game |
| Is Owner | True for the host |
That is everything a player list widget needs, with no follow up calls.
For just a count, use Get Lobby Member Count.
Finding the host
Two ways, depending on what you need:
- Get Lobby Owner returns the host's Steam ID.
- Is Lobby Owner returns whether the local player is the host, which is what you usually want for showing or hiding host only buttons.
The host is whoever created the lobby. If they leave, Steam picks a new one automatically.
Reacting to people joining and leaving
Bind On Lobby Member Changed on the SteamForge Lobbies subsystem:
| Output | Meaning |
|---|---|
| Lobby | Which lobby |
| Member | Who changed |
| Change | Entered, Left, Disconnected, Kicked or Banned |
The usual handler simply calls Get Lobby Members again and rebuilds the list.
Disconnected is worth treating differently from Left. Left means they chose to go. Disconnected means they crashed or lost connection, which is the case host migration exists for.
Per player data
Each member can publish their own key and value pairs, which is how you carry a chosen team, character or ready state.
- Set Lobby Member Data sets one of your own values. You can only ever set your own.
- Get Lobby Member Data reads anyone's.
A ready check is the classic use:
- When the player presses Ready, call Set Lobby Member Data with key
readyand value1. - Everyone receives On Lobby Data Changed.
- In the handler, loop the members, read each one's
readyvalue, and update your UI.
On Lobby Data Changed
This fires for both kinds of change. The Member output tells you which:
- A valid Member means that player's own data changed.
- An invalid Member means the lobby's shared data changed.
Check with Is Valid (Steam ID) before assuming.
Where to go next
Lobby data, for the shared settings everyone reads.