Usernames and Leaderboards

I am a little confused about the meaning of “id” versus “Username” versus “display_name” and how it all relates to what we see on Leaderboard results.

I had thought that display_name would be the name the player wants displayed that is not their unique user ID (since that may be less human-readable). But it looks like leaderboard results only give you the user ID and the Username.

So my specific questions are:

  1. What is the intended distinction between Username and display_name?

  2. Does Username HAVE to be unique as the docs imply? I’m asking this because my approach is to have a zero-friction experience for players, and that means not having to setup a profile or anything. So what I would like to do is just take, for example, the user’s Steam or Oculus display name and make that what shows up in leaderboards. Since I’m supporting players across multiple platforms, there could be duplicate display names, but I’m not terribly worried about that since it’s just leaderboards, and I’ll be displaying the platform the user is on as well, which distinguishes between users of the same name on different platforms.

@Punchey I can help explain these fields on the user object:

  • ID - The user ID is a UUIDv4 type which uniquely references the user across all operations.
  • Username - The username is also unique to the user and memorable for players to find each other within the game. You can set the username when the account is created or via an update to the user object.
  • Display Name - These are non-unique names that can be used to allow players to use the same popular names like “GoldLeader” in various gameplay features but not collide when referencing the players inside server operations. It’s just for display purposes only.

What is the intended distinction between Username and display_name?

Use the username field when you want to reference the user in operations or your game allows for the username of each player to be unique. The display name can be used wherever you want to allow more than one player to use the same name while in the gameplay online together. You might rotate between colours to still allow them to be visibly different for each of the players but how and if you visually differentiate is up to your game design.

Does Username HAVE to be unique as the docs imply?

Yes. The uniqueness of the username field is enforced at the database level. You can always make your usernames use a composite key structure and just use the suffix as the display in your UI. For example on players from the Steam network use “steam_<uid>_<username>” and just display the “<username>” portion in the game client.

Alternatively you could also write the Steam network display name to the leaderboard record metadata when you write the score and just use that in your visual display.

Thank you for the clarification! That helps a lot.

1 Like