question

kglassey avatar image
kglassey asked

Get Leader Board Request - StartPosition out of range error, how to avoid?

hi

I'm requesting the leaderboard ok, but I have a leaderboard larger than 100 so must request multiple times, any ideas how to set the start position, I had thought it would be as simple as increasing a startpostion int until I reach the end since there seems to be no way of knowing how big a leaderboard is.

thanks

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

Iteratively calling the leaderboard to collect every player's score isn't a supported scenario as it would generate excessive calls (you could have millions of players, potentially). What is the specific gameplay feature you're trying to create?

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

kglassey avatar image kglassey commented ·

I would like to sum the players score and share that stat across all players.

Currently I have a server looping through leaderboards 100 at a time, I'm now incrementing the start position by the last count in the leaderboard until the leaderboard count returns zero. My server then updates title data every 1-2 per 24hrs. would this be acceptable in relation to calls?

thanks

0 Likes 0 ·
brendan avatar image brendan ♦♦ kglassey commented ·

As long as the server is waiting on each response before querying for the next block, and it's infrequent (once or twice a day in your example), it would be fine. But that said, you'd get better results by forwarding all statistic updates for players to something like a Redis cache. That would allow you to have the total in real time, rather than only on your updates, and ensure that it's high accuracy.

0 Likes 0 ·
kglassey avatar image kglassey brendan ♦♦ commented ·

thanks for that - I will look into Redis more, I did consider it at first but there is limited info on how to use it with unity. with regard to forwarding stat updates to Redis, is this something that happens in cloud script or on client?

0 Likes 0 ·
Show more comments

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.