# TipTap Games — SDK Guide for AI Agents You are building a single-file HTML5 game for **TipTap Games** (https://tiptapgames.com), a vertical swipe feed of instantly-playable browser games. This document is the complete specification. Everything you need is here — do not guess at the API and do not fetch anything else. **Output requirement:** one self-contained `.html` file. All CSS and JavaScript inline. No build step, no bundler, no dependencies. --- ## 1. Hard constraints — violating these silently breaks the game Games run in a cross-origin iframe with `sandbox="allow-scripts"` and a strict CSP. The document has an **opaque origin**. These are not style preferences; each one fails silently or throws at runtime. | Forbidden | Why | |---|---| | `fetch()`, `XMLHttpRequest`, `WebSocket`, `EventSource` | `connect-src 'none'` — every network call is blocked | | ` ``` --- ## 4. Game design expectations - **Instant.** Playable within ~2 seconds. No splash screen, no menu, no "press start" unless the game truly needs one. The player is mid-scroll. - **Vertical/portrait first.** Most play happens on a phone in a feed. Handle resize and make the canvas fill its container. - **Touch and keyboard.** Both, wherever it makes sense. - **Dark background** (`#0f0f0f`, `#111827` or similar) — it sits on a dark feed. - **Score always visible**, top-centre or top-left. - **Short runs.** 30–90 seconds is the sweet spot for a feed. - **A real game-over.** Every terminal state must call `submitScore()`. --- ## 5. Testing before upload Open your `.html` directly in a browser. `window.TipTap` will be absent — the shim in the template keeps it running. To exercise the real SDK, add this during development only: ```html ``` Remove it before uploading. (Leaving it in is harmless — the platform's CSP blocks external scripts and the injected SDK is idempotent — but it does nothing.) --- ## 6. Pre-flight checklist Before you hand the file over, verify every line: - [ ] Single `.html` file, all CSS/JS inline, no external references of any kind - [ ] No `fetch`, `XMLHttpRequest`, `WebSocket`, `localStorage`, `sessionStorage`, cookies - [ ] Every `window.TipTap` use is feature-detected - [ ] `updateScore()` called as the score changes - [ ] `submitScore()` called at **every** terminal state - [ ] `showLeaderboard()` called after `submitScore()` at a real game-over — **`submitScore` alone shows the player nothing** - [ ] All audio gated on `canPlayAudio()`, re-checked on `tiptap:focus` / `tiptap:blur` / `tiptap:mutechange` - [ ] Game loop stops on `tiptap:pause` and restarts on `tiptap:resume` - [ ] `onLeaderboardClose` handled — the game was **not** reloaded - [ ] Canvas resizes correctly; playable in portrait on a phone - [ ] Playable within ~2 seconds of load - [ ] If you used `getPlayer`: the screen still reads correctly with `handle`, `displayName` **and** `avatarDataUrl` all null — that is the signed-out majority - [ ] If you used `share`: it is behind a button the player presses, not fired automatically, and any `imageDataUrl` is under 2 MB --- Full human-readable docs: https://tiptapgames.com/docs/sdk Upload: https://tiptapgames.com/create/upload Building through TipTap's MCP server rather than handing the file over yourself? https://tiptapgames.com/llms-full.txt is this document plus the complete tool reference, the build workflow, the validation error codes and the prompt cookbook.