Tutorial: a working multiplayer menu
Step 2: Host a session
Wire the Host button to Host Session And Travel, and confirm the session exists.
The first real SteamForge node. Everything in this step happens in WBP_MainMenu's graph.
Get to the graph
Open WBP_MainMenu and click Graph in the top right. Designer and Graph are two views of the same asset.
Add the button event
- Find
Button_Hostin the Variables list on the left. - Drag it into the graph.
- Drag off its pin, search for On Clicked, and choose Assign On Clicked.
You now have an On Clicked (Button_Host) event. Everything below hangs off its execution pin.
Build the settings
Host Session And Travel takes a Steam Session Settings struct, so you have to make one.
Add a Make Steam Session Settings node and fill it in:
| Pin | Set it to |
|---|---|
| Session Name | Anything. My Test Session will do. |
| Map Name | L_Match |
| Game Mode | Leave empty |
| Max Players | 4 |
| Private | Unticked, so searches can find it |
| Password | Leave empty |
| Build Id | Leave empty |
.umap path on disk. The full package path works too, /Game/Maps/L_Match, and is worth using if you ever end up with two levels sharing a name.Add the host node
- Drag off the On Clicked execution pin and add Host Session And Travel.
- Connect Make Steam Session Settings into its Settings pin.
It has two output execution pins, On Success and On Failure, because Steam answers later rather than immediately. Nothing has happened yet at the moment execution leaves the node itself.
Turn travel off for now
The node travels to the map by default. For this step you want to stay on the menu and see what happened.
- Click the small downward arrow at the bottom of the node to show its advanced pins.
- Untick Travel.
With Travel off you get a pre-match lobby: the session exists and is findable, and everyone stays put until you decide to start. That is what the Start button is for later.
Report what happened
Wire both output pins to something visible, or you are debugging blind.
From On Success:
- Drag
Text_Statusin from the Variables list. - Drag off it and add Set Text (Text).
- Type
Hosting.into the In Text pin.
From On Failure, do the same with a different message. That pin also carries a Result output: drag off it, add Break Steam Result, and feed its Explanation field into the text instead of typing one. That field is written to be read by a human.
Compile and save.
Check it
Press Play and click Host. The status line should read Hosting.
That is the whole check available at this point. The lobby exists on Steam, and nothing on screen can show you it yet. Find in the next step is what proves it is really there and really findable.
Steam is not available means go back to First steps; anything else usually says what to do about it.