Skip to content

Install & set up a project

You need Node.js 22+ and npm. VGAI targets modern browsers with WebGL2.

A game built with vgai is a standalone project — its own folder — that you scaffold with the vgai CLI and then author in the visual editor. It does not belong inside the VGAI engine repository or its examples/ directory. The generated project installs versioned public packages while keeping engine TypeScript readable in node_modules/@vgai/engine/src.

  1. From the directory that should contain your new game, run:
    Terminal window
    npx @vgai/cli@latest create my-game
  2. The command creates and installs ./my-game, starts its visual editor, and prints the exact editor URL. Leave it running while you or an agent builds.
  3. Later, reopen the same project with:
    Terminal window
    cd my-game
    npm run dev

No global install or engine checkout is required. For repeated use, installing @vgai/cli globally is optional.

Terminal window
npx @vgai/cli@latest create my-game # Three.js + React roots
npx @vgai/cli@latest create my-game --template 2d # PixiJS + React roots
npx @vgai/cli@latest create my-game --template react # React-only
npx @vgai/cli@latest create my-game --example fps # editable example copy

Use --no-edit only for automation where no person may be watching. The single public create command is npx @vgai/cli@latest create; add --no-edit when a scripted workflow deliberately does not need an editor session.

TemplateContents
defaultA Three.js scene root plus a React UI root.
2dA PixiJS scene root plus a React UI root.
reactA React-only game, ideal for DOM games.
  1. Open Claude Code, Codex, Copilot, Cursor, or another coding agent in the generated game folder and describe the outcome once.
  2. The project includes compact AGENTS.md/CLAUDE.md instructions, progressively loaded skills, and .mcp.json. Compatible hosts can start the project-scoped VGAI MCP server without a separate plugin install.
  3. The agent should keep the matching editor visible, enter Play, check status/logs, and capture evidence before claiming the game works.

To start the MCP server manually from the project folder:

Terminal window
npx @vgai/cli@latest mcp .

The same editor remains the normal authoring surface:

  1. Launch or reuse it:
    Terminal window
    npm run dev
  2. Use the viewport, hierarchy, inspector, and Play mode. The printed URL is authoritative because VGAI may choose another port when one is occupied.
  3. A connected Play acknowledgement plus a rendered frame verifies the starter.
CommandWhat it does
npm run devLaunch or reuse the visual editor for this project.
npm run gameRun the standalone player page, without the editor.
npx @vgai/cli@latest examplesList scaffoldable example projects.
npx @vgai/cli@latest edit [project]Launch the editor on an explicit project from outside it.
npm run vgai -- play / npm run vgai -- stopDrive Play mode from a generated project.
npx @vgai/cli@latest inspect <folder>Detect an existing web game with no writes.
npx @vgai/cli@latest adapt <folder>Preview VGAI metadata; add --write only after review.
npm run buildType-check + production build.
npm run typecheckType-check game and server code.
npm run validate-scenesValidate .vscn.json files against the component registry.