question

nicloay avatar image
nicloay asked

How to get unique id on the clinet (WebGL)

On webgl, I don't think it's a good idea to unse RNG to generate pseudo random id. So the questions is maybe there is some built in api which generate unique id which i can use then as the login with custom id.

Or for this think I need to write a custom script?

Thanks.

Authentication
10 |1200

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

brendan avatar image
brendan answered

If your requirement is for a guaranteed unique ID, you would either need to use an ID available on the local device (like the Android or iOS Device ID), or else use a service like Redis to maintain a running count. Otherwise, we'd recommend using a generated GUID or similar. While it's not guaranteed to be unique, the odds of two players generating the same ID are so unlikely as to not be worth worrying about (https://stackoverflow.com/questions/4878359/what-is-the-probability-of-guessing-matching-a-guid).

2 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.

nicloay avatar image nicloay commented ·

Sorry. But I can't find easy way to generate GUID on device. At the game engine i need to setup seed for RNG, and i don't have to much random data like time, cpu, etc.

So just to confirm. there is no any existing api to create playfab user without UniqueID, username and password?

0 Likes 0 ·
brendan avatar image brendan nicloay commented ·

GUID creation uses simple random number generation. No modern system used for games would generate the same sequence of random numbers from the start of your app, so you can safely use any standard GUID generation code - there are a number of examples available, depending on the language you use.

The Unique ID we generate for the player is specifically the PlayFab ID, which is indeed guaranteed to be unique. But that's generated as part of creating the player account. What you want is a way to get a guaranteed unique identifier before creating the player account. And no, we do not provide an API that would do that.

0 Likes 0 ·
Tuomas Karmakallio avatar image
Tuomas Karmakallio answered
10 |1200

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

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.