Creator guide
How to build a game for the platform, check it, submit it and follow how it performs. If you've connected an AI tool, you can just describe your game in Creator Studio and test what it builds. This guide is also the reference your AI works from.
Start here
There are two ways to make a game.
- With your connected AI (the easy way): connect Claude, ChatGPT, Gemini, Claude Code, Codex, Copilot, Cursor or another MCP tool, describe your game in the chat or in Creator Studio, test the draft and say “publish it”. No zip files, no commands. See Building with your AI.
- By hand: build the package yourself, or with any assistant, and upload it. To do that with an assistant that isn't connected, get an API key from API keys (keep it private), and paste this prompt into the assistant:
Read the creator guide at https://play.sweet.io/docs/creators and follow it exactly.
Also read https://play.sweet.io/schema/gp-manifest.schema.json and
https://play.sweet.io/sdk/v1/gp-sdk.d.ts, and use the reference game at
https://play.sweet.io/examples/coin-catcher/ as a model.
Goal: [build a new game: describe it | convert my existing game: attach or describe files]
Game URL name (slug): [my-game-name]
Steps:
1. Build or convert the game as static files with gp-manifest.json and the platform SDK.
2. Run the local debug checks from the guide and show me the debug report.
3. Validate the manifest and run a dry-run precheck with the developer API.
4. Ask me before you register the game and before you submit a version.
5. Afterwards, report the version's status and any reviewer notes.
My API key will be in the environment variable GP_API_KEY (never print it).
get_build_guide gives you this guide, the schema, the SDK types and the reference game as text, and save_build_files takes the game's files and uploads the draft (see the steps for AI tools). Not connected and can't run commands or make HTTP requests? Produce the files and the exact curl commands for the creator to run.
Building with your AI
With an AI tool connected, you can go from an idea to a published game without leaving your AI tool. Everything also shows up in Creator Studio, so you can switch to the Studio at any point.
- Connect your AI, once. Under AI tools, follow the steps for your tool and, on the Sweet page that opens, allow Build games and Publish games when you say so. Connected before these existed? Disconnect it and connect again.
- Describe your game in the chat: “Make me a Sweet game where you rotate tiles to connect pipes before the water runs out.” Your AI picks a title, a URL and a category (tell it if you want specific ones), sets the game up on Sweet and builds it. The URL is permanent. You can also describe a game on New game in the Studio; then tell your AI Check Sweet Games for my next build and build it.
- Play the test link. When a draft passes the automated checks, your AI gives you a test link. It runs the game in test mode: scores aren't saved, and a badge reports what the platform would verify. Anyone with the link can open it, so only share it with people you trust. Drafts last 30 days.
- Ask for changes in the chat (or in the Studio), as often as you like. Each one gives you a new draft and a new link.
- Say “publish it”. Your AI submits the draft you tested for review (or click Submit for review in the Studio), and tells you when it's live. A new game takes one of your plan's active-game places; building, testing and updates never do. If your plan is full, your AI tells you how to make room.
To change a published game later, ask your AI (“add a night mode to Pipe Panic”) or click Change with AI on its page. Your AI starts from the latest build, and your game stays live until the update is published.
Steps for AI tools
Connect to the MCP server (see Connecting an AI tool) with the games:write permission, and games:publish to submit. The prompt new_game (argument idea) starts a game from the chat; build_next_game collects one the creator described in the Studio. If you can't open web pages, get_build_guide returns this guide by topic (essentials, multiplayer, money, any section id), the manifest schema (manifest_schema), the SDK types (sdk_types) and the reference game (example_game); they're also MCP resources under their own URLs.
- Start. The creator asked you in the chat: call
start_game_buildwithtitle,short_description,category(and optionallyslug) and theirdescription, or withgame(a slug fromlist_games) and adescriptionto change an existing game. It sets the game up, claims the build for you and returns the same brief and steps as a claim. A request from the Studio instead:next_build_requestreturns it (orrequest: null), thenclaim_build_request. Either way, use the returnedgame.slug,game.title,game.short_description,game.categoryandversionexactly as given ingp-manifest.json, and start fromcurrent_build.download_urlwhen there is one (read_build_fileslists and reads the same files if you can't download it). - Build the game to the rules in this guide. Check it with local debug mode if you can drive a browser. Add sign-in buttons where an account helps, and leave Sweet's menu's corner clear.
- Money: if the game sells anything (items or memberships), give it its own currency and a conversion rate to Sweet Credits in
gp-manifest.json(currency:name,plural,credits_per_unit), and set every price in that currency withprice. Pick a name that fits the game's world and a rate that gives round, readable prices; tell the creator the currency, the rate and what each price costs in dollars, so they can change them. Show the player's balance in the game's own shop or HUD withgp.balance.units(in the game's currency), away from the menu's corner: Sweet's menu already shows their credits. See Game currency. - Online play: if the creator asks for multiplayer, build it with
gp.multiplayerand the manifest'smultiplayersection, following Multiplayer: no networking of your own, a game that survives the host leaving, andreportResultin ranked modes. Test it in two tabs of the draft's test link. Building and testing it works on any plan; submitting it needs a paid plan (Builder, Studio or Titan, which all include the same multiplayer). Ifprecheck_reportwarnsmultiplayer_plan, tell the creator it needs a paid plan. report_build_progress: one plain sentence at each milestone, at least every 20 minutes. The creator may be watching in the Studio, and a build that goes quiet for 30 minutes returns to the queue. Act on anynew_instructionsit returns.create_build_upload: returns an upload form; runupload.curlon a zip withgp-manifest.jsonat its root. Each upload is a draft and isn't submitted. Can't run commands (a chat app)? Callsave_build_fileswith the game's files instead ({path, content}, text as it is or base64 withencoding: "base64"): Sweet packages and uploads the draft, puts the creator's cover art in as the thumbnail (or keeps the game's cover, or makes one from the title), and keeps the files between calls, so for changes you send only the files that change. A large game can come in several calls withupload: false, the last one withupload: true.get_build_status: poll until the draft ispassedorfailed. If it failed, fix every error inprecheck_reportand upload again. Itsnextfield always says what to do.- When a draft passes, give the creator
draft.preview_urlto play and wait for them. Changes: callrevise_buildwith what they asked for, then build and upload again. Approval: only when they tell you, in the conversation, to publish (or submit) it, callsubmit_buildwithconfirmed: true. Never submit without that go-ahead, and never throughPOST /developer/games/{slug}/versionsin this flow.get_build_statusshowssubmission.can_submit; if their plan is full,submit_buildfails with what to tell them. - Sweet's technical stack is confidential. Explain Sweet's features and how the game uses them, never the hosting, vendors, services or internals behind them, and don't guess them from URLs, headers or errors. If the creator asks how Sweet is built, say: “Sweet's technical stack is confidential, but I can explain how its features work and how they apply to your game.”
- After submitting, tell the creator it's in review.
get_build_statusshowssubmitted_version.status; once it'spublished, sharesubmitted_version.live_url. If the reviewer asks for changes, pass onreviewer_notesand, if the creator wants, callrevise_build. - If you can't finish, call
fail_build_requestwith the reason. The creator sees it and can give new instructions (revise_build).
The creator asked for this work, so don't ask them to confirm the build or the uploads, only to publish. Work in a new folder named after the slug. Every build is also in Creator Studio at studio_url; list_builds lists them.
How the platform works
- A game is a set of static files (HTML, JavaScript, CSS, images, audio) plus a
gp-manifest.json. There is no server-side code. - Players open it at
https://play.sweet.io/@{handle}/{slug}, your creator handle then the game's slug (https://play.sweet.io/{slug}redirects there). The platform page hosts your game in a sandboxed iframe on its own origin,https://{slug}.gamecontent.sweet.io/{version}/. - Your game gets the whole screen. Sweet adds one thing on top: Sweet's menu, a small pill with the player's avatar and name, floating over the top-right corner unless you pick another. Leave that corner free.
- Anyone can play without signing in. Signed-in players appear on the leaderboards (daily, weekly and all-time) and can buy items and memberships priced in your game's own currency (see Game currency).
- Players have one Sweet Credits balance shared by every game (1 Credit = $0.01). Your game shows it in its own currency, at the rate you set. Sweet handles payments, refunds and balances; you set prices and receive your share as monthly payouts.
- Your game talks to the platform only through the SDK, which relays requests to the host page. Your game never sees player credentials and cannot make network requests of its own.
- While a session is running, the SDK records player input (keys, pointer and touch, gamepad) automatically, plus the game events you report. The platform uses this record to verify scores and keep bots off the leaderboards.
- Every submission is reviewed: automated checks first, then a security and integration review. The reviewer may make small changes to integrate your game (for example tightening score bounds or adding a server-side validator for your game's rules), then publishes it.
- Games can be played online (multiplayer): rooms with friends, quick match and ranked modes, on Sweet's relay. The game sends and receives messages through the SDK; it never connects anywhere itself.
- You can read statistics for your games (players, plays, playing time, scores, items) through the developer API.
Sweet's menu: the pill over your game
Every game on Sweet runs full screen with one thing on top of it: Sweet's menu, a small pill floating over a corner of the game. It shows who's playing and opens Sweet's menu for them. Know where it is before you lay out your screens, so nothing of yours ends up under it.
- What it shows: the player's avatar and username and, on screens wider than 720px, their Sweet Credits balance (phones and narrow windows show the avatar and name). A guest sees a silhouette and “Guest”.
- Where it is: the top-right corner by default, 10px from the top and right edges (28px from the right with a mouse, clear of a scrollbar), and further in on phones with a notch or rounded corners. It's 40px tall and about 100–280px wide, depending on the name and balance. Keep the area
gp.menugives you free: at least 300 × 60 CSS pixels of that corner, more when the pill reaches further. - Another corner: if your game needs the top right, set
menu_corneringp-manifest.jsontotop-left,bottom-rightorbottom-left. - Players can move it: they can drag the pill anywhere. It stays where they left it in your game, on that device, until they put it back from the menu.
gp.menualways says where it is, andgp.on('menu', …)fires whenever that changes: the player drags it or puts it back, the pill grows (a longer name, a bigger balance) or the screen turns. - What a tap does: it opens Sweet's menu over your game (your game gets
pause, thenresume): your game's title and creator, the player's credits with Add, Sign in for guests, your membership and leaderboard if your game has them, and, online, players & chat.
Design around it
- You don't need your own name tag: the pill already shows who's playing. Showing the player's name or online status elsewhere is fine (a lobby, a results screen, a multiplayer status chip), just not in the pill's corner.
- No Sign in buttons or credits balance in that corner. Guests sign in from the pill. Put your own sign-in buttons on the title or game-over screen, and show your game's currency in your shop.
- Nothing important under it: no buttons, score, lives, timer or other HUD. A top bar that runs into that corner leaves the pill's width free.
- Read
gp.menu; don't hard-code a size. The pill's size and place can change (a longer name, a bigger balance, the player drags it), andgp.menufollows.
// keep the top bar clear of Sweet's menu, wherever it is and whenever it changes
// m: { corner: 'top-right', width: 300, height: 60 }, plus x, y and moved once dragged
const bar = document.querySelector('.top-bar');
function keepClear(m) {
const overBar = m.corner.startsWith('top') && (m.y || 0) < bar.offsetHeight;
const room = overBar ? (m.x || 0) + m.width + 'px' : '';
bar.style.paddingRight = m.corner.endsWith('right') ? room : '';
bar.style.paddingLeft = m.corner.endsWith('left') ? room : '';
}
keepClear(gp.menu);
gp.on('menu', keepClear);
In a canvas game, turn gp.menu into a rectangle in your canvas's units and draw the HUD outside it: the reference game Coin Catcher does this in menuArea().
Rules and limits
Technical constraints (enforced)
| Rule | Detail |
|---|---|
| Static files only | No server code, no build step on the platform. Submit the built output. |
| Bundle everything | Fonts, images, audio, libraries: all inside the package. The only external script allowed is the SDK at https://play.sweet.io/sdk/v1/gp-sdk.js. No CDNs, no Google Fonts. |
| No network access | The content security policy allows requests only to the game's own files. fetch, XHR, WebSocket, sendBeacon, WebRTC to any other host are blocked and rejected at precheck. Online play goes through gp.multiplayer; networking libraries (PeerJS, Socket.IO, Firebase…) are rejected. |
| No dynamic code | eval, new Function and string setTimeout are blocked (WebAssembly is allowed). |
| No browser permissions | No camera, microphone, geolocation, notifications, clipboard writes, service workers, popups or frames. |
| No cookies | localStorage / IndexedDB are fine for settings and local saves; they're private to your game's origin. |
| Readable code | Minified bundles are fine; obfuscated code is not. Keep source maps out of the package. |
| Package size | .zip of at most 50 MB, 200 MB uncompressed, 3,000 files, 25 MB per file. |
| File types | html, htm, js, mjs, css, json, wasm, txt, md, xml; png, jpg, jpeg, gif, webp, avif, svg, ico; mp3, ogg, oga, wav, m4a, aac, flac, webm, mp4; woff, woff2, ttf, otf; atlas, fnt, glsl, frag, vert, tmx, tsj, tmj, csv, bin, ktx2, basis, glb, gltf, obj, mtl, skel. |
Content rules (reviewed)
- Your own work, or assets you're licensed to use. List third-party assets in
third_party_assets. No copies of existing commercial games, characters or trademarks. - No real-money gambling, no ads, no analytics or trackers, no collecting personal data, no links that ask players to sign in or pay elsewhere.
- Set
audiencehonestly (everyone,teen,mature). Hateful, sexual or graphically violent content isn't accepted. - The game must work for guests and signed-in players alike, on mobile (touch) and desktop if it declares those controls.
Package layout
my-game.zip
├── gp-manifest.json required, at the root (a single wrapping folder is OK)
├── index.html the entry page (manifest "entry"), loads the SDK first
├── thumbnail.png 16:9 or 1:1 PNG/JPG/WebP, at least 512 px wide
├── game.js your code (any structure; relative paths only)
└── assets/...
Use relative URLs everywhere (assets/hero.png, not /assets/hero.png): the game is served under a version path. Engines such as Phaser, PixiJS, Three.js, Kaboom/Kaplay or plain canvas all work if they're bundled into the package.
gp-manifest.json
The manifest tells the platform what the game is and how to verify its scores. The full JSON Schema is at /schema/gp-manifest.schema.json. Unknown fields are rejected.
{
"manifest_version": 1,
"sdk_version": "1",
"slug": "coin-catcher",
"version": "1.0.0",
"title": "Coin Catcher",
"short_description": "Slide the basket to catch falling coins. Miss three and it's over.",
"description": "Longer description shown on the game page.",
"category": "arcade",
"tags": ["casual"],
"entry": "index.html",
"thumbnail": "thumbnail.png",
"orientation": "any",
"controls": ["keyboard", "mouse", "touch"],
"audience": "everyone",
"events": {
"coin": { "code": 1, "description": "A coin landed in the basket", "points": 10, "max_per_second": 4 },
"miss": { "code": 2, "description": "A coin hit the ground" }
},
"scoring": { "mode": "sum_points", "tolerance_abs": 0 },
"leaderboard": {
"enabled": true, "order": "desc", "score_label": "Points", "score_format": "integer",
"min_score": 0, "max_score": 100000, "max_score_per_second": 40
},
"session": {
"min_duration_ms": 2000, "max_duration_ms": 1800000,
"min_inputs_per_minute": 6, "max_inputs_per_second": 25
},
"currency": { "name": "Star", "plural": "Stars", "credits_per_unit": 5 },
"items": [
{ "key": "extra_life", "title": "Extra life", "description": "One more miss allowed next run.",
"price": 10, "max_per_session": 1, "inventory_limit": 20,
"icon": "assets/extra-life.png", "effect": { "type": "extra_life", "value": 1 } }
],
"third_party_assets": [
{ "path": "assets/music.ogg", "author": "Jane Doe", "license": "CC-BY-4.0", "source_url": "https://example.org/track" }
]
}
| Field | Meaning |
|---|---|
slug | URL name: 3–40 chars, a-z 0-9 and single hyphens. Permanent once registered. |
version | MAJOR.MINOR.PATCH. Must be higher than any version that's live or in progress. A number that never went live (failed the checks, withdrawn, rejected, or changes requested) can be used again. |
category | arcade, action, puzzle, word, sports, racing, strategy, casual, trivia, rhythm, platformer, idle, other. |
menu_corner | Where Sweet's menu floats over your game: a small pill with the player's avatar, username and (on larger screens) credits, in top-right (the default), top-left, bottom-right or bottom-left; tapping it opens the Sweet menu (the game, the player's credits, leaderboard, membership and, online, players & chat). Keep that corner, about 300 × 60 CSS pixels, free of your own buttons and text; players can drag the pill elsewhere, and gp.menu and the menu event give its exact corner and area (see Sweet's menu). |
events | Gameplay events you report with gp.event(name, value?). code is a unique integer 1–250. points is used by sum_points scoring; with per_value: true the event adds points × value. max_per_second is the fastest a real player can trigger it. |
scoring.mode | sum_points (score = sum of event points), count_event (number of scoring.event), max_value / last_value (largest / last value reported with scoring.event), custom (rules too complex to declare; the reviewer writes a validator), none (no recomputation; avoid if you want a trustworthy leaderboard). |
scoring.tolerance_abs, tolerance_pct | How far the claimed score may exceed the recomputed one (or fall below it for asc boards). Keep at 0 when your score is exactly the sum of events. |
leaderboard.order | desc: higher is better. asc: lower is better (e.g. fastest time; use score_format: "time_ms"). |
leaderboard.max_score, max_score_per_second | Hard limits. Claims above them are rejected. Set them from your game's actual rules, with some headroom. |
session.min_inputs_per_minute | The fewest real inputs per minute a human needs to score. Any input counts: presses, pointer movement and the wheel, so steering with the mouse or holding a key is playing. A run under 20 seconds only needs some input. A scoring run with less isn't ranked. Use 0 only for games that genuinely need no input. |
currency | Your game's own currency: name, plural, credits_per_unit (the conversion rate to Sweet Credits) and an optional icon. Recommended for every game that sells anything. See Game currency. |
items | Consumables, each with a price in your currency. See Items. |
memberships | Up to 3 monthly plans, each with a monthly price in your currency. See Memberships. |
multiplayer | Online play: room size, modes (casual or ranked), host model, reconnects, chat, paid unlocks. See Multiplayer. |
Integrating the SDK
1. Load the SDK before your game code
<script src="https://play.sweet.io/sdk/v1/gp-sdk.js"></script>
<script src="game.js" defer></script>
It must be the first script so it sees all input, and a plain tag: no async, defer or type="module" (the SDK identifies the platform from its own URL while loading). Don't copy it into your package; always load it from this URL. TypeScript types: /sdk/v1/gp-sdk.d.ts.
2. Initialise once
const gp = await GamePlatform.init();
gp.user; // { signedIn: true, username: "ada" } or { signedIn: false, username: null }
gp.items; // items from your manifest: price (your currency) and price_points (Credits)
gp.inventory; // { extra_life: 2 } for signed-in players, {} for guests
gp.currency; // { name: "Star", plural: "Stars", credits_per_unit: 5, custom: true }
gp.balance; // { units: 200, credits: 1000, currency: "Stars" } for signed-in players, null for guests
gp.menu; // { corner: "top-right", width: 300, height: 60 }: where Sweet's menu floats; keep it clear (#menu)
gp.on('menu', (m) => {}); // it moved or changed size: m.corner, m.width, m.height; once dragged also m.x, m.y, m.moved
3. One session per run
// when the player presses Play
const session = await gp.startSession({ consumables: wantsExtraLife ? ['extra_life'] : [] });
const lives = 3 + (session.consumables.includes('extra_life') ? 1 : 0); // apply only what was granted
// during play, whenever something score-relevant happens
gp.event('coin'); // adds 10 points under sum_points
gp.event('level', 4); // events can carry an integer value
// on game over (always, including quits)
const result = await gp.endSession({ score });
// result: { recorded, score, leaderboard_eligible, daily_rank, weekly_rank, all_time_rank, best_score }
- Call
endSessionexactly once for eachstartSession, with an integer score. - Report every scoring event with
gp.eventat the moment it happens. The score you submit must be what those events add up to under your scoring rule. - Don't record input yourself, and never generate synthetic input events (
dispatchEventof key or pointer events). Synthetic input causes the session to be rejected. - Use the granted
session.consumables, not what was requested; an item the player doesn't own isn't granted. - If
leaderboard_eligibleis false, show the score without a rank. The reason is deliberately not given (guests, unverified sessions and flagged players all look the same).
4. Optional platform features
await gp.showLeaderboard(); // platform panel; your game gets 'pause' then 'resume'
const board = await gp.getLeaderboard('weekly', 10); // 'daily', 'weekly' or 'all_time'; { entries: [{rank, username, score}], me, count }
await gp.purchase('extra_life', 1); // platform shows its own confirmation; rejects with code 'cancelled'
await gp.requestLogin(); // Sweet's sign-in: see "Sign-in and sign-up buttons"
gp.on('pause', () => game.pause()); // platform UI opened
gp.on('resume', () => game.resume());
gp.on('auth', (user) => updateMenu(user));
gp.on('inventory', (inv) => updateShop(inv));
gp.on('balance', (bal) => updateWallet(bal)); // shared balance changed (a spend in any game, a top-up)
Errors are GamePlatformError with a code: not_signed_in, cancelled, insufficient_balance, insufficient_inventory, rate_limited, session_active, no_session, timeout. Handle them without crashing; the game must stay playable.
Sign-in and sign-up buttons
Every player has one Sweet account for every game on Sweet. Your game can offer Sign in and Create account buttons; they open Sweet's own sign-in pages (the universal login), and the player comes back to your game signed in. Your game never sees a password or a token, and needs no login code, server or database.
Signed-in players get leaderboard ranks, keep the items and memberships they buy, and are the same player in every game. Guests can always play: put the buttons where an account helps (the title screen, game over, before a purchase), never in front of play.
Sweet's menu already shows who's playing, with their avatar and username, in every game, so your game doesn't need its own name or account tag. If it shows sign-in buttons or the username (in a lobby or on a results screen, for example), never put them in the menu's corner (gp.menu).
Without code
Mark elements with data attributes. The SDK handles the clicks, hides the buttons once the player is signed in, and fills in their name. It works for elements your game adds later too.
<div data-gp-signed-out>
<button data-gp-auth="signin">Sign in</button>
<button data-gp-auth="signup">Create account</button>
</div>
<p data-gp-signed-in hidden>Playing as <b data-gp-username></b></p>
| Attribute | What it does |
|---|---|
data-gp-auth="signin" | A click opens Sweet's sign-in page. Hidden while the player is signed in. |
data-gp-auth="signup" | A click opens Sweet's create-account page. Hidden while the player is signed in. |
data-gp-signed-out | Shown only to signed-out players (a "Save your score: sign in" banner). |
data-gp-signed-in | Shown only to signed-in players. Add hidden so it doesn't flash before the SDK starts. |
data-gp-username | Its text becomes the player's username. |
From code (canvas games, custom menus)
const gp = await GamePlatform.init();
if (!gp.isSignedIn()) drawButtons(['Sign in', 'Create account']);
onClick('Sign in', () => gp.requestLogin()); // Sweet's sign-in page
onClick('Create account', () => gp.requestSignup()); // same as requestLogin({ mode: 'signup' })
gp.on('auth', (user) => updateMenu(user)); // { signedIn: true, username: "ada" }
- The game reloads. Sweet's pages replace the game, then load it again signed in, so
requestLogin()doesn't resolve in the real platform. Save progress first (gp.progress.save(state), thenawait gp.progress.flush(); the guest's progress moves to their account), and don't call it during a session: finish withendSession()before. - When the player is already signed in,
requestLogin()resolves at once withgp.user. - Never build your own login form, ask for an email or password, link to another site's login, or store player identities: that fails review. Sweet's sign-in is the only one.
- Label the buttons in your game's own style; the words are up to you ("Sign in to save your score", "Join Sweet").
- Testing: in debug mode the player starts signed in. Open your game with
?gp_debug=1&gp_signed_out=1to start signed out; a sign-in button then signs in adebug-playerat once and firesauth. Test links from Creator Studio run in debug mode too.
Saved progress
Players come back to where they left off. gp.progress keeps each player's progress in your game (levels reached, unlocks earned, upgrades, settings, a story's place) as JSON, and gives it back next time, on any device. It's free on every plan and needs nothing in the manifest.
- Signed-in players keep it on their Sweet account: they continue on their phone where they stopped on their computer.
- Guests keep it on this device. When they create an account or sign in, it moves to the account (unless the account already has progress in your game, which wins). Sweet's menu reminds guests that only this device has it, and offers an account before they leave.
- Starting over: Sweet's menu has a Reset progress row for every game that saves, and your game must offer one too (below).
Load, save, reset
const gp = await GamePlatform.init();
// 1. At start, before the title screen: null for a new player
const saved = await gp.progress.load();
let state = saved ? saved.data : { v: 1, level: 1, unlocked: [], settings: { sound: true } };
// 2. At checkpoints: the whole state, every time (a level finished, an upgrade, a setting changed)
function checkpoint() { gp.progress.save(state).catch((err) => console.warn('save', err.code)); }
// 3. A "Reset progress" button, in settings or on the title screen
resetButton.onclick = async () => {
const { reset } = await gp.progress.reset(); // Sweet asks first: "All your progress will be lost"
if (reset) { state = { v: 1, level: 1, unlocked: [], settings: { sound: true } }; showTitleScreen(); }
};
// 4. Another device saved since this one loaded (rare: two devices at once): carry on from the newer progress
gp.on('progress_conflict', (current) => { state = current ? current.data : newGame(); showTitleScreen(); });
- Load once, at start, before showing the menu, and continue from it ("Continue" on the title screen when there's progress).
- New game starts over. When there's progress, a "New game" (or "Start over") button calls
gp.progress.reset()first, and starts the new game only once it resolves{ reset: true }; from then on, the new game's progress is what you save. Otherwise the old save stays, and Continue keeps taking the player back to their old game. Without progress, New game just starts. At the end of a run, offer Continue for the game in progress, not a silent restart from the beginning. - Save at checkpoints, not every frame. The SDK batches: at most one write every 10 seconds, the latest state wins, unchanged state isn't sent again, and what's pending goes out when the player leaves (the tab closes or hides, or Sweet's menu takes them elsewhere).
save()resolves once it's stored;gp.progress.flush()sends a pending save at once. - Save the whole state as one JSON value of at most 64 KB: progression, not a replay. Put a version number in it (
v: 1) so a later update of your game can read older saves. - Never put anything of value in it. The player's browser writes it, so a player can edit theirs. Items, memberships and the balance are Sweet's (
gp.inventory,gp.memberships,gp.balance); read them, never copy them into the save. The same goes for scores: the leaderboard takes them fromendSession(). - Offer Reset progress. A button (settings or title screen) that calls
gp.progress.reset(). Don't ask for confirmation yourself: Sweet shows its own warning, "All your progress will be lost" (it also tells the player their purchases stay on their account), and resolves{ reset: true }once it's gone or{ reset: false }if the player cancels. Then start from a new game. The checks warnprogress_no_resetwhen a game saves but never calls it. - Errors (
err.code):progress_too_large(over 64 KB),invalid_progress(not JSON),rate_limited(too many saves: the batching keeps you well under),progress_conflict(see 4 above;err.currenthas the newer save),storage_unavailable(a guest's browser keeps nothing, e.g. some private windows). - Testing: a test link (debug mode) keeps the progress in your browser, so it survives reloads;
reset()there resets at once and logs what Sweet would ask.
Designing for score verification
Leaderboards matter only if scores are real. When a session ends, the platform:
- checks a proof-of-work the host page computes during play (nothing for you to do);
- compares the server-measured session time with the trace and the score (
max_score,max_score_per_second,min_duration_ms); - checks the input trace looks human: real (trusted) events, enough of them (
min_inputs_per_minute), not superhumanly fast or metronomic, not replayed from an earlier session; - checks event rates (
max_per_second) and recomputes the score from your events usingscoring; - runs your game's validator, if the reviewer wrote one.
Rejected sessions still count as plays in your stats but never reach the leaderboard. A run that only breaks one of your limits (too short, too little input, scoring too fast) is simply not ranked. A player whose runs show tampering, or whose recent runs are mostly rejected as automated, is excluded from your game's leaderboards.
When several players fail the same score check on one version (a score your events don't add up to, a time longer than the run, a score outside your range, input your game dispatches itself), Sweet treats it as a problem in the game: those runs aren't ranked, nobody is excluded for it, and Creator Studio (and get_build_status for your AI) shows an alert saying what to fix.
Make your game easy to verify:
- Prefer a declarative
scoring.mode. Most games fitsum_points: give each scoring event its points, including combos (report acomboevent withper_value: trueand the bonus as the value). - For distance or level games use
max_valuewith an event likedistancereported periodically; for speedruns useascorder andlast_valueof afinishevent carrying the time in ms. - Also report the non-scoring events that explain the run (misses, deaths, level starts, power-ups). Reviewers use them to write tighter validators.
- Set honest limits. Too tight and real players get rejected; too loose and bots get through. The reviewer adjusts them, but your numbers are the starting point.
Multiplayer (online play)
Games can be played online: with friends in a private room they join with a code, with strangers through quick match, and in ranked modes where players earn a skill rating. Sweet runs the rooms on its own relay. Your game never opens a network connection: it calls gp.multiplayer, and the platform connects, seats the players, passes messages between them, moves the host when one leaves and reconnects dropped players. Online play comes with every paid plan (Builder, Studio and Titan), and it's the same on all of them: rooms of 2–16 players, private rooms, public rooms and quick match, ranked modes with skill ratings and a ranked board, and adjustable message limits.
Building and testing a multiplayer game is free on every plan, Spawn included; submitting it needs a paid plan.
How it works
- Rooms and seats. A room holds up to
max_playersplayers, each in a numbered seat (0–15) that stays theirs while they're in the room, also across reconnects. A room code is 6 characters, for exampleK7PQ2D. - Messages.
gp.multiplayer.send(data)sends any JSON value to everyone else, to the host, or to chosen seats. The platform stamps who sent each message, so nobody can speak for another seat. It never reads your data, but it does limit size and rate. Oversized messages and floods are dropped, and a client that keeps flooding is disconnected. - The host is a role, not a server. One player hosts: they start the match and, in host-run games, run the game for everyone. A host leaving never ends the game. If they leave on purpose, the player who has been in the room longest becomes host at once and receives the old host's last
checkpoint. If their connection drops, everyone hearshostwait. The host hashost_grace_secondsto come back; after that the host moves. An old host who returns later joins as a regular player and can't take the role back. - Reconnects are automatic. A dropped player's seat is held for
reconnect_seconds. The platform reconnects them into the same seat, even mid-match. - Results are decided by the players, not by the host. When a match ends, every player reports the result they saw with
reportResult. The result most players agree on counts.
Choose how your game shares the game state (authority in the manifest):
authority | How it works | Good for |
|---|---|---|
"shared" | Every player runs the same simulation from everyone's inputs: each player sends their own inputs or moves (send(input)), and every client applies them in the same order. No state lives on one player, so nothing is lost when anyone leaves. The host only starts matches. | Turn-based games, card and board games, deterministic lockstep games. Recommended for ranked modes: each player computes the result from what it saw itself, so a host can't fake it. |
"host" (default) | The host simulates the game. Players send inputs to the host (send(input, {to: 'host'})), and the host sends the state to everyone. The host must call checkpoint(state) regularly so the next host can carry on from it. | Real-time action, physics, co-op. In ranked modes, each client must check the host's state against the rules (no impossible jumps, scores change only with game events) and report the result it worked out itself, never one the host told it to report. |
The manifest's multiplayer section
"multiplayer": {
"max_players": 4,
"min_players": 2,
"authority": "host",
"modes": [
{ "key": "coop", "title": "Co-op", "description": "Survive the night together" },
{ "key": "duel", "title": "Ranked duel", "ranked": true, "max_players": 2, "min_match_seconds": 60 }
],
"join_in_progress": false,
"reconnect_seconds": 30,
"host_grace_seconds": 5,
"guests": true,
"chat": true,
"requires": { "host": "coop_pass" },
"min_inputs_per_minute": 4
}
| Field | Meaning |
|---|---|
max_players | Seats per room, 2–16. min_players (default 2) is how many a match needs; show "waiting for players" until then. |
authority | "host" or "shared"; see above. Reviewers check that a host-run game sends checkpoints and handles a new host. |
modes | 1–8 ways to play. key is 1–24 characters (a-z 0-9 _ -); quick match only pairs players in the same mode, the same game version and the same region. max_players on a mode makes its rooms smaller. ranked: true makes a ranked mode; min_match_seconds (default 30) is the shortest match that changes ratings. Without modes, the game has one casual mode, default. |
join_in_progress | Players may join a started match (never in ranked modes). Otherwise a room closes to newcomers at startMatch(). |
reconnect_seconds, host_grace_seconds | How long a dropped player's seat is held (2–120, default 30), and how long a dropped host has to return before the host moves (1–15, default 5). |
guests | Signed-out players may play online (default true). Ranked modes are always signed-in only. |
chat | The platform's text chat (default true): filtered, signed-in players only, 1 line a second. |
requires | Paid unlocks: host to open a room, join to join one. Each is the key of one of your items (the player owns at least one) or memberships. Guests can't own them, so they can't play the parts that need them. |
min_inputs_per_minute | Ranked: the fewest real inputs per minute a human needs in a match (default 2; any input counts; matches under 20 seconds aren't judged). A match with less isn't rated. |
limits | Rarely needed: msg_bytes (default 16 KB), host_msg_bytes (64 KB), messages_per_second (30), host_messages_per_second (60), bytes_per_second (64 KB), host_bytes_per_second (256 KB), checkpoint_bytes (64 KB). The platform's caps apply. |
Using gp.multiplayer
const gp = await GamePlatform.init();
const mp = gp.multiplayer; // mp.enabled is false for games without "multiplayer"
mp.modes; // [{ key, title, description, ranked, maxPlayers }]
mp.ranked; // { available, reason, message, until }: show message when !available
// --- the menu ----------------------------------------------------------------------------------
let room = await mp.quickMatch({ mode: 'coop' }); // strangers (the only way into ranked)
// or: room = await mp.createRoom({ mode: 'coop', visibility: 'private' }); friends: show them room.code
// or: room = await mp.joinRoom(codeTheyTyped);
if (mp.invite) room = await mp.joinRoom(mp.invite); // they opened an invite link: straight into that room
inviteButton.onclick = () => share(mp.inviteLink()); // https://play.sweet.io/@you/game?room=CODE, one tap for friends
// room: { code, mode, ranked, visibility, maxPlayers, started, match, hostSeat, mySeat, isHost, players }
mp.on('join', (player) => lobby.add(player)); // { seat, id, name, guest, connected, host, me }
mp.on('leave', ({ seat, reason }) => lobby.remove(seat)); // reason: left | expired | kicked
mp.on('away', ({ seat, ms }) => lobby.markAway(seat)); // reconnecting; seat held for ms
mp.on('back', ({ seat }) => lobby.markBack(seat));
// --- the match ---------------------------------------------------------------------------------
if (mp.isHost() && mp.room.players.length >= 2) mp.startMatch(); // host only
mp.on('start', ({ match }) => game.begin(match));
// messages: any JSON value; keep them small (inputs and changes, not the whole world every frame)
mp.send({ t: 'input', dx, dy, fire }, { to: 'host' }); // to: 'others' (default) | 'host' | seat | [seats]
mp.on('message', (data, fromSeat) => game.receive(data, fromSeat));
// host-run games: the host sends state and checkpoints; whoever hosts next carries on
if (mp.isHost()) {
mp.send({ t: 'state', world: game.snapshot() });
mp.checkpoint(game.fullState()); // at most every 400 ms; a few times a second is plenty
}
mp.on('hostwait', ({ ms }) => game.showBanner('Host reconnecting…'));
mp.on('host', ({ isMe, checkpoint }) => {
game.hideBanner();
if (isMe) game.takeOverAsHost(checkpoint); // you host now: resume from the last checkpoint
});
// --- the end -----------------------------------------------------------------------------------
// every player reports what it saw (seats, best first); the result most players agree on counts
const result = await mp.reportResult({ placements: [[2], [0, 3], [1]] }); // or { winners: [2] } or { ranking: [2, 0, 3, 1] }
mp.on('result', (r) => game.showResults(r.placements)); // also for players who reported late
if (mp.isHost()) mp.endMatch(); // back to the lobby for a rematch
await mp.leave(); // the menu's "Leave" button
mp.on('closed', ({ reason }) => game.toMenu(reason)); // empty | idle | lifetime | disabled | kicked
mp.on('connection', ({ state }) => game.showConnection(state)); // connecting | connected | reconnecting | lost
mp.on('error', ({ code, message }) => game.toast(message));
mp.showPlayers()opens the platform's own panel, with the chat and each player's Report and Vote to remove buttons, over your game (your game getspauseandresume). Add a button for it in your lobby and pause menu.mp.chat(text)sends a chat line from your own UI, andmp.on('chat', ...)shows lines in your game.mp.voteKick(seat): a majority of the other players removes a player.mp.kick(seat): the host of a private room removes a player. Public rooms always vote.mp.report(seat, reason, note)sends a report to Sweet's moderators with the room's recent chat.mp.listRooms({ mode })lists open public rooms near the player, for a lobby browser.mp.getRatings({ mode })returns a ranked mode's board and the player's own rating.reportResultresolves when most of the match's players still in the room have reported the same result. If a player leaves (or their seat expires) before reporting, the reports already in are counted again. In{ winners: [...] }the other places are the seats that started the match, including players who have left, so every player builds the same result.- Messages arrive in the order each player sent them. A message from a seat that just left can still arrive, so ignore anything from seats that aren't in
mp.room.players.
Ranked modes and fair ranking
A ranked mode gives every signed-in player a rating in that mode. Everyone starts at 1,200. A win against a stronger player earns more than a win against a weaker one, and new players' ratings move faster for their first matches so they find their level quickly. Players with more than two per match are rated by place: every player is compared with every other one, and team-mates or tied players don't move each other's ratings. After 5 rated matches a player appears on the mode's ranked board (mp.getRatings, and in the platform's leaderboard panel).
Sweet keeps ranked play fair with these rules. They aren't configurable, and you don't have to implement them:
- Nobody picks their opponent. Ranked rooms come only from
quickMatch, which pairs players of similar rating and widens the search the longer a room waits. Ranked rooms can't be created by hand or joined by code. - Signed-in players on the current version only. Guests, players on an older version (they're asked to reload) and players flagged in your game play the casual modes.
mp.ranked.reasonsays which applies:sign_in,update,cooldownorunavailable. - The host can't decide the result. The players' majority does. A started ranked match can't be decided by voting the leader out either: vote-kick is off once it starts (players can still report).
- Leaving is a loss. A player who leaves a started match, or whose connection doesn't come back in time, is placed last, whatever the result says, even if they were the host and winning. If everyone else leaves, the last players standing win: the platform reports the forfeit for you. Leaving ranked matches repeatedly pauses ranked play for that player: the first early exit in a day costs nothing, then 5 minutes, 30 minutes, 2 hours, then a day.
- Only human play counts. During every ranked match the platform runs a session for each player and checks its input like any scored run (real input, not scripted, not replayed, at least
min_inputs_per_minute), with proof of work as usual. A match with an automated player doesn't change anyone's rating, and that player is flagged. A player whose session never arrives can lose rating but not gain it. Don't callstartSession/endSessionduring a ranked match: the platform runs that session itself.gp.event(...)still works and is useful evidence. - No farming. Matches shorter than
min_match_secondsdon't count. Two players on the same network don't move each other's ratings (a second account can't feed the first). The same two players stop moving each other's ratings after 3 rated matches against each other in a day.
What your game does for a ranked mode:
- Every player calls
mp.reportResult(...)when the match ends, with placements it worked out from its own view of the game. A ranked mode withoutreportResultfails the automated checks. - Use
"shared"authority, or have clients check the host's state against the rules (see the table above). - Show
mp.ranked.messageinstead of the ranked button when ranked isn't available, and show ratings fromgetRatings. - Make matches decisive: a clear end (a score limit, a timer) and placements for everyone.
Rules for online play (reviewed)
- No networking of your own. No WebSocket, WebRTC, PeerJS, Socket.IO, Colyseus, Photon, Firebase or any other networking library or service. Bundling one fails the automated checks (
networking_library), and the content security policy blocks every connection anyway. An engine's built-in networking module that the game never uses is fine; say so in your release notes (it shows as anetwork_codewarning). - Treat every message as untrusted. Check its type, size and values before using it, and never run code from a message. Accept state only from the current host's seat (
fromSeat === mp.room.hostSeat), and inputs only for the sender's own character. - No chat of your own. Free text between players goes through
mp.chatonly: it's filtered, moderated and off for guests. Preset phrases, emotes and pings oversendare fine. - No personal data. Don't ask for or send names, emails, ages or locations. A player's
idis a pseudonym for your game, andnameis their public Sweet username. - Players can always leave. Keep a visible Leave button, and don't punish leaving in the game: the platform handles leavers.
- Survive the real world. The game must keep working when players drop and come back, when the host changes mid-match, when a player joins the lobby late, and for guests in casual modes.
- Small messages. Send inputs and changes, not the whole world every frame; 10–20 updates a second is plenty for most action games.
Testing online play
- Debug mode, in several tabs. Serve the game locally (or open its test link) in two or more tabs of the same browser. In debug mode the SDK connects them through a stand-in for the relay, so
quickMatch, rooms, messages, host moves, reconnects and results all work with no account and no network. Close the host's tab to see the next player take over. Ratings aren't kept in debug mode, butdebugReport()after a ranked match shows what the platform would check. - Invite links.
mp.inviteLink()is the link that opens your game straight into the room the player is in (ormp.inviteLink(code)for another): put it behind an “Invite friends” button, rather than asking friends to type the code. When someone opens one,mp.inviteholds its room code: join it once your menu is ready. Games that never readmp.invitestill work: the play page tells the player the code to enter, and its players panel has a “Copy invite link” button. In debug mode, add?room=CODEto the game's address to try it. - Check the integration. Play a full match in two tabs, leave as the host mid-match, drop a player (close the tab) and bring them back within
reconnect_seconds, and report results from every tab. - After publishing: new games start unlisted, so you and the reviewer can play them online together on the real relay before they're listed.
Errors
Calls reject, and mp.on('error') reports, a GamePlatformError whose message is ready to show the player:
code | Meaning |
|---|---|
not_available | The game has no multiplayer section, or online play is unavailable right now |
sign_in_required | Guests can't play this (ranked, guests: false, or a paid unlock): offer gp.requestLogin() |
not_entitled | Needs the unlock in requires: offer gp.purchase / gp.joinMembership |
room_not_found, room_full, room_started | Wrong or expired code, no free seat, match already running |
version_mismatch | That room plays another version of the game: reload to update |
ranked_quick_match, ranked_unavailable | Ranked modes are only reached by quickMatch; or ranked isn't available to this player (mp.ranked) |
kicked, already_in_room | Removed from that room; or the player is already in it in another tab |
multiplayer_disabled | Sweet switched online play off for the game (rare: an incident or a review) |
match_session | startSession was called during a ranked match, where the platform runs the session |
rate_limited, network | Too many attempts, or the connection failed: wait and retry |
Multiplayer statistics
GET /developer/games/{slug}/stats/multiplayer?days=30 shows rooms by mode and visibility (players, guests, host changes, average room time), matches by mode and outcome (recorded for casual, rated, unrated, void) with their average length, abandons, reports and signed-in online players. GET /developer/games/{slug}/ratings?mode=duel is the ranked board with player_refs. A high abandon count often points at a frustrating moment in the match, or rooms that wait too long to fill.
Game currency
Give your game its own currency. Players on Sweet hold one balance of Sweet Credits (1 Credit = $0.01, bought in packs: $10.00 = 1,000 Credits), and it's shared by every Sweet game. Your game doesn't sell Credits and doesn't hold a balance of its own: you name a currency that belongs to your game's world (Sprouts, Gems, Tokens, Stars…), set its conversion rate to Credits, and price everything in it. The platform does the translation.
Why define your own currency
- It belongs in your game. "120 Sprouts" for a seed pack in a garden game reads as part of the game; "240 Credits" reads like a store receipt. Players buy more readily in a currency that fits the world.
- You control the pricing feel. The rate sets the scale of your numbers: cheap-feeling games use a small rate and big numbers (500 Sprouts), premium-feeling ones a larger rate and small numbers (100 Gems).
- No accounting for you. The currency is display-only. Nothing is stored in it: there's no per-game balance to hold, sync, exchange or refund. Every purchase settles in Credits against the player's one shared balance, and Sweet (the merchant of record) handles cards, refunds and custody.
- Players arrive already funded. Credits a player bought in any Sweet game are spendable in yours the first time they open it, shown in your currency.
A game that declares no currency is priced in Credits directly (legacy price_points). That still works, but the automated checks warn about it, and reviewers will ask why.
How it works
"currency": { "name": "Sprout", "plural": "Sprouts", "credits_per_unit": 2 }
display_balance = wallet_credits ÷ credits_per_unit (rounded down)
spend_debit = price × credits_per_unit (in Credits)
The same player, with 1,000 Credits, in three games:
| Game | Currency | Rate | Player sees | A purchase | Debited |
|---|---|---|---|---|---|
| Garden Rush | Sprouts | 1 Sprout = 2 Credits | 1,000 ÷ 2 = 500 Sprouts | Mega Seed Pack, 120 Sprouts | 120 × 2 = 240 Credits ($2.40) |
| Cave Quest | Gems | 1 Gem = 10 Credits | 1,000 ÷ 10 = 100 Gems | Cave Club, 50 Gems / month | 50 × 10 = 500 Credits / month |
| Word Harbor | Tokens | 1 Token = 4 Credits | 1,000 ÷ 4 = 250 Tokens | (nothing bought) |
After those two purchases the player has 1,000 − 240 − 500 = 260 Credits, and every game shows it at once: 130 Sprouts, 26 Gems, 65 Tokens. Word Harbor did nothing to get that right.
Choosing the name and the rate
nameandplural: 1–24 characters, from your game's world. Don't call it Credits, Dollars, USD, Cents or Sweet: those are the platform's money.credits_per_unit: a whole number from 1 to 10,000. One unit costs that many Credits, so it's worthcredits_per_unitcents. Work backwards from what your cheapest and dearest things should cost in dollars and pick a rate that makes both prices round: a $0.50 power-up and a $3.00 membership are 25 and 150 Sprouts at 2, or 5 and 30 Gems at 10.- Prefer rates that divide common pack sizes (500, 1,000, 2,000, 5,000 Credits) evenly, such as 1, 2, 4, 5, 10, 20, 25, 50 or 100, so players see whole numbers after a top-up. The balance is rounded down; leftover Credits stay in the player's balance for other games.
- One price can't exceed 100,000 Credits (
price × credits_per_unit). icon(optional): a small square image in your package, shown next to prices.- The rate is reviewed with your prices. Changing it in a later version changes what every price costs in Credits from the moment that version is published; existing members renew at the new monthly cost.
Showing it in your game
const { name, plural } = gp.currency;
const amount = (n) => `${n.toLocaleString()} ${n === 1 ? name : plural}`;
shopLabel.textContent = `Seed pack · ${amount(gp.items[0].price)}`; // "Seed pack · 120 Sprouts"
walletLabel.textContent = gp.balance ? `You have ${amount(gp.balance.units)}` : 'Sign in to shop';
gp.on('balance', () => walletLabel.textContent = `You have ${amount(gp.balance.units)}`);
gp.balanceis for display. Never decide a purchase in the game: callgp.purchase/gp.joinMembership, and the platform shows its own confirmation (in your currency, with the Credits it costs), charges, and offers to add Credits when the player is short.- Your currency can't be earned through play, granted to players, or traded between them: it is only a view of the player's Credits. Gameplay rewards (coins you collect in a level, for example) are your game's own score or progress, and should use a different name from your currency to avoid confusion.
- In debug mode the player starts with 1,000 Credits, shown in your currency, and purchases spend them.
Items (consumables)
- Declare items in
items, each with apricein your game currency. A purchase ofquantityitems debitsprice × quantity × credits_per_unitCredits. Prices are confirmed or adjusted during review. - Players buy with
gp.purchase(key)(signed-in only; the platform confirms the purchase) and use items atstartSession({consumables}). - An item is consumed when the session starts, even if the run is abandoned. At most
max_per_sessionof each item are granted per session. - Item effects must be modest and must not make scores impossible to verify; describe them in
effect(informational) and indescription.
Validating your game
1. Local debug mode (no account needed)
Serve the game folder over HTTP and open it directly (not inside the platform). The SDK detects this and runs in debug mode: no network calls, a fake signed-in player with 3 of each item, and after each endSession it prints an integration report to the console and shows a badge in the corner.
cd my-game
python3 -m http.server 8080
# open http://localhost:8080/ (add ?gp_debug=1 to force debug mode inside other frames)
Play at least one full run with real input, then read the report in the console, or programmatically:
(await GamePlatform.init()).debugReport()
// { ok: true, problems: [], notes: [...], summary: { score, computed_score, events, inputs, ... } }
Multiplayer games: open the same address in two or more tabs to play online against yourself (see Testing online play).
The report applies the same declarative checks as the platform: score bounds and rate, recomputed score, event codes and rates, input requirements and synthetic input. Fix every problem before submitting. An assistant that can drive a browser should play a run itself and include the report; one that can't should ask you to play a run and paste the report.
2. Validate the manifest
curl -sS -X POST https://apigw.sweet.io/game-platform/developer/manifest/validate \
-H "Authorization: Bearer $GP_API_KEY" -H "Content-Type: application/json" \
--data @gp-manifest.json
# { "valid": true, "errors": [], "normalized": {...} }
3. Dry-run precheck of the package
Runs the automated package checks without submitting anything.
cd my-game && zip -r ../my-game.zip . -x '.*' && cd ..
curl -sS -X POST https://apigw.sweet.io/game-platform/developer/prechecks -H "Authorization: Bearer $GP_API_KEY"
# returns { "precheck_id": "...", "upload": { "url": ..., "fields": {...}, "curl": "..." } }
# run the returned upload.curl command (it ends with -F 'file=@game.zip'; point it at my-game.zip)
curl -sS https://apigw.sweet.io/game-platform/developer/prechecks/PRECHECK_ID -H "Authorization: Bearer $GP_API_KEY"
# poll until "status": "complete"; then read report.errors (must be empty) and report.warnings
Developer API basics
- Base URL:
https://apigw.sweet.io/game-platform - Authentication:
Authorization: Bearer gpk_...(an API key from API keys in Creator Studio, or an OAuth token of a connected AI tool). Keys have scopesgames:writeandstats:read. - Requests and responses are JSON. Dates are ISO 8601 UTC; date filters are
YYYY-MM-DD. - Errors: an HTTP status plus
{"error": {"code": "...", "message": "..."}}. Codes:invalid_request(400),forbidden(403),not_found(404),not_allowed(409, e.g. wrong status),rate_limited(429),internal_error(500). A 401{"message": "Unauthorized"}(from the gateway, not the error shape above) means the key is missing, revoked or expired.
| Method and path | Purpose |
|---|---|
GET /developer/me | Your handle, limits and the key's scopes |
POST /developer/manifest/validate | Validate a manifest (body: the manifest) |
POST /developer/prechecks, GET /developer/prechecks/{id} | Dry-run package checks |
GET /developer/games | Your games with status and latest version |
POST /developer/games | Register a game (reserves the slug) |
GET /developer/games/{slug} | Game, all versions and review history |
POST /developer/games/{slug}/versions | Create a version and get its upload form |
GET /developer/games/{slug}/versions/{version} | Version status, precheck report, reviewer notes |
POST /developer/games/{slug}/versions/{version}/withdraw | Withdraw a version that isn't published |
DELETE /developer/games/{slug} | Delete a game that was never submitted for review, with its versions, AI builds and previews; its slug becomes free. A game with a version that has been in review can't be deleted. GET /developer/games/{slug} says whether it can (deletion.allowed, deletion.reason). |
GET /developer/games/{slug}/stats and /stats/* | Statistics (see Statistics) |
GET /developer/games/{slug}/leaderboard | Leaderboard with pseudonymous player references |
GET /developer/games/{slug}/stats/multiplayer, GET /developer/games/{slug}/ratings | Online play statistics and ranked boards (see Multiplayer statistics) |
GET /developer/stats/overview | Headline numbers for all your games |
Memberships (monthly)
A membership is a monthly plan priced in your game currency and paid from the player's Credits (price × credits_per_unit each month; the example's 60 Stars at 5 is 300 Credits, $3.00). The platform charges the first month when they join, renews it from their balance every month, and ends it when they cancel (at the end of the month they paid for) or when their balance can't cover a renewal.
"memberships": [
{
"key": "gold_club",
"title": "Gold Club",
"description": "A golden basket and a badge on your menu, every game, for a month.",
"price": 60,
"perks": ["Golden basket skin", "Gold Club badge on the menu", "Supports the creator"],
"effect": {"type": "cosmetic", "value": "gold_basket"}
}
]
priceis per month, in your currency.perks(1–5 lines of up to 80 characters) are shown to the player before they join. Prices and perks are confirmed during review.- Ask the player to join with
gp.joinMembership(key): the platform shows the price and perks in its own dialog, charges the credits and offers to add credits when the balance is short. It rejects withcancelled,not_signed_inorinsufficient_balance. Players can also join from the ★ Membership row in Sweet's menu, and cancel or resume there or in their wallet. - Apply perks from
session.memberships(returned bystartSession(), re-checked by the platform at every session start), orgp.isMember(key)in menus.gp.membershipPlanslists the plans; themembershipsevent fires when they change. - Perks that change scoring must keep scores verifiable, like items; cosmetic perks are the safe default.
- Removing a plan from the manifest retires it: current members keep it until their month ends, and it doesn't renew.
Plans
Each creator has one plan, which covers all their games. Every plan publishes and monetizes, and every game can keep players' saved progress; plans differ in how many active games you can have, how much of every sale you keep and what comes with them: multiplayer on every paid plan (the same on Builder, Studio and Titan), priority reviews, the verified creator badge and early access to the asset library on Studio and Titan. Your first two games are free on Spawn, with no card needed. See the current plans under Plans and billing in Creator Studio.
| Plan | Price | Active games | You keep | Also included | Support |
|---|---|---|---|---|---|
| Spawn | $0/month | 2 | 75% of every sale | — | Community |
| Builder | $20/month | 5 | 80% | Multiplayer | Standard |
| Studio | $99/month | 25 | 85% | Multiplayer, priority reviews, verified badge, early access: asset library | Priority |
| Titan | $299/month | Unlimited (fair use) | 90% | Multiplayer, top-of-queue reviews, gold verified badge, early access: asset library and custom domains | Priority |
- Active games are limited, updates aren't. A game is active while it's live, or while a version is on its way through review. Drafts your AI builds don't count, and neither does a game whose only submissions were withdrawn, rejected or failed the automated checks. Updates to an active game never count against the plan.
- When the plan is full, submitting a new game (
POST /developer/games/{slug}/versions, or thesubmit_buildMCP tool) fails with409 not_allowedand a message that says how to make room. AI assistants: tell the creator to upgrade in Creator Studio; don't retry. - Every plan includes 5,000 monthly active players per game. Usage above that costs $5 per 1,000 players (or part of that) per game per month, deducted from that month's payout.
- How you earn. Players buy Credits from Sweet and spend them in your games. Each spend's dollar value (Credits × $0.01) is split when it happens, at your plan's share: a 240-Credit ($2.40) purchase on Builder adds $1.92 (80%) to your payout balance and Sweet keeps $0.48. Creator Studio shows your payout balance (what Sweet owes you, going up with every purchase) on the dashboard, in your account menu and under Plans and billing. It's separate from the Credits in your own wallet, which are for playing games: your earnings are paid in US dollars, not Credits.
- Monthly payouts. At the start of each month, last month closes into a statement: your earnings, minus any usage fee for players above the allowance, is paid out. Example on Builder: players spend $1,000 → you earn $800; with 8,000 active players in one game, the usage fee is 3 × $5 = $15, so the payout is $785. Your $20 plan fee is billed to your card separately. If a month's usage fee is more than its earnings, nothing is paid and the difference comes off the next payout.
- Your games stay live whatever happens to your plan. If you cancel, you keep the plan until the paid month ends, then move to Spawn. If a renewal payment fails, the plan keeps working for a grace period while you update your card, then you move to Spawn. With more active games than Spawn allows, you can't publish another until you're under the limit. A multiplayer game keeps its online play too, but on Spawn a new version of it can't be submitted with its
multiplayersection until you're on a paid plan again.
Submitting a game
This is the by-hand route, for packages you build yourself. If your AI is building from a Studio request, you don't need it: see Building with your AI. Ask the creator before steps 1 and 2.
1. Register the game (once)
curl -sS -X POST https://apigw.sweet.io/game-platform/developer/games \
-H "Authorization: Bearer $GP_API_KEY" -H "Content-Type: application/json" \
-d '{"slug": "coin-catcher", "title": "Coin Catcher", "short_description": "Slide the basket to catch falling coins.", "category": "arcade"}'
2. Create a version and upload the package
curl -sS -X POST https://apigw.sweet.io/game-platform/developer/games/coin-catcher/versions \
-H "Authorization: Bearer $GP_API_KEY" -H "Content-Type: application/json" \
-d '{"version": "1.0.0", "release_notes": "First release"}'
# response.upload: { "url", "fields", "max_bytes", "expires_in_seconds", "curl" }
# Upload with a multipart POST: every field from upload.fields, then the file as the LAST field "file".
# upload.curl is that command, ready to run (replace game.zip with your zip path).
# The upload answers 204 No Content on success.
The upload is the submission: automated checks start immediately. gp-manifest.json in the zip must have the same slug and version. Only one version per game can be in progress; to replace one that's waiting, withdraw it first. Upload links expire after an hour; GET the version again for a fresh one while it's awaiting_upload.
3. Follow the status
curl -sS https://apigw.sweet.io/game-platform/developer/games/coin-catcher/versions/1.0.0 -H "Authorization: Bearer $GP_API_KEY"
| status | Meaning and what to do |
|---|---|
awaiting_upload | Upload the zip. |
prechecking | Automated checks running (seconds). Poll again. |
precheck_failed | Read precheck_report.errors, fix and submit again; you can keep the same version number. |
in_review | Queued for security and integration review. Poll occasionally (e.g. hourly); review time varies. |
changes_requested | Read developer_notes, fix and submit again; you can keep the same version number. |
approved | Reviewed and staged; publishing is next. |
published | Live at https://play.sweet.io/@{handle}/{slug}. New games may start unlisted (playable by link) while the reviewer play-tests, then become listed in the catalog. |
superseded | Replaced by a newer published version. |
rejected / withdrawn | Closed. Rejections include developer_notes. |
Updates
Submit a new version with a higher version number; the current version stays live until the update is published. Leaderboards and stats carry over. Changing scoring rules between versions can make old and new scores incomparable; say so in release_notes so the reviewer can decide whether boards need a reset.
Review and release
Reviewers (an automated review agent, with people behind it) check every version for malicious or unsafe code, content and licensing issues, and correct SDK integration. To integrate your game they may:
- adjust manifest limits (
max_score, rates, input requirements, item prices); - write a server-side validator that checks your game's specific rules against the event trace;
- make minimal changes to the package needed for platform integration (removing stray files, fixing the SDK tag). They don't change gameplay; if more is needed they request changes.
Multiplayer games are also played online by the reviewer, who checks the online play rules: what each message can do, what happens when the host leaves or drops, how results are worked out in ranked modes, and that there's no chat or networking of the game's own.
Reviewers don't disclose the exact anti-cheat thresholds they set. If honest players' scores are rejected, contact support with the session IDs from your session stats.
Retrieving your games
# everything you own, any status
curl -sS https://apigw.sweet.io/game-platform/developer/games -H "Authorization: Bearer $GP_API_KEY"
# one game, with versions and review history
curl -sS https://apigw.sweet.io/game-platform/developer/games/coin-catcher -H "Authorization: Bearer $GP_API_KEY"
# public (no key): a creator's published, listed games, and the catalog filtered by creator
curl -sS https://apigw.sweet.io/game-platform/creators/your-handle
curl -sS "https://apigw.sweet.io/game-platform/games?creator=your-handle&sort=popular"
curl -sS https://apigw.sweet.io/game-platform/games/coin-catcher
Public catalog parameters: sort = popular (plays in the last 7 days) | new | title; category; creator (handle); limit (max 100); offset (max 100,000, on every list that pages). Public pages: https://play.sweet.io/creators/{handle}.
Statistics
All stats endpoints need the stats:read scope and only return data for games you own. Daily figures are rolled up every 15 minutes (UTC days). Players are identified by player_ref, a stable pseudonymous ID per game, plus their public username; platform user IDs and contact details are never shared.
| Endpoint | Parameters | Returns |
|---|---|---|
GET /developer/stats/overview | days (1–92, default 30) | Per game: sessions_started, sessions_completed, player_days, new_players, total_play_ms, points_spent, max_score, status, live version |
GET /developer/games/{slug}/stats | from, to (YYYY-MM-DD, max 92 days, default last 30) | totals, daily[] and all_time (below) |
GET /developer/games/{slug}/stats/players | sort = best_score | plays | play_time | recent; limit ≤ 200; offset | Per player: player_ref, username, plays, accepted_plays, rejected_plays, total_play_ms, best_score, first_played_at, last_played_at, flagged |
GET /developer/games/{slug}/stats/scores | from, to, bins (2–100) | Accepted-score histogram (bins[] of from/to/count), min, max, percentiles p50/p90/p99 |
GET /developer/games/{slug}/stats/sessions | limit ≤ 200, before_id (paging), verdict = accepted | rejected | unverified | Recent sessions: session_id, player_ref, username, anonymous, started_at, duration_ms, claimed_score, score, verdict, reject_reason, risk_score, input_count, consumables; next_before_id |
GET /developer/games/{slug}/stats/items | from, to | Per item: purchases, quantity, points_spent, buyers, consumed |
GET /developer/games/{slug}/leaderboard | period = daily | weekly | all_time, limit, offset | entries[] of rank, username, score, player_ref; count |
GET /developer/games/{slug}/stats/multiplayer | days (1–90, default 30) | rooms[] by mode and visibility (rooms, matches, players, guests, host_changes, avg_room_seconds), matches[] by mode and status (recorded, rated, unrated, void; avg_match_seconds), abandons, reports, signed_in_players |
GET /developer/games/{slug}/ratings | mode (a ranked mode), limit, offset | entries[] of rank, username, rating, games, wins, player_ref; count |
Fields in /stats
| Field | Meaning |
|---|---|
sessions_started | Runs started (signed-in and guest), the main popularity measure |
anon_sessions_started | Runs started by guests |
sessions_completed, completion_rate | Runs that called endSession, and completed ÷ started |
sessions_rejected, rejection_rate | Completed runs that failed verification. A high rate with real players usually means limits are too tight or events are missing. |
unique_players, new_players, returning_players | Distinct signed-in players in the range, first-time players, and players who'd played before the range |
anon_unique_players | Distinct guest browsers |
total_play_ms, avg_session_ms | Playing time (server-measured) |
avg_score, min_score, max_score | Over accepted runs |
items_purchased, points_spent, items_consumed | Item economy |
all_time.players, all_time.plays, all_time.play_ms, all_time.flagged | Lifetime totals for signed-in players |
Summarising performance (prompt for your assistant)
Using my API key in GP_API_KEY and the creator guide at https://play.sweet.io/docs/creators#stats:
1. GET /developer/stats/overview?days=30 and list my games by sessions_started.
2. For each live game: GET /stats for the last 30 days, /stats/scores, /stats/players?sort=plays&limit=20
and /stats/items.
3. Summarise per game: popularity trend (daily sessions_started), players (unique, new, returning),
average session length, completion and rejection rates, score distribution, top players, item sales.
4. Flag anything that needs action: rejection_rate above 5% (ask support with session IDs from
/stats/sessions?verdict=rejected), completion_rate below 50%, falling plays.
Performance report
GET /developer/reports/performance?period=this_week[&game={slug}] answers "how are my games doing?" in one call: per game and in total, plays, signed-in players, new players, minutes played, items sold and credits earned from items and memberships, each compared with the period before (like for like: this week so far against the same days last week), plus a ready-to-use summary. period is one of today, yesterday, this_week, last_week, last_7_days, last_30_days, this_month, last_month (UTC; weeks start Monday).
Connecting an AI tool (MCP)
Creators can connect Claude Code, Codex, Copilot, Cursor, Claude, ChatGPT, Gemini or any MCP client to their account. Connected tools can build the games the creator describes (chat apps that can't run commands send the files through the server) and answer questions in plain language ("How are my Sweet games performing this week?").
- Server URL:
https://studio.sweet.io/mcp(remote MCP, Streamable HTTP). Step-by-step instructions per tool are on the Studio's AI tools page. - Sign-in: OAuth 2.1 with PKCE and dynamic client registration; the tool discovers it from
https://studio.sweet.io/.well-known/oauth-protected-resource/mcp. The creator approves on a Sweet page and can disconnect the tool any time on the AI tools page. An API key also works as a bearer token for tools without OAuth (stats:readfor reports,games:writefor builds and submitting). - Reporting tools (read-only,
stats:read):performance_report,list_games,game_daily_stats,top_players,item_sales,review_status. - Build tools (
games:write):start_game_build,revise_build,list_builds,next_build_request,claim_build_request,report_build_progress,create_build_upload,save_build_filesandread_build_files(for tools that can't run commands),get_build_status,fail_build_request. See Steps for AI tools. Prompts:new_game,build_next_game. - The guide as text (any connection):
get_build_guide, and MCP resources for this guide, the manifest schema, the SDK types and the reference game's files, under their own URLs. - Publishing (
games:publish):submit_build, only when the creator tells you to. - OAuth access tokens also work on the developer API, with the permissions the creator approved (
stats:read, optionallygames:writeandgames:publish). Submitting a version, withdrawing one and deleting a game needgames:publishas well asgames:writefor an AI tool; without it they answer403 forbidden, and the creator does them in Creator Studio.
Troubleshooting
| Symptom | Fix |
|---|---|
| Game shows a blank frame on the platform | Absolute paths (/assets/...) or external resources. Use relative paths and bundle everything. Check the browser console for CSP errors. |
GamePlatform.init() times out on the platform | The SDK script tag must be exactly https://play.sweet.io/sdk/v1/gp-sdk.js and load before your code. |
| Debug report: "claimed score ... but the event trace supports ..." | An event is missing, has the wrong points, or the score is computed differently from the manifest. Make every score change correspond to a gp.event. |
| Debug report: "synthetic input events" | Your code (or a library such as a virtual joystick) dispatches key or pointer events. Call your game's handlers directly instead. |
| Debug report: "only N inputs" or "no input in a scoring run" | Lower min_inputs_per_minute to what the game really needs, or check that input reaches the window (the SDK listens on window in the capture phase). A run that scores with no input at all is never ranked: if your game plays itself after one tap, start the session from that tap. |
Precheck: external_resource / external_network | Remove CDN links and remote fetches; download the files into the package. |
Precheck warning: eval | A library uses dynamic code; it'll fail under the platform's policy. Use a build without it, or confirm it falls back gracefully. |
| Build stays on "Waiting for your AI" | Your AI tool only works while it's open. Send it the line the Studio shows, or in Claude Code keep it listening with /loop 2m and the same line. |
| AI tool says "this connection can't build games" | It was connected for reports only. Disconnect it on the AI tools page, connect again and allow Create games and submit builds. |
| Submit is refused: another version is still being processed | An earlier version of the game is in review. Wait for the result, or withdraw it on the game's Builds tab, then click Submit again. |
Precheck: networking_library | The package bundles a networking library. Remove it and send messages with gp.multiplayer.send. |
Precheck: ranked_without_result | A ranked mode needs every player to call gp.multiplayer.reportResult(...) at the end of each match. |
Precheck or submit: multiplayer_plan | Online play needs a paid plan (Builder, Studio or Titan), and the creator is on Spawn. Upgrade under Plans and billing, or remove the manifest's multiplayer section. |
| The game freezes when the host leaves | Handle mp.on('host', ...): when isMe, carry on as host from checkpoint. Host-run games must call mp.checkpoint(state) during the match. |
| Ranked button does nothing for some players | Read mp.ranked: guests, players on an old version, players in a leaver cooldown and flagged players can't play ranked. Show mp.ranked.message. |
not_allowed when creating a version | Another version is still in progress (withdraw it), or the version number isn't higher than every earlier one. |
Machine-readable resources
- /llms.txt: short index for language models
- /schema/gp-manifest.schema.json: manifest JSON Schema
- /sdk/v1/gp-sdk.d.ts: SDK TypeScript definitions (including
gp.multiplayer) - /sdk/v1/gp-sdk.js: SDK source (readable, not minified)
- /examples/coin-catcher/: complete reference game (game.js, gp-manifest.json)