Vai al contenuto
InstaPlay
Sezioni della documentazione SDK

Game template with the SDK

Templates are a working game skeleton with the SDK already wired. The create-instaplay-game generator creates a new project (Vite, TypeScript, Phaser 3 or PixiJS 8):

npm create instaplay-game@latest my-game -- --template pixi   # or --template phaser
cd my-game && npm install
npx playwright-core install chromium   # the autotest browser — once per machine
npm run dev                            # the game locally, SDK in local mode
npm run build && npm run test          # build and a portal-like autotest (desktop and mobile)
npm run check                          # metadata and build threshold

The packages are not on npm yet — how to install them before the release, all project scripts and generator flags are in the guide: Phaser and PixiJS. The game-kit lives inside the project (src/game-kit/) — it is part of your game, change it as needed.

game-kit

Module What it does
createGameShell({ engine }) init, loader progress → loading.progress, ready after the first frame, gameplay.start/stop by scene, pause → ticker, mute → sound
defineSave({ key, version, defaults, migrate }) a save schema with a version and migrations on top of saves.get and saves.set; load() → status (restored, fresh, unknown, foreign, stale) and confirmed; onStale(cb) — the cloud won, call load() again
submitBest(board, value) submits a score only when it beats the local best
i18n ru/en texts by the locale from init

Build rules

  • Vite with base: './' (the game lives under /<hash>/), the SDK — <script src="/_ip/sdk/v1.js">.
  • No external requests: fonts and sounds are part of the build.
  • Initial download ≤ 20 MB, pause stops the ticker and sound, orientation is set in instaplay.json.
  • The category and tags in instaplay.json come only from the reference list (the "Publishing" page); instaplay check validates them against the API (M03) before publish. The instaplay.json texts after the generator come from the “Catch a star” template: replace them with your own before publishing.