### Create and install the example project Source: https://wiki.spawnite.com/learn/your-first-game Run this command to create a new project from the example template and install its npm dependencies. The install requires no token because packages come from npm. To use a different theme, add `--theme slate` to the create command. ```bash npx @spawnite/cli create my-game --template example cd my-game && npm install ``` -------------------------------- ### Install and run Spawnite example simulation Source: https://wiki.spawnite.com/learn/for-evaluating-agents Requires Node 24.2 or later and npm. Creates a game from the example template, installs dependencies, and runs the example's run scene for five seconds of game time with no window. Output starts with 'Stepped 300 steps.' and a hash, and the dump shows 3 coins in the wallet. ```bash npx @spawnite/cli create my-game --template example cd my-game npm install npx spawnite simulate --scene run --seconds 5 --keys w --fields wallet ``` -------------------------------- ### Create a game from the example template and install packages Source: https://wiki.spawnite.com/learn/install Run these commands in the folder where you keep your projects. `npx @spawnite/cli create my-game --template example` creates a game from the example template, `cd my-game` moves into it, and `npm install` installs the engine and dependencies. The `--template` flag can be changed to other templates listed by `npx @spawnite/cli list`. ```bash npx @spawnite/cli create my-game --template example cd my-game npm install ``` -------------------------------- ### Game code file list example Source: https://wiki.spawnite.com/platform/publishing Example output from `spawnite build` showing the heaviest files a player downloads before the game starts, with gzipped sizes and source packages. The example keeps three of 26 listed files. ```text Game code: 32 KB gzipped Files a player downloads before the game starts, gzipped bytes, heaviest first: 122,856 release @spawnite/engine.js: @pixiv/three-vrm-animation, @spawnite/assets, @spawnite/engine, framer-motion, react-error-boundary 100,768 release chunks/three.core-BoJD7UsQ.js: three ... 20,348 page assets/index-tgKY-7nf.js ... and 68 smaller files, 86,181 bytes ``` -------------------------------- ### Run Holdfast locally Source: https://wiki.spawnite.com/games/holdfast Commands to create a copy of Holdfast, install dependencies, and start a local room. `spawnite play start` starts a room beside the dev server and opens the game; `--pages 2` opens a second warden's page, and `--bots 3` adds three bots. ```bash npx @spawnite/cli create my-holdfast --template holdfast cd my-holdfast pnpm install spawnite play start ``` -------------------------------- ### spawnite play start --device and touch input Source: https://wiki.spawnite.com/engine/testing/director Start a session with a device emulation and simulate touch input. The device name must be one Playwright recognizes, such as "Pixel 7" or "iPhone 15". The page takes the device's screen size, pixel ratio, touch screen, and coarse pointer. The example shows starting as a Pixel 7 and then holding, moving, and releasing a touch point. ```bash spawnite play start --device "Pixel 7" spawnite play hold Touch1 --at 150,250 spawnite play move Touch1 --by 120,0 spawnite play release Touch1 ``` -------------------------------- ### defineGame example Source: https://wiki.spawnite.com/reference/game/definegame Example of defining a game with defineGame, including name, start scene, room, worlds, and plugins. ```typescript export const game = defineGame({ name: "three-mmorpg", start: "meadow", room: defineRoom(), worlds: true, plugins: [characters(), stats(), resources()], }); ``` -------------------------------- ### Install uv on Windows Source: https://wiki.spawnite.com/learn/blender Install uv, which runs the server, on Windows. ```bash winget install astral-sh.uv ``` -------------------------------- ### Install uv on Linux Source: https://wiki.spawnite.com/learn/blender Install uv, which runs the server, on Linux. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### useTextChat example: render messages Source: https://wiki.spawnite.com/reference/text_chat/usetextchat Example usage of useTextChat to get messages and send function, then render each message as a paragraph element. ```jsx const { messages, send } = useTextChat(); return messages.map((message) =>
{message.text}
); ``` -------------------------------- ### Install game dependencies Source: https://wiki.spawnite.com/learn/agent-checklist The create command ends with the install command for the game's package manager, such as 'npm install'. Run it in the game's folder. ```bash npm install ``` -------------------------------- ### Publish command output example Source: https://wiki.spawnite.com/platform/publishing Example output from the spawnite publish command, showing the build report, uploaded version, and the game's link and state. ```text Built the bundle at dist/bundle: engine 0.1.0, game code 146 KB gzipped. Uploaded version 3: 41 files, checked. Published version 3 of Tower Defense, game 48201973. Players load it within a minute. Link: https://spawnite.com/games/tower-defense/48201973?k=pT3xR9sYw2KqLmN8vB4cZa Live version: 3 State: unlisted, not on the store. Only people with the link can play. To put it on the store, send a store page with spawnite store upload, then run spawnite visibility public ``` -------------------------------- ### Set starting quality levels per device class Source: https://wiki.spawnite.com/engine/ui/graphics-quality Use the `quality.start` map to set the starting quality level for specific device classes. Classes not listed start at the engine's default level. This example sets `GraphicsCardLargeScreen` to High and `Touch` to Minimum. ```tsx import { defineGame, DeviceClass, Game, QualityLevel } from "@spawnite/engine"; const game = defineGame({ name: "bladebound", start: "lobby" });