Event Leaderboards #

Timed leaderboard event used in Candy Crush Saga by King
Timed leaderboard event used in Candy Crush Saga by King

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.

Customization parameters #

The following JSON represents the customization parameters you can use to configure the default user experience for the leaderboard system.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  "events": {
    "leaderboard_id1": {
      "name": "Chef Tournament",
      "description": "Play a tournament against other chefs for great rewards!",
      "category": "Challenges",
      "ascending": false,
      "operator": "best",
      "reset_schedule": "0 0 * * *",
      "cohort_size": 100,
      "additional_properties": {
        "key": "value"
      },
      "max_num_score": 0,
      "tiers": 5,
      "max_idle_tier_drop": 1,
      "start_time_sec": 0,
      "end_time_sec": 0,
      "duration": 86400,
      "change_zones": {
        "0": {
          "promotion": 0.5,
          "demotion": 0,
          "demote_idle": false
        },
        "1": {
          "promotion": 0.2,
          "demotion": 0.3,
          "demote_idle": true
        }
      },
      "reward_tiers": {
        "0": [
          {
            "rank_min": 1,
            "rank_max": 10,
            "tier_change": 1,
            "reward": {
              "guaranteed": {
                "currencies": {
                  "coins": {
                    "min": 1000,
                    "max": 2000
                  }
                }
              }
            }
          },
          {
            "rank_min": 11,
            "rank_max": 90,
            "tier_change": 0,
            "reward": {}
          },
          {
            "rank_min": 91,
            "rank_max": 100,
            "tier_change": -1,
            "reward": {}
          }
        ]
      }
    }
  }
}

The JSON schema defines an events object which must contain an individual object for each leaderboard you wish to define in the system. You can configure as few or as many energy types as needed for your desired gameplay.

Each leaderboard is keyed by id and may define the following:

PropertySubpropertyDescription
nameThe name of this event leaderboard.
descriptionThe description for this event leaderboard.
categoryThe category for this event leaderboard.
operatorThe leaderboard operation (e.g. set, best, incr, or decr).
ascendingWhether the records are sorted in Ascending order or not.
reset_scheduleThe reset schedule of this leaderboard expressed as a CRON expression.
cohort_sizeThe size of the cohort that participants will be grouped into.
additional_propertiesA string:string dictionary of key value pairs that can contain additional context.
max_num_scoreThe maximum amount of scores a user can submit per reset.
tiersThe number of tiers that users can progress through.
max_idle_tier_dropThe maximum number of tiers an idle player can be demoted.
start_time_secThe start time (as a UNIX timestamp) of this event leaderboard.
end_time_secThe end time (as a UNIX timestamp) of this event leaderboard.
durationThe duration in seconds for the event leaderboard active period.
change_zonesA map that defines the promotion and demotion zones per tier, keyed by tier as a string.
promotionThe percentage (as a number between 0 and 1) of players at the top of the cohort who will be promoted.
demotionThe percentage (as a number between 0 and 1) of players at the bottom of the cohort who will be demoted.
demote_idleWhether or not idle players in the cohort should be automatically demoted.
reward_tiersA map that defines the various rewards (as an array) per tier, keyed by tier as a string.
rank_minThe minimum rank number (inclusive) eligible for this reward.
rank_maxThe maximum rank number (inclusive) eligible for this reward.
tier_changeOptionally defines a change in tier the player should receive for getting this reward.
rewardA reward object that defines the reward the player should receive.