Your project
Multiplayer: test rooms and Steam
Flockbay builds online games on Godot’s high-level multiplayer. While you build, Play hosts a test room that a second window or a friend’s playtest joins with a code. Rooms run only in copies Flockbay opens: the game you export has none. For online play in the game you ship, ask Flockbay to add Steam multiplayer.
Make a game multiplayer
Ask Flockbay for an online game. Before it writes any networked code it asks what kind: online or on one screen, co-op or versus, and how many players, from two to eight.
It builds on Godot’s high-level multiplayer: a MultiplayerSpawner for players and spawned objects, a MultiplayerSynchronizer for state, @rpc methods for events, and the host as the authority over the world. Each player scene is named after its peer id, and that peer owns it.
It also sets flockbay/rooms/friends_can_join to true in the project settings. That is what makes Play host a room, and what puts Multiplayer on the game menu. The first time a game turns it on, the app says what rooms are for.
Rooms are for testing
Each Play of a multiplayer game hosts a room with a six-character code, the same code from one Play to the next. A room holds up to eight players, and rooms are free on every account.
Players connect peer to peer over WebRTC. When a network blocks a direct connection, the traffic goes through a relay.
Rooms run only in copies of the game that Flockbay opens: your Play, a playtest opened in Flockbay, and a Share link opened in Flockbay Playtest. The Multiplayer button and panel at the top right of the game window are Flockbay’s too. The game you export carries none of it, no Flockbay sign-in and no WebRTC library, and plays alone until you add Steam multiplayer.
Test on one computer
- Press Play.
- Open the game menu, then Multiplayer, and choose Open a second window. It opens a second copy of the game that joins the room as another player.
- Play both. Stop ends both windows.
Both windows share the same user:// folder, and one computer shows no network latency. A test with a friend is the real check.
Test with a friend
- Press Play. The Multiplayer button at the top right of the game window shows the room code, and Copy room code in the game menu’s Multiplayer copies it.
- Send your friend the game with Share for playtesting…, and the code.
- Your friend opens the link, which installs Flockbay Playtest on a Windows PC and starts the game. They open the game’s Multiplayer panel, type the code and press Join.
Someone working on the same game, on their own copy from GitHub, can join you from the app instead: Multiplayer, then Join a room…, and the code. Their Play joins your room until they choose Leave room.
The same netcode in both
RPCs, MultiplayerSpawner and MultiplayerSynchronizer run on whichever multiplayer peer is set. In Flockbay that is the room’s, and in the game you ship it is Steam’s, so the gameplay code does not change between the two.
Ship online multiplayer on Steam
The game you ship goes online on Steam. Players host and join in a Steam lobby, invite friends from the Steam overlay, and connect over Steam’s peer-to-peer networking, which Valve relays through its Steam Datagram Relay network by default. Nobody opens a port, you run no servers, and players don’t see each other’s IP address unless their own Steam settings allow direct connections.
Flockbay writes it on GodotSteam, the Steamworks GDExtension for Godot, which Play has already put in a multiplayer game under addons/flockbay_rooms/godotsteam. It is one autoload: it starts Steam, the host opens a friends-only lobby, Invite opens Steam’s invite dialog, and a friend joins from the invite or from Join Game in their friends list, with a SteamMultiplayerPeer as the game’s peer. It does nothing while the game runs in Flockbay, so Play, the second window and playtests keep using rooms. It is an ordinary GDScript file in your project: read it and change it like the rest of your code.
- Get your game’s App ID. It comes with Steam Direct, one app fee per game, paid in Steamworks. Until you have one, Valve’s Spacewar test app, 480, works for testing.
- Ask Flockbay to add Steam multiplayer, and give it the App ID.
- Open the game menu, then Ship, and choose Export for Windows…. Save the build in a new, empty folder: the .exe and the GodotSteam and Steam libraries beside it go to Steam together.
- Upload the .exe and the two DLLs to a depot with SteamPipe, then set the build live on a branch in Steamworks.
Test on Steam
Online play needs two Steam accounts, realistically on two computers, each signed in to Steam.
On 480, start the exported .exe directly, with Steam running, on both computers, and start the game on both before you invite: an invite to someone who isn’t running it opens Spacewar.
On your own App ID, give the second account a key from Steamworks so it owns the game, then both start it from their Steam library.
Turn off multiplayer, or use your own peer
Turn off multiplayer, in the game menu’s Multiplayer, stops Play hosting a room. Your netcode stays, and asking Flockbay turns it back on.
If you want a dedicated server or a direct IP join instead, ask Flockbay. It builds that with a peer of your own, such as ENetMultiplayerPeer.
Related
- Exporting your game
- Version control with Git and GitHub
- Godot: High-level multiplayer
- GodotSteam: MultiplayerPeer
- GodotSteam: Lobbies
- Steamworks: Multiplayer
- Steamworks: Uploading to Steam (SteamPipe)
