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”.
You can only do that with Advanced sessions plugin.
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.
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 :
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!
For the MakeArray node, the output when using the ‘Make Literal Session Property …’ stuff is an Array of Session Property Key pair structures. I was trying to make a macro to clean up the BP’s a bit… I have what is below, but can not seem to find any key pair structure to set for the ‘outputs’ node so I can connect it. Is it possible?
Well no, that appears to have been an over site of mine, that keypair and one other struct were declared with USTRUCT() instead of USTRUCT(BlueprintType) so they are not directly accessible with blueprints.
I have changed them so that they are accessible on the 4.9 version and am uploading it. However the 4.8 won’t be updated until tomorrow (I download older versions and delete them after compiling for updates and I’m on the way out of the office).
I needed to re-upload 4.9 anyway for the 4.9.1 hotfix that just came out today.
Edit 4.9.1 version Uploaded
Nice, thanks, I will be trying 4.9.1 with my project to see how it goes as well, maybe they fixed most of the issues that came out in 4.9.
4.8.3 Version uploaded
Working like a champ.