Event Leaderboards #
Event leaderboards are a high-level feature of Hiro, built on top of the Nakama leaderboards feature, that enable you to add timed and scored events, which are a great way to add competitive elements to your game. These events can optionally have an associated cost to participate.
Timed event leaderboards allow users to play against a bucket of opponents for the duration of the event. This bucket of opponents is generated on request and the duration is configured via a CRON expression. At the end of the event rewards are distributed based on a range of ranks.
Scored event leaderboards allow users to play against a bucket of opponents and “race” towards a defined target score. If the target score is achieved within the defined range of rewards, the user is a winner.
When the range of ranks for rewards is achieved by the specified number of users, the opponents for all of those users can be “rerolled”. The rerolled opponents can be played again to race for rewards. This can happen up to a maximum number of configurable rerolls. At the end of the duration of the event no more rerolls can be made and the event ends.
For both types of event the bucket of opponents generated for each user is individual to that user and can be specified up to a maximum of 100 players.
Event Leaderboard State #
When the server returns an Event Leaderboard to the client, there are a few booleans that represent its current state:
IsActive | CanClaim | CanRoll | Description |
---|---|---|---|
FALSE | FALSE | FALSE | Visible, but inactive. No actions are possible. |
FALSE | FALSE | TRUE | Not possible. |
FALSE | TRUE | FALSE | Visible, but inactive. A reward can be claimed. |
FALSE | TRUE | TRUE | Not possible. |
TRUE | FALSE | FALSE | Active, a valid cohort exists. Scores can be submitted. |
TRUE | FALSE | TRUE | Active, need to roll to get a cohort. |
TRUE | TRUE | FALSE | Active, a previous cohort exists with an unclaimed reward. After claiming, will transition to TRUE+FALSE+TRUE . |
TRUE | TRUE | TRUE | Not possible. |
Customization parameters #
The following JSON represents the customization parameters you can use to configure the default user experience for the event leaderboard system.
|
|
The JSON schema defines an event_leaderboards
object which must contain an individual object for each event leaderboard you wish to define in the system. You can configure as few or as many event leaderboards as needed for your game.
Property | Type | Description |
---|---|---|
event_leaderboards | string:EventLeaderboard | A map of all event leaderboards. |
Each individual event leaderboard is keyed by id and may define the following:
Event Leaderboard #
Property | Type | Description |
---|---|---|
name | string | The display-friendly name for this event leaderboard. |
description | string | The description text for this event leaderboard. |
category | string | The category that this event leaderboard belongs to. |
ascending | bool | Whether the records are sorted in ascending order or not. |
operator | string | The leaderboard operation (e.g. set , best , incr , or decr ). |
reset_schedule | string | The reset schedule expressed in CRON format. |
cohort_size | int | The size of the cohort that participants will be grouped into. |
additional_properties | string:string | A map of key value pairs that can contain additional context. |
max_num_score | int | The maximum amount of scores that a user can submit per reset. |
reward_tiers | string:[]RewardTier | The various rewards (as an array) per tier, keyed by tier as a string. |
change_zones | string:ChangeZone | The promotion and demotion zones per tier, keyed by tier as a string. |
tiers | int | The number of tiers that users can progress through. |
max_idle_tier_drop | int | The maximum number of tiers that an idle user can be demoted. |
start_time_sec | int64 | The start time, expressed as a UNIX timestamp. |
end_time_sec | int64 | The end time, expressed as a UNIX timestamp. |
duration | int64 | The duration in seconds for the active period. |
Reward Tier #
Property | Type | Description |
---|---|---|
name | string | The display-friendly name for this reward tier. |
rank_max | int | The maximum rank number (inclusive) that is eligible for this reward. |
rank_min | int | The minimum rank number (inclusive) that is eligible for this reward. |
reward | Reward | The rewards that a user should receive when within the eligible range. |
tier_change | int | Optionally defines a change in tier the user should receive for getting this reward. |
Change Zone #
Property | Type | Description |
---|---|---|
promotion | float64 | The percentage (expressed as a number between 0 and 1) of users at the top of the cohort who will be promoted. |
demotion | float64 | The percentage (expressed as a number between 0 and 1) of user at the bottom of the cohort who will be demoted. |
demotion_idle | bool | Whether or not idle users in the cohort should be automatically demoted. |