Phaser and PixiJS: a new project in a minute
Phaser 3 and PixiJS 8 games have a project generator: Vite, TypeScript, the SDK wired in and a ready game kit — lifecycle, saves, leaderboard, ru/en texts.
Create a project
Before the npm release.
create-instaplay-game,@instaplay/sdkandinstaplayare not in the public npm registry yet:npm create instaplay-gamereturnsE404, and the generator without the--sdk/--cliflags warns thatnpm installwill not find them. Until then the InstaPlay team sends the package archives (.tgz) on request via support (topic “Other”):npx --package ./create-instaplay-game-<version>.tgz create-instaplay-game my-game --sdk file:<path>/instaplay-sdk-<version>.tgz --cli file:<path>/instaplay-cli-<version>.tgz. A Phaser or Pixi game works without the archives too — your own project: the SDK via the/_ip/sdk/v1.jstag, the build uploaded in the dashboard.
npm create instaplay-game@latest my-game -- --template phaser # or --template pixi
cd my-game
npm install
npx playwright-core install chromium # the browser for npm run test — once per machine
npm run dev # http://localhost:5173 — the game, SDK in local mode
npm run build # build → dist/
npm run portal # the portal emulator with the real SDK bridge (http://localhost:4300)
npm run test # portal-like autotest: headless Chromium, desktop and mobile
npm run check # metadata and build threshold without network (publish checks category and tags)
npm run release # publish (instaplay publish)
Generator flags: --template phaser|pixi, --dir <path>, --title-ru, --title-en,
--sdk <@instaplay/sdk version> and --cli <instaplay version> (default ^1.0.0). The project's
devDependencies include the instaplay CLI and playwright-core (for npm run test).
Replace the texts before publishing. The generator puts the project name into the game title (or
--title-ru/--title-en), while the description, “how to play” and FAQ stay from the
“Catch a star” template and the cover is a placeholder. Rewrite texts in instaplay.json and replace media/cover.png:
moderation rejects a description of another game (misleading_meta, Moderation). The
slug in instaplay.json is the game address: if the game already exists in the dashboard, use its
“Game address” (Dashboard).
What is inside
| Path | What |
|---|---|
src/ |
the “Catch a star” game template — an example of the whole SDK v1 contract |
src/game-kit/ |
the kit: lifecycle, saves with a schema, leaderboard, ru/en |
vite-plugin-instaplay.mjs |
serves the SDK at /_ip/sdk/v1.js in vite dev |
instaplay.json |
ru/en texts, category, tags, the main leaderboard |
media/cover.png |
a 1280×720 placeholder cover — replace it with yours |
smoke.mjs |
an autotest scenario for instaplay test --script |
The instaplay CLI is a devDependency of the project: the scripts take it from node_modules. Do not
run npx instaplay in a folder without installed dependencies — npx would download the package from
the registry. Template build rules: base: './' in Vite, the SDK via the /_ip/sdk/v1.js tag, an
initial download of up to 20 MB.
Your own Phaser or Pixi project
The generator is optional. In an existing project:
- Include the SDK with
<script src="/_ip/sdk/v1.js"></script>inindex.htmlor as the@instaplay/sdkpackage (import InstaPlay from '@instaplay/sdk'). - Call
InstaPlay.init()before loading assets,InstaPlay.loading.progress()while loading (in Phaser — theprogressevent ofthis.load),InstaPlay.ready()when the game accepts input. gameplay.start()/gameplay.stop()— start and end of a round; pause and sound — on portal events (events).- Build (
vite build), check withinstaplay test ./distand upload (Uploading a build).
The portal emulator can point straight at the Vite dev server — with hot reload and the production
CSP: npx instaplay dev --url http://localhost:5173/ (CLI). A game with its own server
needs the game network and the player token. Sign-in from the game (SDK 1.4) is a
direct InstaPlay.player.login() call in a button press handler (Player and sign-in).
Method details — SDK and the SDK quick start.