question

funghonwai avatar image
funghonwai asked

How is the proper way to how additional user data in leaderboard?

In my project each player is assigned a clan/team, I want to show the team name when showing leaderboards. Apparently the most straight forward way is store this as user data.

However it implies every leaderboard entry requires an additional API call of GetUserData, would it triggers API calls limit and be throttled and thus break the logic?

Player DataLeaderboards and StatisticsCharacter Data
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

We are working on an update for the leaderboards system which we hope to make available later this quarter. One thing that update is specifically designed to do is to allow you to store arbitrary data for each entry in the leaderboard.

Making distinct calls to get data for each entry in a leaderboard is not viable, as it would generate an excessive number of calls per client. That, in turn, could result in the title being throttled, which would impact the gameplay experience.

What we would recommend for now is to only request extra data on entries that the player clicks through to see more information on (similar to the "gamercard" systems in consoles).

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

zomb avatar image zomb commented ·

I have made special cloudscrip function, which I call instead of Leaderboard request. It calls leaderboard internally and iterate all returned users. For each calls it profile and adds nesessery data to responce. So, only 1 call returns all data. But i don't test it for filled leaderboard yet

0 Likes 0 ·
brendan avatar image brendan zomb commented ·

Again - iterating across the list of players in a leaderboard to take an action on all of them (like query their data) is not going to work. It would result in generating an excessive number of calls, in violation of our terms of service, and would result in getting your title throttled or possibly blocked. We are going to be making extra data per leaderboard entry available in the service later this quarter. For now, the best thing to do would be to only query for extra data per entry if the player actively clicks to view more information about an individual player from the leaderboard.

0 Likes 0 ·
zomb avatar image zomb brendan commented ·

But it is internal calls inside server. Do you want to say, what requests from cloudscript is restricted? We already have limit in 5 seconds for "CloudScript execution time". I thought, what my script can do anything while it is completing in 5 seconds. I thought about iterating pages with about 10-20 players. Now it takes 0.2s for 3 players.

0 Likes 0 ·
Show more comments
zomb avatar image zomb commented ·

Can you determine, what exactly is "excessive number" of requests is, please? If this is not restricted for execution time, how it is restricted? And if I can't use many API calls, what script can do for hit that 5 second limit at all?

0 Likes 0 ·
brendan avatar image brendan zomb commented ·

In general, for Cloud Script, I would recommend no more than 1-2 Server API calls per second of execution time, to be safe. So, using your example above, if your goal was to show a leaderboard, and have just the extra info for the top player, or top 3 players, that wouldn't be a problem.

0 Likes 0 ·
zomb avatar image zomb brendan commented ·

No, my goal is far from top3. I'm building clan system and using leaderboard as clan leaderboard/list. So I put special statistic to clanleader, made leaderboard from clanleaders, and when requested clan list, I take leaderboard->userId->user_data->groupId->group_data for all users on page. In another function I have operation with clan and I need to get data of all (10) group members. If now you tell, what I can use only 3 servercalls per request - it's catastrophic.

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.