Download

Advanced Sessions Plugin

Out of curiosity, does this let you set the ‘server’ name when you host a session? Or the player name (other than just picking the computer name)?

Inviting friends already by default uses the current session with my nodes, you don’t have to pass anything in. And the session search result structure is fairly useless to the host, you can get the same information with the “getsessioninfo” function / node. The person being invited gets the session struct from the OnFriendInviteDelegate that is part of my AdvancedFriendsInterface with this plugin.

From the plugin setup notes: “If you want the AcceptedSessionInvite event to be called in the owning player controller you also need to add the AdvancedFriendsInterface to the blueprint for your player controller.” It also calls it in the game instance as well.

If you want to do it yourself, just setup the AcceptedSessionInvite Delegate.

Yes

EXCELLENT! I will have to download it and replace the normal BP sessions stuff. And hope I can compile it into a final project correctly. Thanks loads, this is stuff they SHOULD of had in BP’s long ago.

I had a feeling I’d overlooked something. Thanks!

Sorry for how semi incomprehensible that paragraph was, I was in a Dota match when I read the thread and tried to bang out a reply. Thinking about it more I don’t have a tutorial for how to use the custom Game Instance and Player Controller interface, so I will try and get something up soon to explain how to use them with this plugin as it is more complicated than the rest of the plugin.

I looked at the plugin yesterday, and LOADS of tutorials about sessions. Can not figure out how to set server name (vs gamename) or player name… the lack of documention for UE4 is maddening.

For custom server name you need to use “make property string” node and plug it in extra settings on “create session” node.
And when you run “find session” node use “get session property string”.

:smiley:

Edit:

You can only do that with Advanced sessions plugin. :smiley:

When using a compatible subsystem like steam the GetPlayerName node will return the players subsystem name as a value. On the PostLogin event in your gamemode you get the playercontroller reference to the person that logged in. You can pass this in to “GetPlayerName” to get their online subsystem name.

I’ll add a “SetPlayerName” node as well just in case it is useful in the future but for online sub games it would probably be better to let the subsystem control their name changes (Like changing your name through steam). Obviously you can have the player pass in a custom name as well and store it as a replicated variable if there is such a thing as a character name in your game. Getting the UniqueNetId for a player controller and converting it to a string will get you their “network id”, or in the case of steam their 64bit steam id.

I also have a “GetNumNetworkPlayers” that you can use with a Blueprint For loop to loop through each currently connected player controller (using GetPlayerController and passing the integer) and do whatever with them. Personally for my test project I save a list of players and their stats seperate and update it on PostLogin (GameMode) and EventEndPlay (Player Controller).

In short though aside from getting the name from the subsystem for storing it and passing it to the other clients I would suggest you roll your own implementation by making a Struct of player data (score, kills, deaths, name, player controller reference, ect) and replicating it to clients. Getting everything into a single structure and fully controllable by you is probably the way to go.

As was already mentioned for the server name pass in a custom property to stand as your game name and retrieve it when finding the game on the clients end.

The example blueprint that ships with the plugin shows how to do a lot of the operations. Place it in your content folder and open it up in engine.

For linking to on the first page

Setting up the Advanced Game Instance and Player Controller Interfaces

The Game Instance

Start by creating a blueprint GameInstance class and setting it default for your game. Once that is complete go into the Class Options for it and Reparent it to the “Advanced Friends Game Instance” class.
This gives you access to the options and Event nodes that it provides.

These are the options that the Game Instance provides, it allows you to turn off calling the Accepted session and/or voice Events for player controllers and turning off receiving the voice events at all.

These are the events that become accessible in the Game Instance with the class reparented.

The Player Controller

Sometimes it might be preferable to access the events that the Game Instance provides directly in a player controller, if you wish to do so then add the Advanced Friends Interface to the interfaces available for the player controller class like is shown above.

Adding the interface gives you access to these new delegates in your player controller. You control whether they are called or not in the GameInstance, if it is set to call them it will search for player controllers that implement the interface and call the delegate on them if it is appropriate (For session invite accepted on the player that accepted the invite, and for talking state changed, on every player controller that implements the interface).

Yeah, I set that per the example blueprint. And in game, in the scorboard screen, it shows the name I pass as the server name. But when you go to find servers, it still uses the auto generated computer name plus random numbers … hmm.

Um, in the lobby display menu just pull the name you set from the search results instead of using epics “GetServerName” function. I intentionally don’t mess with their server name variable and leave it more open ended.

Quick explanation :smiley:

Advanced sessions.png

Makes sense.

Mordentral, can you add this fix to the 4.8 version please? I am sticking with 4.8.3 until they iron out a lot of the issues with 4.9 (as it seems many are).

What issues? I haven’t had any problems with 4.9. I’ll look into patching it, but pretty sure I’m participating in the game jam this weekend so don’t know when I’ll have time.

Check the forums, loads of people are finding bugs in 4.9, things that worked in 4.8.3 that are now broken. Many people are waiting for 4.9 to get updated with loads of fixes.

I’m stuck on 4.8.3 too because of the bug where the cooker ‘forgets’ about parent classes

Updated the 4.8.3 download to fix the update session function. The 4.8 version is still missing some not listed quality of life changes but it shouldn’t affect you using it.

I would suggest using the 4.9 version when it is stable for you though.

Thanks, much appreciated. Just started adding in some of the create session stuff, and am getting failure on create every time, I know it’s been a while since I fiddled with sessions, but I thought I had it all in place. I added the :

[OnlineSubsystem]
DefaultPlatformService=Null

to the proper ini file. And it is a totally BP project. Oh well, have to run off to work, will look at it later, probably something silly.

Thankyou very much for updating the 4.8.3 version, it means alot!