# @netforge/kit-play API reference

> Every export of @netforge/kit-play, generated from its TypeScript source: 26 functions, classes, constants and types with their signatures and doc comments.

Net Forge, the open-source multiplayer browser game engine built for AI coding agents, is published on npm under `@netforge` with source at https://github.com/netnetdev/net-forge.

Source: https://forge.netnet.capital/docs/reference/kit-play  
Last updated: 2026-10-23. Checked against @netforge/engine 0.2.0.

Runs a game folder on your computer with play money: builds the template client with your `src/game.ts` and starts a local room host. The `kit-play` command and the same functions for scripts.

```ts
import { play, TEMPLATES } from "@netforge/kit-play";
```

Generated from `packages/kit-play/src/index.ts` by `apps/forge-docs/scripts/api.mjs`. Signatures are what the TypeScript compiler reports for the current source; long types are cut and say so.

| Kind | Count |
|---|---|
| Functions | 10 |
| Classes | 1 |
| Constants | 5 |
| Types | 10 |

## Functions

### check

```ts check=skip
function check(o: CheckOptions): Promise<CheckResult>;
```

Source: [packages/kit-play/src/check.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/check.ts)

### namesModule

The names module: everything the template's names.ts exports, with these labels in place of its tables.

```ts check=skip
function namesModule(n: Names, templateNamesPath: string): string;
```

Source: [packages/kit-play/src/names.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/names.ts)

### parseNames

Parses src/names.json; throws with the first problem.

```ts check=skip
function parseNames(text: string): Names;
```

Source: [packages/kit-play/src/names.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/names.ts)

### play

```ts check=skip
function play(o: PlayOptions): Promise<Playing>;
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### readGameFolder

Reads and checks the game folder.

```ts check=skip
function readGameFolder(dir: string): GameFolder;
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### runKitPlayCli

The kit-play command: play (the default), test, new and templates.

```ts check=skip
function runKitPlayCli(argv: readonly string[], io: PlayCliIo): Promise<number>;
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### runPlayCli

```ts check=skip
function runPlayCli(argv: readonly string[], io: PlayCliIo): Promise<number>;
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### runTestCli

```ts check=skip
function runTestCli(argv: readonly string[], io: PlayCliIo): Promise<number>;
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### summary

The report in a few lines.

```ts check=skip
function summary(r: CheckResult): string[];
```

Source: [packages/kit-play/src/check.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/check.ts)

### templateFor

netnet.json's template field (the room template names are accepted too).

```ts check=skip
function templateFor(name: unknown): TemplateEntry | null;
```

Source: [packages/kit-play/src/templates.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/templates.ts)

## Classes

### PlayError

```ts check=skip
class PlayError {
  constructor(message?: string);
}
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

## Constants

### ALLOWED_IMPORT

