Building blocks9 / 12
Rewards
A reward is what a player gets from an offer, a milestone, a daily, a leaderboard or the shop. Stacked decides who has earned what. For most kinds of reward, your game is the one that hands it over.
Reward kinds
Every reward has a kind, an amount and a name. Most also have a rewardId, the id of the thing in your game.
{ "kind": "coins", "rewardId": "currency_gold", "amount": 5000, "name": "Gold Coins" }| Kind | What it is | Who gives it to the player |
|---|---|---|
item | An item in your game | Your game, from the reward webhook |
coins | A currency of your game | Your game |
exp | Experience in one of your skills | Your game |
trust_points | Trust points | Your game |
discount | A discount for your game to apply. amount is a fraction: 0.2 is 20% | Your game |
loyalty_currency | A Stacked currency, held by Stacked across games | Stacked credits the player's Stacked balance |
milestone_points | Points on a live ops track. Offers only | Stacked adds them to the track |
Stacked never changes anything inside your game. For the first five kinds it tells your backend what to grant, and your backend does it. That is the whole of the reward webhook.
The asset library
The asset library is the list of things your game has: currencies, items, skills, and the names you use for contexts, dynamic fields and entity kinds. Rewards and conditions refer to them by id.
- Add assets on the Asset Library page of the dashboard, with a name and an image for your game to show.
- Ids seen in the events your game sends are added by themselves.
- An id must not contain a dot.
- A currency carries two settings that shape reward amounts: its decimal places and, optionally, its USD price.
Amounts
Decimals. A coins amount is cut down to the currency's decimal places, never rounded up: 12.349 of a two-decimal currency is 12.34. Items, experience and trust points are whole numbers.
Amounts fixed in dollars. A coins or loyalty_currency reward can be worth a set value instead of a set number of units: "$1.00 of gold". The amount is worked out from the currency's price when the offer surfaces for a player, or when a milestone is claimed, so the reward keeps its value as the price moves.
{
"kind": "coins",
"rewardId": "currency_gold",
"name": "Gold Coins",
"amount": 400,
"anchor": { "currency": "USD", "amount": 1 }
}For this, a currency of your game needs a USD price in the asset library. amount is what was worked out when the reward was last saved, and is what is paid if no price is available.
Reward rules
A reward rule multiplies a reward for the players who match it: double gold for new players, 20% less for players in one region.
| Part | Meaning |
|---|---|
| Scope | Every offer of the game, or one offer |
| Rewards | Which rewards it changes, by kind and id |
| Conditions | Which players it applies to. They are surfacing conditions |
| Multiplier | What the amount is multiplied by |
| Priority | Which rule wins when several match |
- A rule is applied when an offer surfaces for a player, so the player sees the adjusted amount from the start.
- When several rules match one reward, only those with the highest priority apply.
- A single reward can opt out of rules.
Rules are on the Rules page of the dashboard.
Spend limits
A spend limit caps how much of a reward your game gives away in a window of time. It is your budget control.
| Part | Meaning |
|---|---|
| Scope | The whole game, the offers that carry certain labels, or one offer |
| Rewards | Which rewards it counts, by kind and id |
| Windows | A cap per window: minute, hourly, daily, weekly, monthly, or allTime. Add a count for longer windows: daily:7 is every seven days |
- A limit acts at surfacing. When an offer is about to surface, its reward is set aside from the budget. If there is no room left, the offer does not surface for that player. Nobody is shown a reward that cannot be paid.
- Windows are counted in UTC.
- A limit can give budget back when an offer expires or is declined. That is a setting per window.
Limits are on the Spend Limits page of the dashboard, which also shows how much of each window is used.
Claiming
A reward is paid when it is claimed, and a claim is always one call: from your game client for the signed-in player, or from your backend for any player.
| What | How it is claimed |
|---|---|
| An offer, a daily reward | Claim with kind: "offer" and the instanceId |
| A leaderboard reward | Claim with kind: "leaderboard" and the reward's id |
| A live ops milestone | Claim with kind: "milestone" |
| A shop item | A purchase |
Every claim that succeeds reaches your backend as a reward webhook. Claiming the same thing a second time is refused.