This project is a usage sample of rollback netcode using Backdash.Gns in Godot.
It shows a basic example of an online lobby using Steam P2P Matchmaking & Lobbies.
backdash-gns-godot-sample-2.mp4
This creates and/or joins a Steam Lobby via ISteamMatchmaking interface.
When the host creates a Steam lobby, it sets some metadata about the lobby with ISteamMatchmaking.SetLobbyData().
- Key:
"GameTitle"- Value:
"BackdashGnsGodotSample"- This exists to filter out other game lobbies that uses the same test AppId 480
- Value:
- Key:
"LobbyName"- The name of the lobby This metadata is used in the browse lobby scene.
When a client enters the lobby, it sets some metadata about itself with ISteamMatchmaking.SetLobbyMemberData():
- Key:
"Spectator"- Value:
"1"- it's a spectator - Value:
"0"- it's a player
- Value:
- Key:
"Ready"- Value:
"1"- it's ready - Value:
"0"- it's not ready
- Value:
To start the game, the lobby owner sends a message with ISteamMatchmaking.SendLobbyChatMsg() when every player is ready.
This message consists of the players and spectators list:
- Magic string "BG" (2 bytes)
- Message kind (1 byte)
- This is always
0, as we don't have any kind of message other than this "start game"
- This is always
- Number of players (1 byte)
- For each player:
- Player's Steam ID (8 bytes)
- For each player:
- Number of spectators (1 byte)
- For each spectator:
- Spectator's Steam ID (8 bytes)
- For each spectator:
This protocol is very rudimentary, but it does the job for this simple demo.
- Arrows: Move
- Space: Fire
- Left Ctrl: Missile
You must be running the Steam client to run this sample.
On some platforms, you might need to create a steam_appid.txt that has only 480 written in it, in the executable's directory.