question

bitemeads avatar image
bitemeads asked

How to get random playfabid,getting random player id (other player)

hey there,

i was wondering how to get a random playfab id from playfab. Playfab only returning values that exist to then let other players see other players their playerdata.

thanks in advacne

,

hey there,

i was wondering how i can get a random playfabid from playfab. (For getting player data of other users).

i am using the unity SDK

thanks in advance

Player Dataunity3d
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

Can you please describe the actual game feature you're attempting to create? There is no "give me a random player from the game API", but if you're looking to do something like random challenges, we'd recommend using the Leaderboards (get the set of players around the current player's score, and pick one of them at random).

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.

bitemeads avatar image bitemeads commented ·

i thought the same and have done it indeed with a leaderboard after reading the docs, getting score around player based on their ranking. Thanks for the reply anyway :) was indeed for like random challenges

0 Likes 0 ·
plosnita avatar image plosnita commented ·

Hi,

My understanding is that player data is kept in dynamoDB so random access is not straight forward, but not impossible. It all depends on how player keys are designed

One strategy would be to have consecutive keys from a starting key. If that were the case, a random player access would be implemented as a random number between 0 and the number of players added to the starting key.
A limitation would be that this works only for all players of a title. No ideea how it would work for segments.

What are your thoughts @Brendan?

I would like to create a segment of "active" players, for example and then choose one at random.
Is this still impossible?

0 Likes 0 ·
brendan avatar image brendan plosnita commented ·

Specifically, it depends upon what we've implemented and exposed. But a sequential number for players is not an option, as that's not how players are tracked (and what's more, it would cause an intolerable bottleneck to player creation, since you'd have to lock that value when you increment it, since each instance has to be assigned to a single player). A newly launched, highly anticipated title is going to have an extremely high level of player creation.

I would still recommend using the leaderboards for this. If you use a weekly or monthly resetting leaderboard, that would automatically remove non-active players.

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.