AITraining2U

Programs

Resources

Case Studies

Quick Links

Enquire Now
AI Game Development · World building

AI world building: living cities and NPCs with daily routines

How to design and build a city that feels alive with Claude Opus 5.5 or GPT-6 Astra: world bible, schedules, interactions, cameras and 100 characters on a phone.

By Marcus Chia 2026-11-20 9 min read
Dec5–6

Next public cohort

5–6 Dec 2026 · Sat–Sun

Worq Subang

Limited seats · see all dates

Miniature brick-built city street with shops, cars and tiny residents, like the living city of an open world game

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:

Nouns City, a 3D living city of Nouns characters built with Claude CodeNouns Mayor, a city builder on the map of Nouns City
Nouns City and Nouns Mayor on Noggles.online, built by our team with Claude Code. Mayor puts a city builder on the same map.
The real prompt behind Nouns CityClaude Opus 5.5
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 sectionWhat goes in it
DistrictsFive to eight named areas, each with a purpose: offices, harbour, market, homes, park.
RolesEvery job in town and how many characters hold it. Roles decide where people go.
EconomyWages, prices and wants. Even a toy coin economy gives everyone a reason to move.
ClockHow long a game day lasts, shop hours, what changes at night and in the rain.
Tone and rulesCosy, 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.

Draft the world bibleEither
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.

One character’s day, written as a schedule
1
07:00 Commute
Leaves home and heads across the city.
2
09:00 Work
Goes to their job and does its task.
3
13:00 Lunch
Picks a nearby food spot; meets a friend.
4
18:00 Free time
Park, beach or a chat that may become news.
5
22:00 Home
Heads back; the city quietens down.
An example design, not Nouns City’s actual timetable. Give the AI a table like this per role.

The NPC daily-routine loop

  1. 1
    The clock ticks
    One shared game clock, for example one real minute per game hour.
  2. 2
    Check the schedule
    Each role has a timetable: home, work, lunch, leisure, bed.
  3. 3
    Check the needs
    Hunger, energy and social meters. A low meter overrides the timetable for a while.
  4. 4
    Walk somewhere
    Pick a fitting destination (nearest food stall, own workplace) and path there along streets.
  5. 5
    Act and react
    Play 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.

NPC schedules and needsClaude Opus 5.5
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.

Interactions and a town newspaperEither
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.

Performance budget for phonesEither
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.

City builder on the existing mapClaude Opus 5.5
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 linesLLM dialogue at runtime
CostFree once writtenPaid per message; adds up across 100 NPCs
SpeedInstantA network round trip before every reply
Offline playWorksNeeds a connection and a server holding your API key
SafetyYou wrote every lineNeeds 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.

HRDC-claimable · 2 days · hands-on
AI Vibe Coding & Rapid Prototyping

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.

Frequently Asked Questions

AI world building means using a model such as Claude Opus 5.5 or GPT-6 Astra to help design and build a game world: its places, characters, economy and rules, and then the code that brings them to life. The best results come from writing a short world bible first, so the model has a fixed reference, and then building in small rounds: plan, build, play, report what is wrong, repeat. A person still decides what the world should be and checks every result.

Give each NPC a role, a daily timetable tied to a game clock, and a few needs such as hunger, energy and social. Let needs interrupt the timetable, then add interactions: NPCs greeting each other, arguing, reacting to weather and to the player. A newspaper or noticeboard that reports what happened makes the world feel like it has a history. Our Nouns City uses this idea: 100 Nouns with jobs, homes and routines whose actions make the news.

No. Most of the feeling of a living city comes from ordinary code: schedules, needs and written dialogue. Running a language model for every conversation adds per-message cost, a delay before each reply, a server to protect your API key, and moderation work, which matters for games children play. A practical approach is to have AI write lots of dialogue during development, have a human review it, ship it as scripted lines, and reserve runtime chat for a few special characters.

Yes, with care. Measure first: frame time, draw calls and triangle count. Then use instancing for repeated props, level of detail so distant characters and buildings are simpler, object pools so you are not constantly creating and destroying objects, and slower updates for NPCs far from the player. Ask the AI to make one change at a time and report the numbers after each, so you know what actually helped on your target phone.

It is a strong one, because it mixes creative writing and coding. Students write the world bible, characters and dialogue, then direct Claude Code or Codex to build it and test whether the city behaves as written. A 14-year-old can do a small version with a parent; a college computer science student can add pathfinding, a performance budget and a city builder mode for a portfolio piece. An adult should review dialogue before others play it.

Build your own living world, one prompt at a time

Learn the plan, build, play and fix loop with Claude Code in two hands-on days. Open to companies (HRDC claimable), individuals and students.