question

furkan-gencturk avatar image
furkan-gencturk asked

Leaderboard with many child leaderboards

Hi,

We are currently implementing a tournament system where groups of 20 people will compete against each other over the same statistic for once every 2 weeks. Considering our active number of players, we may have up to 3000 different groups.

When a user wants to join the tournament, they will automatically be added to the last group created with the <20 user count. If there is no such group, new one will be created.

e.g.

Group-1 20 users

…..

Group-410 users<- new users will be added this tournament group, until it is full

We did consider using Leaderboard feature of the Playfab; however, our tournament requirements seem not possible to implement with Leaderboard.

  • Current Leaderboard system does not support child leaderboards, for ~3000 groups with 20-users
  • There is a limit of total 300 leaderboards being active in the title

Leaderboardv2’s child leaderboard functionality seems very appropriate for our design, but it is in private preview; so, we cannot use it.

We thought about a workaround using with Groups and custom CloudScript functions in Playfab. The flow is described below:

  • Create a group with an our own admin user
  • Users calling custom “join_tournament” cloudscript function, will be added to this newly created group.
  • If number of users in this group, exceeds 20, new group will be created for upcoming users.
  • When users make progress in the tournament and call “update_score” custom cloudscript function, we will update “leaderboard” key in “Objects” in that group, which will form the leaderboard of that specific group.
  • Users will fetch leaderboard by calling a custom “get_leaderboard” cloudscript function. We will directly return the “leaderboard” key from Objects of that group, like so:

“leaderboard”: [

{“player_id:”AA”, “score”: 29},

{“player_id:”BB”, “score”: 30},

{“player_id:”CC”, “score”: 15},

]

However, we can’t decide between using our custom workaround for this feature or waiting for the Leaderboard v2 of the Playfab. Or can there be a way to use current Leaderboard system considering our requirements?

What would be the best practice?

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

·
Sarah Zhang avatar image
Sarah Zhang answered

As you said, we currently haven't officially released the features such as child leaderboards and group leaderboards yet. Please keep an eye on our blog – https://blog.playfab.com/blog for our latest updates. If you want to implement such child leaderboards feature today, we suggest you use an external data system, like Azure Redis cache -- https://azure.microsoft.com/en-us/services/cache/.

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

furkan-gencturk avatar image furkan-gencturk commented ·

What do yo think about our suggestion on using Groups and CloudScript to implement this feature? Would you suggest it?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang furkan-gencturk commented ·

Sorry for the omission. Could you please clarify that who will trigger the execution of the function “update_score”? If this action will be triggered by the operations from players, there will be a potential data contention issue in your workaround. And since the players will update their scores separately, the group objects may be overwritten by someone's wrong data. To prevent this kind of problem, you need to establish a complete locking mechanism. For example, only allow PlayerB to start the update after PlayerA finished the update. Your workaround should be feasible after you fixed this potential issue.

-1 Like -1 ·

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.