question

Vsevolod Metelskyi avatar image
Vsevolod Metelskyi asked

How can I get prize table for a leaderboard?

So I need to create a leaderboard that would work just as anyone would expect: gather players scores, reset at some point and give players rewards based on their positions. But so far I have not found an API that would let me get a list of prizes to show them in the game. So I am not sure it's possible at the moment.

Since showing the rewards and tiers to players is critically important, I started looking for another way of implementing prizes for a leaderboard. I have come up with a solution to write a Scheduled Task that would reset my leaderboard at some time and then run a cloudscript that would 1) reset the leaderboard and 2) iterate through all the players in the "All players" segment and give them currency and inventory items from some custom JSON file I will store in some key of the Content tab.

The downside of this approach is that I will have to write custom code to implement push notifications and other actions that are possible in case of using the Leaderboard prize tables. And that I will have to iterate over all the players and send a request for each of them to get their position on the leaderboard. And if there are a lot of players I fear it is possible that the execution of a function like this will take more time than allowed.

Despite this I wanted to try out this approach, but I couldn't, because the IncrementPlayerStatisticVersion method can not be called from the CloudScript and I simply can not reset the leaderboard.

Maybe I am missing something. Please give me an advice on how should I solve my issue.

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

Seth Du avatar image
Seth Du answered

I do not quite understand your requirement, why do you need to retrieve the Prize Table for granting? Is it because you are considering granting for players whose rank is over 1000?(the Prize table only supports 1-999 rank for now)

If you have configured the Prize Table for a Leaderboard, every time you reset this leaderboard, you may notice the events in the PlayStream Monitor that there are player events like “Player ranked on leaderboard version”, then if this player is qualified for some reward, the following events will be item granting. The whole process is automatic and you do not have to iteratively granting items for all players.

The Prize Table do have limitation right now and it is by design, and your solution is feasible but needs lots of coding work. If there are too many players, you can close the game server for some time for maintenance.

For now, there is no API for retrieving prize table information hence you may hard code this part. Sending a thread on Feature Requests Forum or voting an existing request will be appreciated.

In terms of IncrementPlayerStatisticVersion, the current work around solution is to implement a local tool or use an external secure server for game management. There will be huge updates on our Cloud Script feature though I cannot tell the specific time, you may keep track of the updates on Blog website.

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.

Vsevolod Metelskyi avatar image Vsevolod Metelskyi commented ·

I need to download Prize Table to show rewards on the "Rewards" tab of my PvP section, so the players know what are they fighting for. I need only data for visual representation but since I can not get it, I am trying to find another way.

Could you give more info about the "implement a local tool or use an external secure server for game management" part? Is there any guidelines, examples etc?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Vsevolod Metelskyi commented ·

I believe you have to manually input and store Prize Table data somewhere else, for example in Title Data for later retrieval since there is no way to dump the Prize Table in the Game Manager.

In terms of IncrementPlayerStatisticVersion, since it is Admin API, you cannot use it in Cloud Script, and if you are looking for resetting leaderboard programmatically, you need to write a tool such as C# winform app, which is implemented with PlayFab SDK, to execute Admin APIs.

0 Likes 0 ·
Vsevolod Metelskyi avatar image
Vsevolod Metelskyi answered

@SethDu

I need to get prize tables not to grant rewards but to show them inside the game.

I have a "Rewards" tab where a player is supposed to see which rewards he will get for which range of leaderboard positions.

Like:

1-7 position: 10 gold,

8-12 position: 2 gold.

Could you be please give more info about the "implement a local tool or use an external secure server for game management" part? Where should I look to get more info regarding this matter? Is there any examples you could provide to help me get started.

10 |1200

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

Vsevolod Metelskyi avatar image
Vsevolod Metelskyi answered

Ok, since my message was deleted by someone I will write it again.

I need Prize Table in order to show rewards to players. I don't need it for rewarding.

I have a tab "Rewards" where a player can see, that if he will take position from x to y on the leaderboard, he will get a, b and c as a reward, if from x2 to y2, he will get d and f etc. And in order to show rewards I must be able to get the Prize Table data from PlayFab.

Could you give more info about the "implement a local tool or use an external secure server for game management." part? Is there any examples, guildelines?

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

Yaser avatar image Yaser commented ·

I need this feature as well, reading the Prize Table info, just retrieving it to show the players what prizes they will get.

Currently, it looks like the only way to do this is to store the data locally (or somewhere external) and show it to the players.

But supporting it directly on PlayFab would be immensely helpful.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Yaser commented ·

I believe you are correct, there is no API to retrieve Prize Table information. A work around solution is to store it in the Title Data since it won't change frequently.

Please feel free to send a thread on the Feature Requests Forum and more votes can help the priority.

0 Likes 0 ·
rudolfjvvuuren avatar image rudolfjvvuuren Seth Du ♦ commented ·

Hi, how would you go about "storing the leaderboard rank" in the player title data?

0 Likes 0 ·

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.