question

narendrag avatar image
narendrag asked

How to manage daily, weekly, monthly , All time leader board for single statistic?

I want to get weekly,monthly and all time leader board for single statistic value i.e. Win. So give me proper solution for same.

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

·
brendan avatar image
brendan answered

A statistic is a single value for each player, which can be reset on a regular basis (daily, weekly, etc.). What you need is one leaderboard that resets daily, another which resets weekly, another which resets monthly, and another which does not reset. To create these four statistics, you can use the Game Manager to create these, or Admin/CreatePlayerStatisticDefinition (though for the one that doesn't reset, you can just start reporting it - by default, stats don't have a reset period).

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

narendrag avatar image narendrag commented ·

Ok. You mean that I need to create separate leader boards for daily_win, weekly_win, monthly_win and all time win , Right?

0 Likes 0 ·
brendan avatar image brendan narendrag commented ·

Correct - those would be four different tracked statistics, so they would require separate leaderboards.

0 Likes 0 ·
narendrag avatar image narendrag brendan commented ·

I have set four different statistics for managing daily, weekly , monthly and all time leader board.

Now I am updating the values of that statistics using the custom API written in cloud script. ex. daily_wins is a statistic with Reset frequency=daily and Aggregation method=sum. When I am trying to update using the server API UpdateUserStatistics using cloud script then Aggregation method is not applying on same.

What is the problem? Please let me know ASAP.

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

Yes. I have set the statistics Aggregation method to Sum but still I am not getting desired result.

When I am checking it with client method UpdatePlayerStatistics then it's working fine but using server method though the cloud script it is not updating.

0 Likes 0 ·
brendan avatar image brendan narendrag commented ·

Your Cloud Script is using UpdateUserStatistics, which has been deprecated and is not compatible with the newer statistic aggregation settings. Please update to use UpdatePlayerStatistics. Once you have done so, the aggregation will work as expected.

0 Likes 0 ·
narendrag avatar image narendrag brendan commented ·

Thank you Brendan. Now statistics are updating correctly.

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.