question

taylankay avatar image
taylankay asked

Finding users with a certain statistic value

Is it possible to find all users who have recorded statistics between a certain range of values? As a use case, I want to present multiplayer matches to a user with different difficulty levels. One match would be a user whose level is less than that of the current user, one match would be equal to the current user, and one match would be higher than the current user.

I understand GetLeaderboardAroundUser is supposed to be like that, but imagine you have only 20 player levels in the game and millions of users. If GetLeaderboardAroundUser returns results with a simple sort, I'd guess there is a very high likelihood that all returned matches would have levels equal to the current user in that case.

Is there a way around this? Am I missing something obvious?

Leaderboards and Statistics
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

No, you're not missing anything. Lookups of leaderboards are based on a player or a position. Since it's not possible to have the score be a primary index (since, as you say, many players could have the same score), you would need to do this by tracking the scores reported and using some custom logic to determine which one of all the players with score N you want to use in getting the leaderboard. The best way to go about this would be to use the PlayStream webhook service to stream info on all statistic reports to your own server, so that you can make that calculation (either that, or use an analytics service - one in the add-ons marketplace, or your own via the Event Archive).

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.