Online Sessions - "GameSessionName"

Hi everyone,

I’m doing some work with sessions at the moment, and I don’t get how to use “GameSessionName” - It’s const, but seems to be used all over the place for creating/joining sessions. Whenever I try to use different variables for named sessions, at some point or another, “GameSessionName” pops up and causes some errors.

Could someone please explain how I would be expected to use GameSessionName or get around the problem of it always appearing, since as far as I am aware, you need uniquely named sessions.

Any help/comments on this would be appreciated!

hi for better understanding take a look to “Advanced Session Plugin” by mordentral (Advanced Sessions Plugin - Programming & Scripting - Epic Developer Community Forums)

you get the gamesessionname by the onlinesubsystem when you create a session or as a sessionresult when you search for sessions. for steam it is equal the steamname…take a look at multiplayer shootout sample

so if you want to use custom servernames you have to add a custom session property (Online Subsystem Types in Unreal Engine | Unreal Engine 5.2 Documentation) and use that info in your server browser instead of using the gamesessionname

Session names are just a simple way to implement a basic matchmaking system that handles two states: game and lobby. UE4 expects to have your Game session use an FName("Game") while your lobby session FName("Party"), the name for the lobby session is a legacy from XBox Live where you gather a Party.

Long story short, if you are not up to creating a full lobby/game system and you only want to use a simple find/join system just use the "Game" session name, UE4 already knows what to do for the Game session.

1 Like

Thanks for the explanation, this was really helpful! Say I wanted to persue the full lobby/game system, does this mean I would need end the “Party” session, then create a new session for when the “Game” starts?

You would have both sessions on at the same time, the game session would be there to hold all members of the game session while the party/lobby session would hold your party or team. For example you could build a team based matchmaking system where your party would be your team finding pvp matches againts other parties.

That makes sense! Thanks a ton!