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 event 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
66
67
68
{
  "event_leaderboards": {
    "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,
      "reward_tiers": {
        "0": [
          {
            "name": "<tiername>",
            "rank_max": 10,
            "rank_min": 1,
            "reward": {
              "guaranteed": {
                "currencies": {
                  "coins": {
                    "min": 1000,
                    "max": 2000
                  }
                }
              }
            },
            "tier_change": 1
          },
          {
            "name": "<tiername2>",
            "rank_max": 90,
            "rank_min": 11,
            "reward": {},
            "tier_change": 0
          },
          {
            "name": "<tiername3>",
            "rank_max": 100,
            "rank_min": 91,
            "reward": {},
            "tier_change": -1
          }
        ]
      },
      "change_zones": {
        "0": {
          "promotion": 0.5,
          "demotion": 0,
          "demote_idle": false
        },
        "1": {
          "promotion": 0.2,
          "demotion": 0.3,
          "demote_idle": true
        }
      },
      "tiers": 5,
      "max_idle_tier_drop": 1,
      "start_time_sec": 0,
      "end_time_sec": 0,
      "duration": 86400
    }
  }
}

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.

PropertyTypeDescription
event_leaderboardsstring:EventLeaderboardA map of all event leaderboards.

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

Event Leaderboard #

PropertyTypeDescription
namestringThe name of this event leaderboard.
descriptionstringThe description for this event leaderboard.
categorystringThe category for this event leaderboard.
ascendingboolWhether the records are sorted in Ascending order or not.
operatorstringThe leaderboard operation (e.g. set, best, incr, or decr).
reset_schedulestringThe reset schedule of this leaderboard expressed as a CRON expression.
cohort_sizeintThe size of the cohort that participants will be grouped into.
additional_propertiesstring:stringA map of key value pairs that can contain additional context.
max_num_scoreintThe maximum amount of scores a user can submit per reset.
reward_tiersstring:[]RewardTierThe various rewards (as an array) per tier, keyed by tier as a string.
change_zonesstring:ChangeZoneThe promotion and demotion zones per tier, keyed by tier as a string.
tiersintThe number of tiers that users can progress through.
max_idle_tier_dropintThe maximum number of tiers an idle user can be demoted.
start_time_secint64The start time (as a UNIX timestamp) of this event leaderboard.
end_time_secint64The end time (as a UNIX timestamp) of this event leaderboard.
durationint64The duration in seconds for the event leaderboard active period.

Reward Tier #

PropertyTypeDescription
namestringThe name of this reward tier.
rank_maxintThe maximum rank number (inclusive) eligible for this reward.
rank_minintThe minimum rank number (inclusive) eligible for this reward.
rewardRewardThe rewards that a user should receive when within the eligible range.
tier_changeintOptionally defines a change in tier the user should receive for getting this reward.

Change Zone #

PropertyTypeDescription
promotionfloat64The percentage (as a number between 0 and 1) of users at the top of the cohort who will be promoted.
demotionfloat64The percentage (as a number between 0 and 1) of user at the bottom of the cohort who will be demoted.
demotion_idleboolWhether or not idle users in the cohort should be automatically demoted.