question

mohamedsamer avatar image
mohamedsamer asked

how to get the top 20% of all the players based on coins count

Hello, I'm new to Playfab, and the documentation got me really confused.
I'm creating a weekly challenge for all the players, I want to promote the top 20% of the players to the next challenge based on the collected coins during the week, What is the best way to achieve this?

I've tried to get the players list using GetPlayersInSegment to perform the needed logic via a cloud script, but it can only retrieve a limited number of players. I've been also missing around with Leaderboards, I didn't find enough options to create a custom Leaderboard, and I didn't find a clear tutorial or piece of documentation to achieve what I'm looking for.

Thanks in advance.

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

Sorry, but we do not provide a way to get a certain percentage of all players based on a value (statistic, VC balance, etc.) at this time. You could get the players based upon having a certain statistic set greater than a specific value, but if what you need is to get a percentage, I'd have to recommend adding a Feature Request, describing the details of your gameplay feature, so that others can "like" it, and so help with prioritization.

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.

mohamedsamer avatar image mohamedsamer commented ·

Thank you so much for the quick answer, adding a new feature is a great suggestion but, as far as I guess, it might be a slow process (if it got accepted at the end of course) .

So I want to think of a way around this manually at least at this time to be implemented quickly.

If I was able to retrieve all my players list once in a week I can add my own logic easily,

I have seen couple of answers already to retrieve the full players list, but they were not really clear at least for me, and might be outdated as well.

So, Do you think it's applicable to be done that way? and What is the best way to get around this in your opinion?

0 Likes 0 ·
brendan avatar image brendan mohamedsamer commented ·

No, I can't recommend that. If your game takes off, your player base could be millions of players. What I would recommend is writing scores for players out to a Redis instance in addition, so that you can do the work there to get the list of players in the top 20%.

1 Like 1 ·
mohamedsamer avatar image mohamedsamer brendan commented ·

That seems interesting, but I'm still stuck at the same point, how can get my full players list to pass it anywhere to do the calculations?

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.