question

analytics avatar image
analytics asked

Random Unique Displayname

Hello,

I'm trying to switch my game to PlayFab, but I'm stuck on one functionality that we'll need.

I want to generate a unique string ID different than the user's PlayFabId and set it as DisplayName. People later will share this ID for friend invitation purposes.

The conditions for the ID in short:

1. It should be unique

2. It should not be editable via client

3. Friend invitation should work with the field that I use.

4. If possible, I don't want to use any external services for this.

My current logic would be as follows -but it fails due to API limitation-:

1. Client -> Server: User registration with custom id.

2. Server -> Client: Success, return playfab id.

3. Client -> Server: Call cloud script to generate display name.

The implementation is generate id, try to set it as display name, if fails due to name already in use, retry again.

But It fails in 3rd step because "Server" scripts does not have access to "UpdateUserTitleDisplayName" function.

So my question is, is there any other way that I'm missing to implement this functionality? And are there any plans to bring "UpdateUserTitleDisplayName" to Server APIs?

Thanks.

apisCloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

What are your requirements around your display name that make it not possible to simply use the PlayFab ID, exactly? What is the structure of the display name you want to use? My concern is the part of your logic which states that you re-try with another name on failure. If you were to have a surge of 10x or 100x the number of users you expect, would your random generation still provide for sufficient unique names to ensure that collisions would be the rare exception? What steps would you be taking to ensure that you don't wind up re-trying 5, 10, or 100 times?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

analytics avatar image analytics commented ·

Hi Brendan,

For the initial version, we'll use 8 digit alpha-numeric display names, formatted as such: 12-34-56-78. In case of potential user surge, we can increase the number of digits and add them to the end in the same format.

As for PlayFab id, we can use that but a short invitation id is more inline with our user perception analysis.

As for the retry logic, we'll retry -reasonable number of (2, 3 maybe)- times in the script to find a non-collision and if it fails we'll return error. It'll then be client's responsibility to call the same script again. (e.g in 30 minute periods etc.)

Thanks.

0 Likes 0 ·
brendan avatar image brendan analytics commented ·

Thanks - as long as the title is taking the precautions to ensure the retries are minimal, I can't see this being an issue. I'll add a backlog item to add the UpdateUserTitleDisplayName call to the Server API, but please be aware that it could be some time before this gets prioritized (we prioritize in part based upon the number of developers asking for a given feature), so in the short-term, I'd still have to recommend using the PlayFab ID.

0 Likes 0 ·
analytics avatar image analytics brendan commented ·

Thanks a lot!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.