Dedicated server vs sessions

Dear all

I want to create a lobby for my multiplayer game. To ensure that when players click “play” they all appear in the same game instance, I believe I need to use sessions.

I would also like to use dedicated server / client model.

However these two mechanisms don’t appear to be compatible. I have read that a dedicated server automatically creates a game session:

Can someone confirm this is true ?

So I don’t need to do that, however if I “join session” from the client, I get an array of 0 sessions back i.e. no sessions were found.

I have play → advanced → run as dedicated server ticked, and no. players 2 so each “client” shows in a sperate window.

Is what I am trying to do even possible without modifying code?

Well, after some test it look like the PlayerController is not valid on DedicatedServer, like it’s said on your link. So waiting 2sec is waiting for the Client0 to have a valid controller…

Waiting for 2 seconds doesn’t work for me - still fails to create a session on the dedicated server.

Edit : Doesn’t Work!

Hey, you could try to setup a map which will be used by your main menu. On levelBlueprint, on beginPlay, check “isDedicatedServer”, if true, create session, else, show the main menu UI.

Also you need to set “Server Default Map” to your main menu map in ProjectSettings->Maps&Modes

edit: For a reason I ignore, you have to place a Delay > 2sec before CreateSession if called from LevelBlueprint BeginPlay (tested in editor with “Play as client”)

MainMenuMap LevelBlueprint :

1 Like

I did that and only created session when isDedicatedServer = True… the create session failed - possibly because it was already running a session as:

Suggests ? I don’t know, which is why I am posting in the hope of getting a definitive answer.

Try to set a Delay of 2sec or more before CreateSession, maybe this is needed only if testing from editor and it will work without if running the dedicated server as standalone, I didn’t tested…

Get a look at this Unreal Engine 4.18.3 Dedicated Server Tutorial (Steam / Advanced Sessions) - YouTube , they used Create Advanced Session with no Controller plugged in.

The main node :

Plugin : Advanced Sessions Plugin - Community Content, Tools and Tutorials - Unreal Engine Forums

Wait 2 second - with no player controller plugged in still fails.

Try with the CreateAdvancedSession node, it doesn’t work with standard CreateSession

But that’s part of a plugin I’ve not installed - how do I get it ?

Everything is explained in the Plugin link above : Download the 4.25 zip file (if you are using this version of engine) then follow the “Setup Info” section

I’d rather use native unreal, if possible - I really just want an answer from the devs on whether a dedicated server runs a session or not - the interweb is confusing on the subject

Well, do you want that I delete this answer, so your post is marked with no answer?

I now suspect that dedicated servers and sessions are incompatible. They are 2 mutually exclusive solutions. Consider the following

Dedicated server - all the clients connect to a known server they all join that 1 game on that dedicated server

Sessions - used for when there isn’t a known server, where clients can run as servers, so you need to “find” a list of servers to join, players can join the same game (session) be choosing the same server from the list.

To join a dedicated server, apparently you can “open level” but specify the IP address of the server rather than the level name.

Can someone confirm my new understanding is correct ?

W_Jones

Good idea - how ?