# IDEA.md – a real-time strategy game of your own in the browser This is a self-contained brief. Give it in full to Claude Code (or a similar tool) to build a game of your own. It draws on what was learned building Chronicles of the Core, a real-time strategy game in the spirit of Warcraft III that was coded by Claude Code, drawn by Codex and given voices, sound and music by ElevenLabs. ## 1. What to build A real-time strategy (RTS) game in the browser with the mechanics of the classic games: build a base, gather resources, train an army and lead heroes. All content – world, peoples, units, names, images and sound – must be your own. The mechanics may have a model; the content may not be borrowed. The game should have: - **several races** (Chronicles has four), each with a worker, around ten combat units, heroes and around twelve buildings, with tier upgrades of the main building - **resources** (gold, lumber, a food cap) and **upkeep** that cuts gold income as the army grows - **heroes** with levels, abilities and an inventory - **creeps, items, day and night** and a mechanic of your own that pulls players towards the middle of the map - **skirmish** against the computer on several maps and difficulty levels, ideally maps with their own goals - a **campaign** with story before and after the missions - later: **multiplayer**, **replays**, a **map editor**, saved games and a mobile version **Not at first**: multiplayer. Build for it from day one (see below), but do singleplayer first, and one playable race before the others. ## 2. Stack and architecture What **matters** is marked; the rest can be swapped. - **The client**: TypeScript and Vite, React for menus and HUD, **PixiJS** (WebGL) for the game world, isometric 2D. - **The server** carries none of the game itself: accounts, saved games, campaign progress, statistics, replays and custom maps. Chronicles uses PHP with MariaDB; anything goes. - **Important: a simulation without DOM, rendering or React** (`sim/`). Dependencies only go downwards: interface and rendering read the simulation, never the other way round. Then it can run in Node for tests and on other computers for multiplayer. - **Important: all balance and all content in data files** (`data/`), not in the code. - **A fixed tick** (20 per second); rendering interpolates between two ticks. - **Orders are the only way to affect the simulation** – from the player, the computer and campaign scripts. The same format becomes replays and multiplayer. - **Entities in one table** with component fields, no class hierarchy. A* on a grid with eight-way movement, groups that share a path and keep formation. ## 3. Decisions that turned out to matter **A deterministic simulation from the start.** The same starting state and the same orders must give exactly the same course of events, in every browser. Your own seeded random, no `Math.random` or `Date`, no unsorted iteration, entities in id order. Browsers don't compute `Math.sin`, `Math.pow`, `**` or `Math.hypot` exactly the same: ban them with a lint rule in the simulation, the computer player and the map generator, and write replacements that only use `+ - * /` and `Math.sqrt`. Then lockstep multiplayer, replays and reports that can be played back all work. **Test the determinism in three engines.** Run the same matches in Chromium, Firefox and WebKit and compare a checksum for every game minute. **Several agents with contracts between them.** The coding agent writes the code and orders graphics and sound from other agents. They don't read each other's code; they work against contracts: - **Graphics**: a `manifest.json` and a style guide with cell size, anchor points, frames, palette, light direction and outlines. An order is a markdown file. The image agent works in a sandbox that only reaches the graphics folder, scales down and exports to the right palette with your own tools, and makes a contact sheet. A script tests the delivery against the contract. - **Sound**: a script reads the game's data and writes a sound manifest – id, file name, text and voice for every clip. A test checks that every story page has a recording with the right text. A listening page lets the human hear everything and choose before anything goes into the game. - **Fallbacks**: whatever hasn't been delivered is drawn in code and sounds through Web Audio, so the game is always playable. **The human judges taste.** The agents check sizes, formats and function. Whether something looks good and feels fun is the human's call, and no image counts as approved automatically. **Reports with a replay.** Players can send a report from the game with the running match as a replay and the latest error messages. The replay is played up to the report's tick and the checksum compared. A small MCP server gives the coding agent the reports. **The computer player sends orders like a player** and only reads what a player is allowed to see. ## 4. Pitfalls - **Floating point differs between browsers.** See above – it shows up first in multiplayer, and then it's expensive. - **Workers sent to unreachable resources** search for a path again and again. Split the ground into connected regions and pick targets only in your own. - **Frame rate in automated tests means nothing** – the test browser renders in software. Measure on real hardware. - **Numbers in the code** become impossible to balance. Everything in data files. - **Big tasks fall apart.** Short cards with one goal and one measurement work better. - **Under WSL, file transfer to a Windows drive is slow.** Run the build tools with Windows' own node, or keep the project on the Linux side. ## 5. Requirements and measurements - The simulation runs the same match twice with the same checksum, in three browser engines. - A test plays a match between computer players and measures the win rate per race and difficulty. - Hundreds of units on screen without the frame rate dropping on real hardware. ## 6. How it's verified - Lint, unit tests, type checking and a production build without errors. - **In a real browser** (Playwright): what the card is about can be done, the console is free of errors, screenshots are saved. - **Determinism tests** in three engines. - **Playtesting** by the human for game feel and looks, as cards of their own. ## 7. Way of working - **Research first**: the model's mechanics – resources, upkeep, attack and armour types, XP tables – written up as a reference of your own. - **A design bible** (the world, the races, the units, the campaign) and an architecture in the repo. The issues hold *what*, the repo holds *why*. - **Decisions first**: art style, assets, multiplayer or not, scope, language. - **One task at a time**, with the measurement in the closing comment. ## 8. The prompt > Build a real-time strategy game in the browser in [TypeScript with React and PixiJS], with [Warcraft III] as the model for the mechanics but with entirely original content: a world of its own, [four] peoples of its own, units, heroes and a campaign. Start with singleplayer against the computer and one playable race. > > Read all of IDEA.md below first. It describes the game, the architecture, the decisions that turned out to matter and the pitfalls to avoid. > > Work like this: > 1. Research the model's mechanics and write a design bible. Ask me about art style, assets, multiplayer and scope before anything is built. > 2. Keep the simulation deterministic and free of rendering from day one. > 3. Put all balance in data files. > 4. Order graphics and sound through manifests, and let me approve the looks. > 5. Try every feature in a real browser, and leave the game feel to me to playtest. > > [paste IDEA.md here]