Sign In Register

How can we help you today?

Start a new topic

Reset a leaderboard at custom intervals

Hello,


We would like to have a "league" system, that pits players against each others in small pools, and that resets every 48h (every 48h the best scores are looked at, rewards are given, then the scores are reset and people are put against different people).


We've got the whole system/architecture pretty much planned out in GameSparks, and we wanted to use the built-in Leaderboards (instead of using a runtimeCollection to create our own custom leaderboard), but the reset options are only Daily, Weekly and Monthly. 


What would be a simple, straightforward way to reset a leaderboard every 48h instead ?


Bonus question, We also want to schedule some code to be run every 48h for each player, is it possible ? I saw the scheduler, but it doesn't seem to be able to be looped ("every 48h" instead of "in 48h"), and the System events "every second"/"every hour"/"every day" aren't what we seek since we need "every two days".


Thanks !


Hi Uncanny,

 

[1]One way to reset Leaderboard's every 48hrs would be with a Trigger Leaderboard.

These can be specified to end through an Achievement or through the length of the Challenge time, so in your case a 48hr Challenge duration.

 

[2]For scheduling code to be run by every player, every 48hrs, could you elaborate a bit more on what you are trying to achieve ?

 

Regards

Ronan

[1] Thanks for this indication ! This seems to be exactly what we are looking for, so I will investigate this :)


[2] Here is the idea : every 48 hours, players are put in "leagues" of 20 players. For the next 48hours, they compete with the other 19 players of the league, and at the end of the league (so at the end of the 48h cycle), rewards are given to the players according to how they ranked compared to the other players in the league.


For the GameSparks implementation, here is what I was planning :

- Players have their scores sent to a global, worldwide leaderboard.

- Every 48h , the league resets (scores are looked at, rewards are given and leagues are re-created with new competitors) which means :

    - The leaderboard scores are analyzed for each league (we know the player ID of all the players in a specific league, so we can easily fetch their score in the leaderboard)

    - The rewards are sent to the players (we send a message to every player who took part in a league, which contains information about his reward/rank/his opponents scores, which we then manage in our codebase)

    - The leaderboard is totally reset/wiped (so maybe we would need to do that inside of the CloudCode, instead of usin ga Trigger Leaderboard ? Since we need to perform specific operations right before resetting the leaderboard)


So we need a way to run a specific piece of Cloud code every 48 hours. We don't need to run it for each player, we need to run it once. It will browse all our players, see which ones of them took part in a league, then perform operations, send messages, etc. Then, it will wipe our leaderboard. For the leaderboard wipe, I imagine using leaderboard.drop would work, right ? The big problem/question is, how to run this specific Event/Cloud code only once every 48 hours exactly (like, every two days at noon for example).

Okay I ended up going for the scheduler for that. I use it in a recursive way, when the scheduler is activated, it starts a module that, at the end, schedules the execution again in 48 hours. This way it gets executed every 48h (and I prepared two events to emergency interrupt and start the scheduler, in case there's an issue, so we still have control on this recursively happening scheduling).


This seems to do the trick, I don't know if it's the lightest or simplest way (it seems pretty light in overhead, and the code is very straightforward) but it works !

Login to post a comment