question

Josh Winter avatar image
Josh Winter asked

Shared Group Data or Leaderboard

Hello,

I'm new to PlayFab and I'm trying to see if it's going to fit our needs. Our game has weekly leaderboards in groups of 40 players. Each week the player moves up or down a leaderboard (or tier) depending on their ranking from the previous week. 

If there are enough players, it's conceivable that their could be many leaderboards of 1 tier, so the game could have hundreds of 40 player leaderboards which would need to get reset (or possibly deleted and created) each week.

What would be our best course of actions for this? Should I be looking at the leaderboards api? Or should I be diving in to the Shared Group Data to learn how to create groups, then add/remove players from a group?

Thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

The way leaderboards work in PlayFab is that you report on statistics for players, and those statistics are used to generate the leaderboards. All players are reflected in the leaderboards, though you can query for just friends. If you want to do a leaderboard-like system where you have only 40 (non-friends) per leaderboard, then yes, I would recommend having a look at Shared Group Data. But I wouldn't add players to it - adding players gives them read/write capability, so a hacked client could write whatever it wanted to. Instead, I would suggest writing to it from Cloud Script, so that you can do validation checks on the scores reported.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Josh Winter avatar image
Josh Winter answered

Thanks! I'll look into Shared Group Data and write some tests today and see how it goes. I'm excited to dive into this.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Josh Winter avatar image
Josh Winter answered

Hello,

I've been looking through the docs and I watched the webinars on cloud script. It seems like it might be tricky to do what I need without resorting to an external server which could get messy.

I'm trying to formulate a plan on how this could work. From my understanding cloud scripts are run only by an individual user - it could be during login or any other time they are playing the game. So any logic on Shared Group Data would have to happen then. Is this correct? 

My sequence for awarding a player a prize based on their tier position and putting them into a new Shared Group Data tiered leaderboard for the next week could be something like this:

1. If contest is over -> read last position on tiered leaderboard -> reward prize
2. Remove them from the current tier leaderboard
3. Determine which tier to put them in next
4. Update or Create new tiered leaderboard based on a method which would be designed to figure out which tiered leaderboards have space in them (i.e. 25/40 spots taken in leaderboard: TierGold_Group7). If no space, create a new one. 
5. Put user in correct tiered leaderboard and let them play.

Is the above more or less how it could be done with PlayFab? Is there any other way this could be done? My key problem with 1--5 is that if a user is being placed in a group that has only 5 of 40 spots taken, its going to look empty until it starts filling up. Also, if a group never fully fills up with players, I'm not able to add to the last group with bots (to equal 40) or come up with an alternate plan. It would be much better if I could assign each player to a fixed group when the leaderboard tiers all reset on Sunday night. Then I can get the groups all filled up with 40 players exactly. Is this possible?


Thanks for your help!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

So to restate your design, you want to bucketize players into groups of 40, create a distinct leaderboard for each of those groups, doing this once a week across all players - is that correct?

The first problem you'll run into, trying to drive this from client-centric logic, is that for any large player base you won't have an effective way to get exactly 40 players into each group. The logic would have people joining the same group at the same time, either overwriting each others' "slot", or simply adding too many people to groups.

We do plan to provide an asynchronous matchmaker in future, but for right now, you need to have a matchmaker of sorts, controlling which players are put into which groups, in order to manage this. This could be a simple web service which processes a queue of requests coming from players. So, when a player signs in, if the last prize period has elapsed, it would send a "place me in a new group" message to the web service, which would find one at the right tier with available space and put the player in it.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Josh Winter avatar image
Josh Winter answered

Thanks Brendan. Since I wrote my note I was thinking similar. I would need a web service to help manage the groups effectively since my needs are pretty specific. I've been looking through the docs and viewing the webinars all day today and it looks like a fantastic service. I can fill in this gap that I have on a cloud server somewhere and use PlayFab for the rest.

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.