packages/docs/examples-gallery/games.mdx
Build games where AI agents make strategic decisions. packages/examples/ ships TypeScript game demos.
AI-driven dungeon crawl (examples/text-adventure/game.ts).
cd examples/text-adventure
cp .env.example .env # add OPENAI_API_KEY
bun install
LOG_LEVEL=fatal bun run game.ts
Features: multi-room world, combat, inventory, AI-chosen actions via ModelType.TEXT_SMALL.
Play or benchmark an agent (examples/tic-tac-toe/game.ts).
cd examples/tic-tac-toe
bun install
bun run game.ts --human
Multi-agent cellular simulation (examples/game-of-life/game.ts).
cd examples/game-of-life
bun install
bun run game.ts
const rooms = {
secret_chamber: {
name: "Secret Chamber",
description: "A hidden room filled with ancient artifacts.",
items: ["golden_idol"],
exits: { south: "treasure_room" },
},
};
const enemies = {
lich: {
name: "Lich",
health: 80,
damage: 30,
weakness: "holy_water",
special: "Can summon skeletons",
},
};