Advanced Sessions STEAM

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Advanced Sessions with FPSMT

FPS Multiplayer Template V4.02


Unreal Engine V4.27
By The Jackal - 17/03/22

Introduction
This is a basic guide on implementing and using Advanced Sessions with the FPS Multiplayer
Template.

I will cover creating, finding and joining Advanced Sessions. I will also add a section about how to
add additional information to the session and list it in the session browser like the map name.

Also note that I am using steam core in my example and there might be some slight variation
between different Advanced Session plugins.

Contents
Step 01: Enabling your plugin
- Enable your plugin
Step 02: Creating Advanced Sessions
- Navigate to old create session logic
- Changing to Advanced Sessions
Step 03: Joining Advanced Sessions
- Editing the Session Browser
- Editing the Session Result Button
- Finishing the Session Browser
Step 04: Adding Additional Parameters
- Creating a Session Setting
- Using a Session Setting
STEP 01: Enabling your plugin

Enable your plugin


Of Course you need to enable your plugin, whichever version of it you are using, the Advanced
Sessions from github or the steamcore plugin that has advanced sessions. In my example I have
Steamcore.

Any plugin you have added should be in the ‘installed’ section or there might be another section
called ‘Project’.

For me it's here, and make sure you have the enabled box checked. After that a prompt will come
up at the bottom explaining; you need to restart the project for the plugin to work.

Click the restart button. Once your project has restarted. Just check your plugins and make sure
it's enabled.
STEP 02: Creating Advanced Sessions

Navigate to the old create Session logic.


To start you will need to find the widget that is responsible for creating a multiplayer session. This
is the WB_CreateMatchMenu widget blueprint.

You will find this in the ‘FPS > UI > Menus’ Directory.

Open the widget blueprint, make sure you are on the graph editor. Head to the event
‘CreateMatch’ you should find the logic that looks like this:
Changing to Advanced Sessions
Most of the logic here is fine, the number one issue here is the ‘Create Session’ node. Right click
the graph and search for ‘Create Session’ you should be greeted with a number of options.
Obviously the plain one isn’t the one you want. You maybe looking for ‘Create Advanced Session’
or like in my case ‘Create Steam Core Session’

Once you find that, drag the nodes from the current create session to the new Advanced Session
node that matches the inputs.

“Note: you may or may-not have a ‘Player Controller’ input. if you do, just connect the player
controller reference in. If you don’t, then you can't delete the player controller node or use it to
get the player name. In my example I don't have an input for it but I do use it to get the player
name for the server name.”

I’m not going to explain what everything is for, but unless you know what you are doing, you
should leave these as it is. Of course, if you want to know the purpose of all these options, I
highly advise reading about them and what their actual function is.

You can also add a widget component for players to enter their own server name and input that,
so that will come up on the session browser instead.
STEP 03: Joining Advanced Sessions

Editing the Session Browser


So now we need to edit the session browser to find the new type of steam sessions. So in the
same directory as the ‘Create Match’ widget you can find the ‘WB_JoinServerMenu’. Open this
and head to the graph editor.

Let's start with replacing the ‘Find Sessions’ Node, in my example, again I don’t have a player
controller pin the node will no doubt be bigger so you might want to make space. This is how
mine looks:

Now again we will need to change the ‘Sessions Found’ Array Variable Type. from ‘Blueprint
Session Result’ to ‘Steam Session Result’. This will break a connection like before, it's the array to
the For Each Loop.

Just delete the node and re-create it from the new array element from ‘Sessions Found’. Then
from the Array element you will want to ‘Break’ the pin and get the result data and connect it to
the old result link. Should look like this:

Don’t forget further along there is a ‘Set Session To Join’ node, this will probably be red now,
break the link for the moment. We need to edit the session slot widget before we can fix this.
Editing the Session Result button
In the same directory as the ‘CreateMatch’ and ‘JoinServer’ Widget, there is WB_ServerSlot.
Open this widget BP, then the first thing we need to do is change the ‘SessionToJoin’ Variable
type. It is currently a ‘Blueprint Session Result’. Click on the Variable type and change it to ‘Steam
Session Result’

(CAUTION: This may be named something else with different advanced sessions plugins)

It will give you a warning about changing the variable type. Just continue, once you’ve done it
should look like this:

Some of your blueprints may be affected after this change:

Now you can’t just connect the new output node to the Max players, Current players and so on,
because the new session result doesn't just contain the session data, it also contains the session
settings. So break all the red links from the old ‘Session To Join’, then drag out of the new pin and
‘Break’ the pin. Then from the result pin you can connect to the previous nodes as mentioned.
It should look like this:
Once done, compile the BP and you should get a warning in your compiler results, it’s for the ‘Get
Server Ping’ function.

“Note: right now, in this state, this is broken, it doesn't seem to provide any ping data. You could
just remove this if you’d like. I believe you need to use the ‘Steam Sockets’ Plugin in order to get
the ping from a session. This is a really murky area and if you want to pursue this, then I suggest
you read into it a bit more.”

But again to fix this, drag out from the new ‘Session to Join’ pin, Break it and then connect the
result pin to the ‘Get Ping in Ms’. just like my example:

Also, you may have noticed you have a ‘Server ping’ variable which is being set from the Session
browser widget. It might be worth the above Ping check for the below check.

Finishing the Session Browser


Now return to the session browser widget (WB_JoinServerMenu), I recommend compiling the
blueprint just to refresh any of the nodes. You should be able to connect the ‘Steam Session
Result’ to the ‘Session to Join’ node.

“Note: not to be mistaken for the Broken ‘Session Result’ but the ‘Array Element’ directly.”

It should now show like like this:


STEP 04: Adding Additional Parameters

Creating a Session Setting


In the ‘Create Match Menu’ Widget we are going to add some new logic and create a setting.

“Note: I have collapsed the nodes for getting the players name for the server name. So it's easier
to see what's being added.”

So start by right clicking and typing ‘Make Map’ into the context browser and then connect the
map output node to the ‘Sessions Settings’ input.

The ‘Key’ is the name of the setting essentially. So in this case I will call it MAP_NAME. From what
I remember the value can be one of 3 values, a String, Integer or Boolean, so being that it's a
name we will want to get the Map name and store it in here.

In my example I'm going to pass the ‘GameModeNames Enum’ value to the create game event.
So first I created a pin on the ‘CreateMatch’ event for GameModeNames Enum. now i can pass
the GameModeName into the create match event.

For Example:
Now we can get that and save that as a server setting, to do this we want to drag from the game
mode enum I have and get an ‘Enum to string’ node.

Then you will want to next drag from the ‘Value 0’ pin and get a ‘Make String’ node. Of Course
after all of this, you then connect the ‘enum to string’ node into the ‘make string’ node. And it will
end up looking something like this:

Using a Session Setting


If you go into the ServerSlot Widget and go to the designer, obviously here we will want to add a
section for our Map/Mode Name the visuals of your slot is down to you, this is mine:

Like the server name, create a function that is bound to the text content, if you click the bind
button, there should be a ‘Create Binding’ option. This will automatically create a function that is
bound to the text box.

Inside we will want to get the server setting of the session and set it to the text. Here is my
example:

If you have lots of settings then you can run multiple checks at once. But this example will grab
the map/mode name from the MAP_NAME key element. Then parse it into the return node which
will populate the text box for the Map name i added.

You might also like