Game economy
Add a skin shop, consumables, energy, timed boosts, chests, a battle pass and server-validated match results on top of the game starter.
Everything a player owns that is not a currency is an item: skins, consumables, boosts, chests, energy refills, streak repairs and battle pass premium tokens. The full reference, with a step-by-step recipe (skin shop, energy, chests, battle pass, rules, browser and backend calls), is Economy. Follow it on top of the game starter. The points below are where agents went wrong in testing.
Change sets
- The commands are
economy_item.create,economy_offer.create,economy_loot_table.create,economy_energy.createandeconomy_battle_pass.create(underscore, then the verb). - One operation command per change set (every economy command is one). Propose items before the offers, loot tables and passes that name them.
- A proposal answers
201withstatus: "pending"in every environment. Apply it withPOST /v1/change_set_applications{ "change_set_id", "plan_digest" }. In the test environment the apply always succeeds; in a live environment it follows the autonomy policy. amount_minorin economy commands is a JSON integer of at least 1 (minor units):"price": { "currency": "coins", "amount_minor": 500 }. The price currency must be spendable (coinsin the game starter, notxp).- Rules and program reward slots grant items with
{ "type": "item.grant", "item": "red_cape", "quantity": 1 }.
The player and the backend
- Shop, inventory, equips, consumptions, energy, chest openings and battle pass claims are customer
calls under
/v1/customer/...with a session; a backend makes the same calls under/v1/customers/{id}/...with the secret key. Every write takes anIdempotency-Key; a chest opening's loot is fixed by it, so a retry shows the same loot. - Battle pass premium is set by your backend after it verifies the purchase:
POST /v1/customers/{id}/battle_pass_premium{ "pass", "premium": true, "source": { "type", "id" } }withIdempotency-Key: premium-<transaction id>. Premium rewards of tiers already reached become claimable.
Match results and the game starter
POST /v1/match_results (secret key, events:write) checks a game server's result per player
against a match profile and admits each player as a trusted match.completed event. Its
properties are the profile's numeric metrics plus match_id and match_profile, and won
when the report gives it per player ("won": true or false beside metrics). The game
starter's win rules (xp_per_win, coins_per_win, the wins badge and the win quest step) test
event.properties.won, so send won for every player and they pay as with POST /v1/events.
See Match results.
Supabase app
One prompt: XP, levels, coins, streaks, badges, quests, leaderboards, leagues and referrals in a Supabase app, through an Edge Function that holds the secret key.
Prompt: Firebase web app
A prompt to paste into a coding agent that integrates a Firebase-authenticated web app with Orishare customer sessions.