Install & set up a project
You need Node.js 18+ and npm. vgai targets modern browsers with WebGL2.
Scaffold a project
Section titled “Scaffold a project”npx create-vgai-project my-gamecd my-gameThe scaffolder copies the starter template (the full example project) — or pass a
flag for a minimal empty template — rewrites package.json, tsconfig.json,
vite.config.ts, and project.json for your project name, and runs npm install for you.
npm i -g @vgai/cli # or: npm link from packages/vgai-clivgai create my-game --template starterThe CLI’s create command scaffolds the same project and can also drive a running editor
(open scenes, start/stop play mode, focus entities, toggle panels). See
Tooling & Publishing.
Templates
Section titled “Templates”| Template | Contents |
|---|---|
starter (default) | The full template project: example games, shared UI, a Colyseus server. The fastest way to learn by reading working code. |
empty | Minimal: one .vscn.json, a src/main.ts, and base config. For starting clean. |
Run the editor
Section titled “Run the editor”- From your project directory, start the dev server:
Terminal window npm run dev - Open the editor at http://localhost:5173.
- You should see the 3D viewport with the default scene. If it loads, your toolchain is working.
Useful commands
Section titled “Useful commands”| Command | What it does |
|---|---|
npm run dev | Editor dev server on http://localhost:5173. |
npm run build | Type-check + production build. |
npm run typecheck | Type-check engine, editor, and server code. |
npm run test:unit | Vitest unit tests. |
npm run test:e2e | Playwright end-to-end suite. |
npm run validate-scenes | Validate .vscn.json files against the component registry. |
- First look at the editor — a tour of the UI.
- Foundations — write your first
GameComponent.