Set Multiplayer Name

Been working at this for two days and at my wits end, how can you set a unique player name in multiplayer sessions?

This is all built off of the shooter example, as well as the networking tutorials on youtube etc.

I’ve got a menu set up with two options, host and join. If the player clicks host, it starts a session and loads a map.
If they click join, it finds the session (if one is hosted) and joins it. The server player and client player(s) both appear in the correct session/map together.

I’ve been trying to identify the unique players by either their player name or id from the player state, which is sent to a text render widget on the player character above their head.

There has to be a way to do this correctly, I just can’t work it out no matter how much searching or reading I’ve done. How could you uniquely identify the server and clients with a name? I’d like to eventually have it so that they could enter the text on either the host or join menu and use that for their name. But a generated one from player state or whatever is fine for now!

Any help is appreciated =)

This is what I do to set names:

Thank you Jamendxman3, using that info I’ve managed to get a unique name happening for the server and client(s). But it’s still pulled from the player state.

What if I wanted to say, set the name to ‘server’ when a player clicks host and ‘client’ when they click join? I’ve tried storing in a variable inside a custom player state, but returns nothing when the player creates or joins a session. It seems like maybe the player state is cleared when the player transitions a level or something perhaps?

Sorry, but I don’t know anything about the player state :\

I’ve only started delving into them while mucking about learning the networking basics. It just seems like a really tricky thing to accomplish!

I suggest: 1) https://www.youtube.com/watch?v=_JCBNHfvUA4
2)https://www.youtube.com/watch?v=kdTeUAqjQUg

Thank you very much 8shadow8, looks like exactly what I’ve been trying to work out after having a flick through it. I’ll watch the whole thing and see if it helps me get a handle on it =)

Update
Those tutorial stream videos were exactly what I was after! There was an issue in the second video though with the clients not getting the server name when they join the game though, I solved it by adding in a delay to the ThirdPersonGameMode blueprint. Put a screenshot here in case anyone else has this issue: http://i.imgur.com/opIZWnt.jpg

I have no idea why adding the delay works, but it does. Can anyone offer an insight onto why??

maybe something has to load before and without delay did not have time!

I constantly have to add delays to things I do when working in multiplayer, the reason for this is that a client player will be trying to do something based on something that hasn’t loaded yet, such as cast to the game instance which according to the client does not yet exist, adding a delay gives it time to initialize everything.

Ah that makes sense, interesting little quirk :slight_smile: Thanks for the replies 8shadow8 and Jamendxman3, very helpful!

Using delays for this kind of thing is not really good programming standard. Sure it will work for you 90% of the time but when you are running things on actual servers that 90% may drop down to 50% for people with poor internet connection. What you want to do is use timeouts and callbacks to make sure that something has happened on the server before allowing the user to perform another action. It could be as simple as setting a bool on the server to send to the client.

“This Video is Private.” :frowning:

please add the solution this youtube videos are pravite