Build a game
First game in a weekend
Build a web game with items, trophies and an in-game sell and buy sheet, with gas paid for players, starting from npm create rare-game.
The goal is a web game (HTML5, or a Godot or Unity web export) where players earn items and trophies, see their inventory, and sell or buy in the game, built by one developer over a weekend. This page follows the path and says which step needs what.
Some steps depend on pieces that are not live yet: the rare_items contract, the Studio game workspace, and game gas budgets. Each step below says so. The code you write does not change when they land.
Friday evening: set up the game record
About an hour, all in the browser, on testnet.
Get an API key
Sign in at rare.market/developers with any Sui wallet and create a key. See Authentication. You only need it for server-side ownership checks.
Create the game
In Studio, choose New game and enter a slug, a name, art and the play URL. The slug is the join key across items, trophies and the Store.
Make the game key
Studio generates an ed25519 key in your browser and downloads it once. The private key never leaves your machine. Only the public key goes on chain. Keep it out of git. See Voucher signing.
Create the item class
Two wallet transactions, about 0.1 SUI of testnet gas: publish the marker package (the same flow the launchpad uses), then create the class with a 5% royalty, locking on, and your game key as issuer, then add one kind for each item (for example Sword, Shield, Hat). Note the
Classobject id.Create the trophies
One transaction creates the game with a
web:<slug>identifier, sets your game key as its issuer, adds each trophy and sets the platinum. Note theRegistryandGameobject ids. See Trophies for studios.
Saturday: the game
Scaffold it
Shellnpm create rare-game my-game -- --class-id 0x... --registry-id 0x... --trophy-game-id 0x... cd my-game npm install cp .env.example .envPut the game key in
RARE_GAME_KEYand the same ids in.env. The ids are optional at first: the game runs without them and the server says which one is missing.Run it
Shellnpm run devThe game is on
http://localhost:5173and the voucher server on port 8787. Vite proxies/apito the server.Open it in Rare Launcher
Shellrare-launcher --dev-game http://localhost:5173On a SuiPlay, add it with + Web game and the same URL. The launcher gives it the controller mapping, the keyboard and the wallet. See Testing in Rare OS.
What the template does
The files you will edit:
The template tracks progress in memory and trusts the client to say a chest was opened, with a 3 second gap and an hourly cap per player as a brake. In your game, make the server decide what a player earned from what actually happened, and sign a voucher only for that. A voucher is a mint, so treat the endpoint that makes one like a payment endpoint.
Sunday: ship
Check the build
Shellnpm run build npm run checkSee Check your game. Fix every failure. Warnings for the placeholder URL and empty ids go away as you fill
public/rare.json.Repeat the Friday steps on mainnet
The same Studio clicks, about 0.1 SUI of real gas. Replace the ids in
.envandpublic/rare.json, set the network tomainnetinsrc/rare.ts(Rare.connect({ network: "mainnet" })), and deploy your server.Pay for players' gas
Take the starter grant for a verified mainnet game, or send SUI to the game's budget. See Gas sponsoring.
Set the status to beta
The game appears in the launcher's Sui Games, on
rare.market/games/<slug>, in the overlay with the player's items, offers and trophies, and its items trade on every Sui marketplace. See Get your game listed.
Native games
A Unity, Godot or Unreal game on Linux or Windows follows the same path with a thin engine wrapper over the Rare Local API in place of the browser. Off the device, players use the rare.market web transport. Engine wrappers are not released yet.
