Ali Şahan Yalçın
DocsStep 2: Host a session

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

  1. Find Button_Host in the Variables list on the left.
  2. Drag it into the graph.
  3. 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.

INFO: Assign creates the event and binds it in one step. An event node you add on its own never fires, because nothing bound it.

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:

PinSet it to
Session NameAnything. My Test Session will do.
Map NameL_Match
Game ModeLeave empty
Max Players4
PrivateUnticked, so searches can find it
PasswordLeave empty
Build IdLeave empty
WARNING: Map Name is a level's asset name, not a display name and not a .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.
WARNING: This is a string, so nothing in your project references that level. Unreal's cooker follows asset references, so unless you say otherwise the map is left out of packaged builds, and starting a match travels somewhere that does not exist. Fix it now, before you forget: Project Settings > Packaging > List of maps to include in a packaged build, and add both levels. See the shipping checklist.

Add the host node

  1. Drag off the On Clicked execution pin and add Host Session And Travel.
  2. 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.

  1. Click the small downward arrow at the bottom of the node to show its advanced pins.
  2. Untick Travel.
INFO: Travel is an advanced pin, hidden until you expand the node. Several SteamForge nodes do this. If a pin these docs mention is not visible, look for that arrow.

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:

  1. Drag Text_Status in from the Variables list.
  2. Drag off it and add Set Text (Text).
  3. 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.

INFO: If the status line shows a failure instead, read it. It is the Explanation from the result, written for a person. Steam is not available means go back to First steps; anything else usually says what to do about it.

Where to go next

Step 3: find and join.