Help setting up multiplayer - Create a session

Hello guys.
I need help setting my multiplayer session.

I followed this tutorial by @eXi
After setting up everything as described and without any compilation error, now I’d like to know how to use this functions/delegates.

I have a widget blueprint for the MainMenu with two buttons:

When I click **HOST **this happens

But when I run the game with 2 players and I click the HostGame button:

What does it mean?

I think the error is in the HostSession function:

SessionSettings->Set(SETTING_MAPNAME, FString("NewMap"), EOnlineDataAdvertisementType::ViaOnlineService);

Looks like I have to change the name for my map. But I tried and that's not the problem.

Also, always in the HostSession() i set this parameters:

SessionSettings->bIsLANMatch = bIsLAN;
SessionSettings->bUsesPresence = bIsPresence;
SessionSettings->NumPublicConnections = MaxNumPlayers;
SessionSettings->NumPrivateConnections = 0;
SessionSettings->bAllowInvites = true;
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bShouldAdvertise = true;
SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bAllowJoinViaPresenceFriendsOnly = false;

How do I let the player choose those?
When I call the function I don't pass any argument to it.

Clarifications needed.

Hey, my setup was very basic. Because i didn’t want people to have a full packed function that they don’t want or which looked too complicated to understand.

You can always check what things i pass to the Host functions and extend it to let the Player fill these settings.
You would just need to add more parameters to the HostSession(…) function and then also add these to the BlueprintCallable function, so you
can actually pass information from the Menu Widget.

Also keep in mind that launching a game in PIE with 2+ Players will always come with an already existing connection between them.
If you want to test it with 2+ players without the initial connection, make sure to compile everything and go to your *.UPROJECT file in
your Project folder. Right click the file an hit “Launch Game”. Once for each copy of the game you want to start.

Very nice, I can host my match now. But now I open a new Game Window because I want to actually Join my session, ok?

So this is what happens when I click the Join button in the Menu:

When I play and click the Join button, nothing happens.

Searching a Session needs time. It’s not a direct action.
You need to split “Find Online Games” from “Join Online Game”.
Make sure you wait a few seconds before trying to join.

You should also try to add some Log Information to the whole Find Online Games thing inside of C++, so you can see
if you actually found something.

The C++ code gives you an array of Session Results back, so you should be able to print the length of this Array.

A simple print can be done with:

GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("MyText"));

I just wrote that down from memory, so make sure to check the spelling. For adding a variable to it, you can try doing this:

GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString("Number of Found Sessions") + FString::FromInt(NumberOfSessions));

Where NumberOfSessions is a variable or the direct length of the Array. Again, double check my spelling on these code stuff. I don’t have my VS open atm.

This is the result:

Well, I set the LAN to false, because I opened the **7777 **port cause I want my friend to play with me once I give them the game.

If I set the LAN to true this happens:

It finds 2 sessions *(umh? why? i hosted only one!) *but I keep standing in the level without joining that session

You can only use “LAN” as long as you don’t have a Subsystem like Steam.
It can’t find online Sessions without a MasterServer.

For online, you either need a Subsystem or Connect Via IP.

I don’t know why you find 2. Maybe you started the Game in PIE and created a second Server with the Client.
Or you did not destroy the first Session :X

What I don’t understand is this: it finds the session but it doesn’t join


I have a NULL OnlineSubSystem.
I’d like to be able to host a match, and want my friends to connect to that match using my public/static IP address.
I already opened the port 7777

NULL Subsystem is a dummy one. That doesn’t count. To connect over the Internet with this, you need to have a TextField for your Friends to type in
your IP Address and then fill it into a “Execute Console Command” Node with “open IPADDRESS”.

I host the match, but the I try to connect via IP nothing happens.

This is the button to Join via IP:


And this is the Host Session function:

What’s the problem?

Hosting for a simple IP Network Game doesn’t need Sessions i think.

You would be good with just calling the “Open Level” node with “listen” as an argument. The Session System is more
for actual matchmaking.


If I HostSession() from my PC, how does my friend find my session using FindSession() and JoinSession()?

Am I forced to have an OnlineSubSystem like Steam?

If yes, since it’s too early to think about Steam, should I use the commands open MapName to host (me) and open ip.ip.ip.ip to join (my friend from the other side of the world)?

If yes, this doesn’t work! (Widget Blueprint of the Main Menu)


Yes, to find a Session via Internet, you are forced to have Steam or any other Subsystem/MasterServer. The NULL Subsystem does NOT support online matchmaking.

For opening a level, try the normal “OpenLevel” node and add “listen” as an option.
Try this first with your Local PC. Start the game twice with “Rightclick->LaunchGame” on the *.UProject file in your Project folder.
Then use one Instance to host via OpenLevel and connect with the other via the IP “”. If that works, you can try connecting
over the internet. If that doesn’t work, then i’m a bit out of question, because this needs to work on a local setup.

If it works but connecting over the Internet does not work, then you have Port Forwarding issues.

Isn’t there a way to test the Steam OnlineSubSystem without having a Greenlit game?

Using my public IP address doesn’t work:


Are you sure the port to be forwarded is 7777?

I think there are multiple Ports you need to forward, but i don’t know which right now. But you will find them with a bit of google.

And yes you can test Steam. Steam has a Test AppID 480, but it can be that Searching Sessions gives you more sessions than you
want, because everyone is using that ID.

Hey there.

I’ve been off all these time because I have been set up a Dedicated Server for my test project and I finally got it work.
Also, my friend can now connect to my session succeffully.

One thing that I don’t like is that once we’re in a session (both my friend and me) it looks like we have a huge FPS drop.

When I’m in no session it doesn’t happen, but as long as I host the session it’s like our FPS get dropped.
Is that about ping or FPS?

Well you can monitor FPS and Ping. So why not just look what it is? :smiley: I can’t tell you