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…
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”)
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…
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
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 ?