A game world feels alive when things happen while you are not looking. The baker opens up at the same time every morning. Two neighbours argue at the bus stop. The newspaper reports something you did yesterday. None of that needs cutting-edge graphics. It needs a plan, a clock and many small, believable routines.
This guide covers AI world building with Claude Opus 5.5 (in Claude Code) or GPT-6 Astra (in Codex), built around two games our team built with Claude Code: Nouns City and Nouns Mayor.
What we built: Nouns City and Nouns Mayor
Nouns City is a free 3D open world in a New York–style city, playable in the browser. 100 Nouns live there, each with a job, a home and a daily routine; in the game’s own words, they commute, work, eat, chat, argue and make the news, which you read in the Noggle Times. You can switch between third-person, isometric and first-person cameras. Nouns Mayor is a city builder on the real map of Nouns City: start from a lonely pier, lay roads, zone homes, shops and industry, keep the Nouns happy and raise the landmarks on their real sites. This is the real prompt that started Nouns City, from our Claude course deck:
Create another new game where the player explores Nouns City. Plan and propose first. I want it to feel like a living world where each Noun has a role, task and interactions.
The words doing the work are “plan and propose first” and “role, task and interactions”. After that it was the same loop every time: plan first, build, play it, report what’s wrong, repeat.
Step 1: write the world bible before any code
A world bible is a short document describing your world’s places, people, money, time and tone. The model reads it every session, so decisions stay consistent. Without one, the bakery moves district by session three.
| Bible section | What goes in it |
|---|---|
| Districts | Five to eight named areas, each with a purpose: offices, harbour, market, homes, park. |
| Roles | Every job in town and how many characters hold it. Roles decide where people go. |
| Economy | Wages, prices and wants. Even a toy coin economy gives everyone a reason to move. |
| Clock | How long a game day lasts, shop hours, what changes at night and in the rain. |
| Tone and rules | Cosy, chaotic or funny, and what never happens here. Vital if children will play. |
Keep it to one or two pages, saved in the project (for example WORLD.md) so Claude Code or Codex reads it each session.
Help me write a world bible for a small open world game set in a seaside town. No code yet. Include: 6 districts with one line each on look and sound; 12 job roles adding up to 60 characters; a simple coin economy with wages and 10 prices; a game clock where one real minute is one game hour, with shop hours and night changes; and the tone (cosy and funny, ages 10 and up). Ask me 5 questions first, then save it as WORLD.md.
Step 2: give every character a schedule and needs
The cheapest way to make NPCs (non-player characters) feel alive is a timetable plus a few needs. That is ordinary code, not AI inside each character, so it runs fast and offline.
The NPC daily-routine loop
- 1The clock ticksOne shared game clock, for example one real minute per game hour.
- 2Check the scheduleEach role has a timetable: home, work, lunch, leisure, bed.
- 3Check the needsHunger, energy and social meters. A low meter overrides the timetable for a while.
- 4Walk somewherePick a fitting destination (nearest food stall, own workplace) and path there along streets.
- 5Act and reactPlay an animation, change a meter, notice the player or another NPC, say a line.
In the 2023 Generative Agents paper from Stanford and Google, 25 language-model-driven characters in a Sims-like town woke up, cooked breakfast, went to work and even organised a Valentine’s Day party among themselves. That ran a language model for every agent. For a game on a phone, a hand-tuned timetable gets most of the feeling for almost none of the cost.
Read WORLD.md. Plan and propose first, then build an NPC routine system. Each role gets weekday and weekend timetables tied to the game clock. Each NPC has hunger, energy and social from 0 to 100; below 25, it detours to the nearest suitable place, then resumes. Add a debug panel (D key) showing the clicked NPC's role, goal, destination and needs. Start with 20 NPCs and tell me how to test it.
Step 3: add interactions
Interactions are what make a city feel alive. Plan three kinds: NPC with NPC (friends stop to chat, rivals argue), NPC with player (greetings by time of day, small favours) and NPC with world (umbrellas in the rain, crowds round a busker). A town newspaper that reports what happened turns these moments into a story, which is what the Noggle Times does.
Add interactions on top of the NPC routines. When two NPCs who know each other pass within 3 metres, there is a 20% chance they stop and exchange two lines from a written list matching their roles, time of day and weather; rival pairs argue instead. Log notable events and show them as headlines in an in-game newspaper. Write 80 lines of dialogue in the tone of WORLD.md. No generated dialogue at runtime.
Step 4: choose your camera modes
Each camera asks something different of the world. Third-person (behind the character) needs camera collision so it never clips into walls. Isometric (angled top-down) shows a whole neighbourhood, so routines and crowds read well, and it suits a city builder. First-person puts you at street level, where close detail matters most. Ask for all three as separate modes from day one, cycled by one button, with touch controls usable at 375 pixels wide; bolting on a second camera later breeds bugs.
Step 5: keep 100 characters fast on a phone
- Level of detail (LOD). Distant things get simpler models. The three.js LOD component switches models by distance from the camera.
- Instancing. Forty identical lamp posts drawn as one batch, not forty jobs. The three.js docs say InstancedMesh reduces draw calls and improves rendering performance.
- Pooling. Reuse a fixed set of cars, particles and speech bubbles instead of constantly creating and deleting them; Game Programming Patterns explains why constant allocation is slow.
- Simulation LOD. NPCs far from the player update less often. They only need to be in the right place when you arrive.
OpenAI’s guide to building games with Astra gives the same order of work: measure draw calls, triangles and frame times before changing anything, and split heavy work into small time-sliced steps.
Target: a steady 30 frames per second on a mid-range Android phone in Chrome with 100 NPCs. First add a stats panel (frame time, draw calls, triangles) and report the current numbers. Then propose changes in order of impact: instancing for repeated props, LOD for NPCs and buildings, a pool for cars and speech bubbles, and updating NPCs over 60 metres away twice per second. One change at a time, numbers after each.
Step 6: put a city builder on the same map
Nouns Mayor reuses the map of Nouns City. Keep the map as data (streets, plots, landmark sites) in its own file, separate from the code that draws it, so a second game can read it.
Read WORLD.md and the map data file. Plan and propose first: a city builder mode on the same map. The player starts with one pier and some coins, lays roads on the street grid, zones plots as homes, shops or industry, and unlocks each landmark on its real site at a population threshold. Happiness depends on jobs, nearby shops and parks. Use the isometric camera. Do not change the map file format without asking.
Should NPCs talk through an LLM at runtime?
| Scripted lines | LLM dialogue at runtime | |
|---|---|---|
| Cost | Free once written | Paid per message; adds up across 100 NPCs |
| Speed | Instant | A network round trip before every reply |
| Offline play | Works | Needs a connection and a server holding your API key |
| Safety | You wrote every line | Needs filtering and limits, especially for children |
Our view for browser and phone games.
Small models are cheap: Anthropic lists Claude Haiku 5.5, built for high-volume, latency-sensitive work, from US$0.10 per million input tokens and US$0.50 per million output. The real costs are a server to hold your API key (never put it in the game’s code), a wait before each reply, and moderation if children play. Our advice: have AI draft hundreds of varied lines during development, have a human read and edit them, and ship scripted dialogue. Live chat can come later, for one special character, with strict limits.
Opus 5.5 or GPT-6 Astra?
Both can do this. Claude Opus 5.5 (US$4/US$20 per million tokens) is the default in Claude Code on paid plans and is what our team uses. GPT-6 Astra (US$10/US$50) is OpenAI’s model for long agent sessions in Codex. For a living city, the world bible and the play-and-report loop matter more than the model. Compare them in our Opus 5.5 vs Sonnet 5.5 guide and GPT-6 Astra explained, or start at the series hub, how to make a game with AI. For seeded terrain see procedural world generation with AI; for the engine, a three.js game with Claude Opus.
A world-building project for schools and colleges
World building is half creative writing and half coding. Students write the bible, characters and headlines, then direct the AI to build it and test whether the city behaves as written. A 14-year-old can do a small version with a parent; a computer science student can add pathfinding, a performance budget and a builder mode for a strong portfolio piece. A teacher or parent reviews dialogue before others play. Start with vibe coding for teenagers or AI prompting for college students.
Two hands-on days building working software with Claude Code: plan first, build, test, deploy. The same loop we used for Nouns City.
Next public class: 5–6 December 2026 at Worq Subang · seats available
Going deeper on Claude Code? See our Claude and multi-agent orchestration course. On OpenAI’s tools, our ChatGPT and OpenAI training covers Codex.
HRD Corp claimable. AITraining2U is an HRD Corp registered training provider. Our public and in-house courses are claimable under the HRD Corp Claimable Courses (SBL-KHAS) scheme, and we prepare the grant paperwork with you. See HRDC-claimable AI training: courses, costs and how to claim.
Individuals, students and parents can also join our public classes directly; no HRDC claim is needed.

