Download

Getting a player's Steam nickname from his UniqueNetId?

Hey,

I have Steam Subsystem set up properly. I’m using beacons to create a party before starting matchmaking. When a client is joining the party, I have access to his UniqueId. This is where I wanted to read the player’s nickname and store it in the server’s version of the client beacon. However for some reason I can’t find a way to do this. The Identity Interface has a function called GetPlayerNickname, but it didn’t work (it returned the party host’s name). The party is working fine, the unique id is valid, as I can open the player’s steam profile with it.

Does anyone know how can I get the player’s nickname from his unique id?

Thanks in advance!

Once you get the OnlineSubsystemSteam() < (OSS; Example) use it to point to the below code. One is using the LocalUserNum and the other uses FUniqueNetId.


OSS->GetIdentityInterface()->GetPlayerNickname(int32 LocalUserNum);
OSS->GetIdentityInterface()->GetPlayerNickname(const FUniqueNetId& UserId);


That should get your online steam name. If their code is finished. I would be curious to know which works, so i know which to use.

@gamepainters As I’ve said in the post, the Identity Interface’s GetPlayerNickname function didn’t work. I have to read a remote player’s name.This function only returns the local user’s nickname.

The Steamworks SDK has these functions in the IStreamFriends



// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;



// returns the current status of the specified user
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0;

// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
//
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;

The Steam OnlineSubsystem uses GetFriendPersonaName only in the leaderboard and friends interfaces. So maybe you can get it through FOnlineUser::GetRealName()/GetDisplayName() instead (although this may only work for players on the friendlist).

If using the Advanced Sessions Plugin is an option, the Version Log states this

@UnrealEverything Hey, thanks for the help! I’m gonna take a look at how the Advanced Steam Sessions plugin does it, but to be honest, I might just roll with a workaround. I’m thinking that I can just ClientRPC down to the clients, gather data locally, then sending the data back to the server via a ServerRPC.