Leaderboards are a way of keeping relative ranking of the users based on some "score" i.e. some numeric attribute that can be sorted. Whenever this attribute is updated, the position of the user in the leaderboard is also updated.
Please note that this "score" is not the same as the scores submitted in challenges in Playblazer.
However, the score submitted can also be one of the parameter on which a leaderboard is defined.
One of the main objectives of the Playblazer platform is to keep things simple for the game developers, so that they need not worry about the backend and focus solely on the core logic of their game. For example, in any game, the core loop* of the game is where the maximum attention needs to be for it to be more engaging and fun. The game developer shouldn't have to worry about maintaining the state of other non-core things - like leaderboards.
In Playblazer, that's how things work - the game developer only makes API calls to update the session state/scores and profile score (if computed in the game) and the Playblazer platform automatically updates the relevant leaderboards that are pre-defined based on these parameters.
Following attributes already have leaderboards defined on them:
- Played (total challenges played)
- Wins (total challenges won)
- Ratio (win/loss ratio)
- Level (proficiency level of the user)
- RP (the rp attribute from profile scores)
- HP (the hp attribute from profile scores)
- XP (the xp attribute from profile scores)
Each of these leaderboards are defined for each game - i.e. each game deployed on Playblazer gets a dedicated set of leaderboards. Whenever these attributes get updated - either when the game calls the "Update Profile Scores" API, or when they are updated automatically as part of the challenge flow; the leaderboard updates are triggered.
Please note that the only scoring attributes that can be updated via the "Update Profile Scores" API are Level, RP, HP and XP. The other attributes (Played, Wins and Win/Loss ratio) cannot be set by the game; they are only computed based on the actual challenges.
* The Importance of Core Game Loops