docs / getting-started / introduction

Introduction

g2w (Game to Website) is a TypeScript-first, AI-agent-ready framework for building and shipping web games: HTML5 games, 2D first with 3D planned, for desktop and mobile web browsers.

A game in g2w is a composition of small packages. You build aG2WGame from @g2w/runtime with a renderer, aSceneManager, input adapters, audio, and assets — then register your resources as finalizers and let the Effect runtime own the lifecycle.

Lifecycle states

Game owns an explicit lifecycle state machine:new → initializing → initialized → running ⇄ stopped → disposed. A failed init returns to new and is retryable; disposal is idempotent and every cleanup failure stays observable.

Minimal usage

main.ts
import { G2WGame } from "@g2w/runtime";
import { PixiRenderer } from "@g2w/renderer-pixi";

const game = new G2WGame({
  renderer: new PixiRenderer(),
  canvas: document.querySelector("#game")!,
  width: 640, height: 360,
  onUpdate: (deltaTime) => { /* your game logic here */ },
});

await game.init();
game.start();

Honest status

StatusThe @g2w/* packages are not published to npm yet. Until the release lands, pnpm create g2w works only after publishing. 2D rendering over WebGL is done and browser-verified; 3D is exploratory (Roadmap R8).

Next steps

Read the architecture notes for the implemented design, or theroadmapfor current priorities and planned work.