Support leaderboard "scopes"
Opened this issue · 2 comments
Context
Sometimes in games, scoring systems can involve muiltiple leaderboards, where scores are:
- Grouped by resource
- speed to finish a level
- wealth at the end
- ...
- Grouped by context
- levels
- a different leaderboard for each day
- ranked play or "casual"
- ...
Exact need
I would like to easily embed multiple leaderboards in my game.
Current workaround
We can create a lot of leaderboards and use different uuid+secret for each of our resource/context, but it becomes quickly a lot of code and error-prone.
Proposed solutions
Sub-Leaderboards
Add a tag to each score, which we could filter and rebuild any sub-leaderboard necessary, that could enable scores to exist in multiple sub-leaderboards
Pros
- most modular for developers
Cons
- scores can easily be hard to read if the filter is too complicated
- easy to misuse with the wrong tag or filter ?
Collection of leaderboards
Current Leaderboard becomes a collection of leaderboard:
- each one having their own string name, with an optional default one such as "main"
- They are created lazily when a player needs one specific type.
Pro
- developer-facing API can easily be adapted to support an optional "LeaderboardName" target
Cons
- easily DDOSable ? (might be circumvented with wildcards of possible leaderboard names..?)
- backend and administration UI to be reworked more heavily than sub-leaderboards
this can be simulated currently using the meta
field when submitting a score: https://docs.rs/bevy_jornet/latest/bevy_jornet/struct.Leaderboard.html#method.send_score_with_meta
Seems good enough to me, next step is probably filtering via more complex queries but that should probably be another discussion