question

giorgiotino avatar image
giorgiotino asked

Best way to store and notify players about Leaderboard results and rewards

Good morning,

I have read all te docs regarding Leaderboards and tried all the tutorials and whatnot. Everything works fine and I do know how to setup Leaderboards, reset them, use Prize Tables to reward the players.

BUT

Let's say that a Player takes part to a weekly event, and ranks high enough to win a prize. Such player for some reason stops playing the day before the weekly leaderboard ends, and then logs in again a couple of weeks (and leaderboard versions) later.

What is the best way to let them know that two weeks ago they ranked well in the now rchived leaderboard and that they won a specific price (e.g. a container that has been downloaded for them as part of their inventory)? I want to show a popup that says: "Congratulations! In the {LEADERBOARD_ID} you ranked {RANK} thus you got a {ITEM_ID}".

Right now the player would have the ITEM_ID in their inventory, but the connection between the leaderboard and the item is missing.

Storing leaderboards data in the item's payload would require a new set of items for each leaderboard, which is probably not what we want to do, especially on a weekly basis - most of the prizes would be "re-used" week after week and we would have to duplicate them just to set a different payload...

Or we would store leaderboard rewards info in the player objects: resetting the leaderboard will trigger a cloudscript that for each player would add the reward and leaderboard details in a list, and the player would get that list at startup (we already have other objects so it would be perfect). This way they would know which of their inventory item instances belong to which leaderboard as reward, and we would call another cloudscript to redeem such reward. The cloudscript will in turn unlock the container and remove that reward from the player's list.

BUT MAYBE

there is a better approach, or a built-in way or a suggested flow that PlayFab considers better to handle this scenario?

Any ideas?


Thanks in advance!

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.

Citrus Yan avatar image
Citrus Yan answered

There is no built-in way for your scenario from PlayFab’s perspective. Using player objects is a good idea for handling this, and, in addition, I think you can also send notifications to players who rank well on a weekly reset as well, that helps engaging with your players more closely and keeping them coming back for more.

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.

giorgiotino avatar image giorgiotino commented ·

Thanks,

I was wondering: is there any way to pass Leaderboard data and results specific to each rewarded player as JSON parameters to the cloudscript that gets triggered by resetting the Leaderboard? I am setting that JSON manually but I wonder if there's a way to access stuff like Leaderboard Name, version, player rank automatically.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan giorgiotino commented ·

Sure, when a CloudScript is triggered, you can access its triggering Playstream event data through the "context" parameter, more details, please see:

https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/writing-custom-cloudscript#intermediate-overview-globals-and-advanced-arguments

context: Second parameter to a handler function. Additional information about the request when it is triggered by a PlayStream event action, including the data from the event that triggered the action (context.playStreamEvent) and the profile data for the player associated with it. (context.playerProfile)

0 Likes 0 ·
Good Guy avatar image
Good Guy answered

How come no one has brought up "Containers" as a solution?

My theoretical solution:
Define the Prize rewards table to issue consumable Containers (with no key). When you load up a player's inventory, you can find the Containers and display them in the appropriate place in the game, and give the player the ability to "open" them. Upon opening them with the unlock API, the response should contain lists of the items received.

Would this work?

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.