Download

OnlineSubystem Sessions

I’m working on adding LAN sessions into my game (taken from ShooterGame, LAN only) and I have a question. I got hosting and searching working.

It appears that StartSession() has to be called in order for the session to be found (if I don’t have the call in the session can’t be found). I want to have a lobby before the game starts and not allow people to join after the host starts the game from there. Is my only option to update the session settings to not allow people to join before starting the actual game? The description for StartSession says “Marks an online session as in progress (as opposed to being in lobby or pending)”. So i’m a bit confused on how to let people find the session for the purpose of joining a lobby.

If you’re using FOnlineSubsystemNull, there is a bug in 4.5 (and previous versions) that prevents the host from advertising the session immediately upon creation. The fix for this has been checked in and will be in 4.6: https://github.com/EpicGames/UnrealEngine/commit/9726c37e93487b1d4f7e41bd33ef51ae454d6623 if you’re building the engine from source and want to grab it.

With this fix, there should be no need to update the session settings if you set bAllowJoinInProgress to false and call StartSession at the appropriate time.

I also noticed that StartSession is getting called on the clients as well in the Shooter Game, any reason for that?

This is so that clients also have an up-to-date session state in case they need to refer to it, for example to display UI to the user.

Good to know, I am getting started to write code for server, and server searching. Will there be any more documentation up soon?