Rewards
The Rewards system is the foundation of player progression and engagement in Hiro. Use it to grant game resources when players take certain actions or reach various milestones. This guide defines key concepts, shows how to route rewards (player, team, or mailbox), lists the resource types you can grant, and explains different ways to select rewards (guaranteed, weighted, gacha, or deferred).
Key terms #
- Reward: A collection of resources, such as currencies, items, and energies, that can be granted to players, teams, or both.
- Mailbox: A holding area, like an inbox, where rewards can be claimed later.
- Grant: The action that applies the reward to the target’s wallet, inventory, mailbox, or other storage.
- Modifier: A temporary effect that changes how future rewards are calculated (for example, “2x coins for 1 hour”).
Integrating rewards #
Rewards are deeply integrated with many Hiro systems:
Player progression #
- Achievements: Grant rewards when players complete goals or reach certain milestones.
- Unlockables: Reward players when they unlock new content.
- Energy: Reward players for spending energy.
Economy #
- Virtual store: Grant rewards from purchases or apply reward modifiers during transactions.
- Inventory: Provide rewards when players use items.
- Donations: Enable player-to-player contributions and rewards.
Player engagement #
- Event leaderboards: Provide competitive rewards based on player or team rankings.
- Incentives: Drive behaviors through targeted campaign, like player referral events.
Teams #
Many Hiro systems that operate at the player level also exist at the team level. To learn more, see Teams.
Setting reward destinations #
Rewards can be delivered to one or more destinations:
- Directly to the player or their mailbox
- Directly to a team or their shared mailbox
- Directly to members of a team or their mailboxes
Player rewards #
Grant rewards to an individual player. If you set to_mailbox_expiry_sec
, the reward is sent to the player mailbox and expires after the configured time. In this example, a reward is granted directly to the player for reaching a major level milestone:
|
|
Team rewards #
Grant rewards to the team. If you set to_mailbox_expiry_sec
, the reward is sent to the team mailbox and expires after the configured time. In this example, a reward is delivered to the team mailbox for winning a tournament:
|
|
Team member rewards #
In addition to team rewards, you may distribute a reward to each team member. Add a member_reward
object with its own parameters:
|
|
Combined rewards #
Combine multiple destinations in one reward so the triggering player, the team, and team members all benefit:
|
|
This example demonstrates:
1. Individual player rewards
- 200 coins and 1 champion badge go directly to the triggering player.
- These are granted immediately because
auto_claim
istrue
and no mailbox expiry is set.
2. Team rewards
- 500 team funds and 1 team trophy go to the team’s shared resources.
- These are sent to the team mailbox (expires in 7 days = 604,800 seconds).
3. Team member rewards
- 50 coins and 1 participation medal go to each team member.
- These are applied directly to each member’s account.
Reward types #
Rewards consist of one or more resource types for both players and teams. Consuming a resource can grant another (for example, using an item can boost currency gain or restore energy).
Currencies #
Virtual money with built‑in validation and controls—for example, coins, premium gems, or team funds:
|
|
Learn more about currencies.
Items #
In‑game objects with optional metadata. Items can be stackable or unique:
|
|
Learn more about inventory items.
Item sets #
Select items from predefined categories using set intersection logic:
|
|
This configuration:
- Finds items tagged both “rare” and “weapon”.
- Randomly selects 1–3 items.
- Ensures no item repeats (
max_repeats: 1
). - Selects only items available to the player.
Learn more about items sets.
Energy #
Auto‑regenerating resources that power gameplay actions (often called stamina):
|
|
Learn more about energy.
Energy modifiers #
Temporary effects that change how energy systems behave (for example, faster regen or higher max capacity):
|
|
Learn more about energy modifiers.
Reward modifiers #
Temporary buffs that enhance future reward calculations. They stack with other modifiers of the same type and expire automatically:
|
|
This configuration grants two temporary buffs:
- Coin multiplier: For the next two hours, all coin rewards are doubled or tripled (randomly selected).
- Sword bonus: For the next hour, all sword rewards get +1 additional sword.
Reward selection methods #
Configure how a reward should be selected. The system supports simple, weighted, gacha‑style, deferred (mailbox), and custom reward mechanics.
Simple rewards #
Straightforward rewards that provide immediate gratification and clear feedback.
Example: Daily login bonus
|
|
Weighted rewards #
Probability‑based rewards that introduce excitement through rarity.
Example: Level-up chest
|
|
Gacha-style rewards #
Multi‑roll systems with probability mechanics for collection gameplay.
Example: Character summoning
|
|
Deferred rewards (mailbox) #
Send rewards to a mailbox to claim later. Useful for controlled distribution and admin oversight.
Example: Gift from game admins
|
|
Custom rewards #
Customize outcomes with hooks that modify reward objects based on game state and player context. This option allows you to modify reward behavior and provide a personalized experience for your players.
Example: Item consumption rewards
The following example demonstrates how to implement a custom reward handler when an inventory item is consumed using the inventorySystem.SetOnConsumeReward()
hook:
|
|
Reference: Inventory API
Assign the hook function in the inventory system:
|
|
Within the onConsumeReward()
function, you have the opportunity to modify the reward object and perform any necessary actions or checks. In the example above, the context of the consumed item is checked and a specific action is taken and reward given depending on the user’s contextual information.
By utilizing a reward hook function and customizing it to fit your game’s specific needs, you can dynamically adjust rewards, incorporate game mechanics, and create a more personalized and engaging experience for your players.
Example: Pity system
The following example demonstrates an implementation of a “pity system” i.e., a way to guarantee rewards to a player after repeated failed attempts to roll in a gacha-style system. Using a custom reward hook on a Virtual Store Purchase, the player is guaranteed to obtain a legendary hero after a certain number of misses.
|
|
Configuring rewards #
The following JSON represents the customization parameters you can use to configure the default user experience for a particular reward.
|
|
The JSON schema defines a reward object which defines the various items, item sets, currencies, energies, energy modifiers, and reward modifiers that will be available as rewards where this particular reward is defined. You can configure as few or as many of each as needed for your desired gameplay. This object is defined inline throughout the various data definitions within Hiro. In this example, it is shown as part of a rewards
field, but in some systems this field may be named differently (e.g. contributorRewards
in the Donations System).
A Reward
object consists of the following properties:
Reward #
Property | Type | Description |
---|---|---|
guaranteed | RewardContents | The rewards that a user is guaranteed to receive. |
weighted | []RewardContents | The rewards that a user may or may not receive depending on the outcome of a random roll. |
max_rolls | int64 | The number of weighted RewardContents to select from among the possibilities. |
max_repeat_rolls | int64 | The maximum number of repeats for any given weighted reward. |
total_weight | int64 | The total weight of all weighted reward contents, this can be omitted if you would prefer it to be automatically calculated. If you want a chance for the player to receive no reward, you can manually set this to be higher than the sum of individual weights. |
Reward contents #
Property | Type | Description |
---|---|---|
items | string:RewardItem | A map of item IDs and quantities to reward the player with. |
item_sets | []RewardItemSet | The item sets that are part of the reward. |
currencies | string:RewardRangeInt64 | A map of currency IDs and quantities to reward the player with. |
energies | string:RewardRangeInt32 | A map of energy IDs and quantities to reward the player with. |
energy_modifiers | []RewardEnergyModifier | The energy modifiers that are part of the reward. |
reward_modifiers | []RewardRewardModifier | The reward modifiers that are part of the reward. |
weight | int64 | The weight of this reward as it relates to the rest of the weighted rewards. |
Reward energy modifier #
Property | Type | Description |
---|---|---|
id | string | The ID of the energy that should be modified. |
operator | string | The operation that should be performed on the energy when rewarded (e.g. multiplier , addition ). |
value | RewardRangeInt64 | The modifier value range. |
duration_sec | RewardRangeUInt64 | The duration range for the modifier (in seconds). |
Reward reward modifier #
Property | Type | Description |
---|---|---|
id | string | The ID of the reward element that should be modified (e.g. coins or potion ). |
type | string | The type of the reward that is to be modified (e.g. item or currency ). |
operator | string | The operation that should be performed on the reward when rewarded (e.g. multiplier , addition ). |
value | RewardRangeInt64 | The modifier value range. |
duration_sec | RewardRangeUInt64 | The duration range for the modifier (in seconds). |
Reward item #
Property | Type | Description |
---|---|---|
min | int64 | The minimum amount to reward. |
max | int64 | The maximum amount to reward. |
multiple | int64 | The multiple the amount will be rounded to. |
string_properties | string:RewardStringProperty | Additional string properties that will be added to the item instance. |
numeric_properties | string:RewardRangeFloat64 | Additional numeric properties that will be added to the item instance. |
Reward item set #
Property | Type | Description |
---|---|---|
min | int64 | The minimum amount to reward. |
max | int64 | The maximum amount to reward. |
multiple | int64 | The multiple the amount will be rounded to. |
max_repeats | int64 | The maximum amount of repeats that can be rewarded from this set. |
set | []string | Which intersection of item sets to reward from. |
Reward ranges #
Below are the types that are used when defining ranges across various properties.
Reward range Int32 #
Property | Type | Description |
---|---|---|
min | int32 | The minimum amount to reward. |
max | int32 | The maximum amount to reward. |
multiple | int32 | The multiple the amount will be rounded to. |
Reward range Int64 #
Property | Type | Description |
---|---|---|
min | int64 | The minimum amount to reward. |
max | int64 | The maximum amount to reward. |
multiple | int64 | The multiple the amount will be rounded to. |
Reward range UInt64 #
Property | Type | Description |
---|---|---|
min | uint64 | The minimum amount to reward. |
max | uint64 | The maximum amount to reward. |
multiple | uint64 | The multiple the amount will be rounded to. |
Reward range Float64 #
Property | Type | Description |
---|---|---|
min | float64 | The minimum amount to reward. |
max | float64 | The maximum amount to reward. |
multiple | float64 | The multiple the amount will be rounded to. |
Reward string property #
Property | Type | Description |
---|---|---|
total_weight | int64 | The total weight of all weighted property options, this can be omitted if you would prefer it to be automatically calculated. If you want a chance for a property not to be added to the item instance, you can manually set this to be higher than the sum of individual weights. |
options | string:RewardStringPropertyOption | A map of the possible properties and their weightings. |
Reward string property option #
Property | Type | Description |
---|---|---|
weight | int64 | The weight of this property option as it relates to the rest of the weighted property options. |