The only import a game module may make (the studio's rule, kept here so a game that plays locally plays in the studio).

```ts check=skip
const ALLOWED_IMPORT: "@netforge/engine";
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### COMMANDS_HELP

```ts check=skip
const COMMANDS_HELP: "kit-play: make, test and play Net Forge games on this computer with play money.\n\nUsage:\n  kit-play play [dir] [flags]       Build the game in dir (default: here) and play it. kit-play play --help for flags.\n  kit-play test [dir] [flags]       Compile src/game.ts and run the playtest bots, no browser.\n  kit-play check [dir] [flags]      The same, with the report as JSON on stdout.\n  kit-play new [folder] [flags]     Start a new game from a template (the same as npm create netforge).\n  kit-play templates [--json]       List the templates.\n\nkit-play [dir] without a command plays, as bef /* ... */;
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### HELP

```ts check=skip
const HELP: "kit play: run a Net Forge game on this computer with play money.\n\nUsage: kit play [dir] [flags]     (inside the folder you downloaded from Net Forge)\n\n  --port <n>          Port for the page and the local room (default 4663).\n  --host <addr>       Interface to listen on (default 127.0.0.1, this computer only).\n                      Use 0.0.0.0 to let devices on your network join.\n  --players <n>       Browser tabs to open, one per local player (default 1).\n  --no-open           Print the link instead of opening a browser.\n  --library-url <u>   Load the asset library from this URL ins /* ... */;
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### TEMPLATES

```ts check=skip
const TEMPLATES: Readonly<Record<TemplateId, TemplateEntry>>;
```

Source: [packages/kit-play/src/templates.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/templates.ts)

### TEST_HELP

```ts check=skip
const TEST_HELP: "kit-play test: compile src/game.ts as the play build does and run the playtest bots.\n\nUsage: kit-play test [dir] [flags]\n\n  --minutes <n>   Minutes of game time the bots play, at the template's own tick rate (default 1, up to 30).\n  --bots <n>      Bots playing (default: 2, or fewer when the template seats fewer).\n  --seed <n>      Random seed (default 1).\n  --json          Print the result as JSON on stdout.\n\nExits 0 when the game compiles and every playtest check passes, 1 otherwise.";
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

## Types

### CheckOptions

```ts check=skip
interface CheckOptions {
  readonly dir: string;
  readonly minutes: number;
  readonly bots: number | null;
  readonly seed: number;
  readonly log: (s: string) => void;
}
```

Source: [packages/kit-play/src/check.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/check.ts)

### CheckReport

What the engine's playtest reports (the fields this command reads; the rest pass through to --json).

```ts check=skip
interface CheckReport {
  readonly ticks: number;
  readonly bots: number;
  readonly kills: number;
  readonly deaths: number;
  readonly wave: number;
  readonly maxLevel: number;
  readonly earnEmitted: number;
  readonly earned: Readonly<Record<string, number>>;
  readonly softlock: boolean;
  readonly msPerTick: number;
  readonly rules?: { readonly template: string; readonly checks: readonly { readonly ok: boolean; readonly line: string }[]; readonly progress: number };
  readonly failed: readonly string[];
}
```

Source: [packages/kit-play/src/check.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/check.ts)

### CheckResult

```ts check=skip
interface CheckResult {
  readonly ok: boolean;
  readonly template: string;
  readonly problems: readonly string[];
  readonly tickRate?: number;
  readonly report: CheckReport | null;
}
```

Source: [packages/kit-play/src/check.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/check.ts)

### GameFolder

```ts check=skip
interface GameFolder {
  readonly dir: string;
  readonly template: TemplateEntry;
  readonly gameFile: string;
  readonly names: Names | null;
}
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### Names

```ts check=skip
interface Names {
  readonly title: string;
  readonly weapons: Readonly<Record<string, { readonly name: string; readonly line: string }>>;
  readonly upgrades: Readonly<Record<string, { readonly name: string; readonly line: string }>>;
  readonly enemies: Readonly<Record<string, string>>;
  readonly rules: Readonly<Record<string, string>>;
  readonly skus: Readonly<Record<string, string>>;
}
```

Source: [packages/kit-play/src/names.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/names.ts)

### PlayCliIo

```ts check=skip
interface PlayCliIo {
  out(s: string): void;
  err(s: string): void;
  cwd: string;
}
```

Source: [packages/kit-play/src/cli.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/cli.ts)

### Playing

```ts check=skip
interface Playing {
  readonly url: string;
  readonly lan: readonly string[];
  close(): Promise<void>;
}
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### PlayOptions

```ts check=skip
interface PlayOptions {
  readonly dir: string;
  readonly port: number;
  readonly host: string;
  readonly open: boolean;
  readonly players: number;
  readonly libraryUrl: string | null;
  readonly log: (s: string) => void;
}
```

Source: [packages/kit-play/src/play.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/play.ts)

### TemplateEntry

```ts check=skip
interface TemplateEntry {
  readonly id: TemplateId;
  readonly label: string;
  readonly pkg: string;
  readonly adapter: string;
  readonly manifest: { readonly fn: string; readonly field?: "manifest" };
  readonly seats: number;
  readonly aoi: LocalAoi;
}
```

Source: [packages/kit-play/src/templates.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/templates.ts)

### TemplateId

```ts check=skip
type TemplateId = "survivor" | "arena" | "tower-defense" | "dungeon" | "idle" | "platformer" | "cards" | "collector" | "racer" | "party";
```

Source: [packages/kit-play/src/templates.ts](https://github.com/netnetdev/net-forge/blob/main/packages/kit-play/src/templates.ts)
