Creating a leaderboard definition for versioning
In the previous example, when creating a leaderboard definition, there was a hint about the importance of theVersionConfiguration
parameter for versioning. Here, we detail how to use it and how it works.
VersionConfiguration parameter. This parameter allows us to define a
MaxQueryableVersions setting, which specifies how many versions of the same leaderboard we can query. In this case, we set it to query 12 versions,
which allows to query the 12 more recent leaderboards. The ResetInterval parameter defines how often the reset process occurs. This action involves
creating a leaderboard with the same configuration as before but empty, and the version parameter changes as follows: N = N + 1, with N = 0 at the
creation of the leaderboard definition.
For example, let’s say we have a leaderboard with the version parameter equal to two with a hundred entries on the leaderboard. Now,
when we increase the version of that leaderboard, the result is going to be a new leaderboard with the version parameter equals to three and empty.
Meanwhile the previous leaderboard remains in the system to be query.
The ResetInterval can work in multiple ways. In this example, it’s monthly, but it can be changed according to the developer’s needs. In this particular
case, it means that the leaderboard is going to be reset automatically every month from the moment it was configured. We support the following reset strategies:
- Day
- Hour
- Manual
- Month
- Week
Incrementing the version of a leaderboard
With this new configuration, we can have multiple versions of the same leaderboard for the tournament mode. But what happens if we need to manually reset the leaderboard due to an issue and start over the tournament? In such cases, we can perform a manual reset using the API. Here’s an example using the SDK:Querying for older versions
Now if we need to query for an older version of a leaderboard, we can use theversion parameter available on all the GetLeaderboards APIs.
Here’s an example using the SDK:
Conclusions
In this tutorial, we learned how to do the following operations:- Create a leaderboard with right reset strategy.
- Increment the version of a leaderboard.
- Query for older versions of a leaderboard.
