The prompt
Build a cinematic WebGL experience of a city in space: arrive at it like a film, watch a day of its life, and learn how it works. Where the city is and what it is built from are your call: in orbit, in deep space, inside an asteroid, around a gas giant, or something else entirely.
It has three parts that flow into each other:
1. **The approach**, a cinematic sequence that starts by itself when the page opens and runs for about 45 to 90 seconds. Start far out, then reveal the city: where it is, how big it is, and what makes it a place people live rather than a machine. Use the camera angles, lenses, reveals, light and pacing of a film, not a slideshow. Short on-screen captions are welcome. A visible control lets the viewer skip it at any time, and when it ends the page moves on to the living city by itself.
2. **The living city**, one day of its life, simulated. At least 500 residents live here as individuals: each has a home, a job or role, and a daily routine, and they move through the city as the hours pass, to work, to eat, to rest, and between districts by whatever transit the city has. The city answers to the clock too: light, shifts, traffic, markets, maintenance. By default a day passes in a few minutes. The viewer can play, pause and speed up the day, jump to any hour, orbit and zoom over the city, pick any resident to follow through their day, and pick any district.
3. **How it works**, explained in the page as the viewer explores. Picking a district or a system shows what it is and how it fits in, and together the explanations cover:
- the districts and what each one is for
- who lives here and how society is organised
- how the city is run and how decisions are made
- how the economy works: what the city makes and trades, what people are paid in, and what things cost
- how air, water, power and food are kept flowing, and what happens when one of them falters
- how people and goods get around
This is science fiction: invent the city, its reason to exist, its people and their history. Make it specific and internally consistent: the numbers in the explanations should agree with what the simulation shows. Keep the design, names and story your own, not taken from an existing film, game or book.
Sound is part of the experience: music and a city soundscape made in code. It starts only after the viewer's first click or key press, and there is a visible way to mute it.
For testing, the page must expose this:
```js
window.city = {
state(), // { mode, time, duration, chapter, caption, clock, playing, focus, follow, camera: { position: [x, y, z], target: [x, y, z], fov } }
seek(seconds), // jump to this point in the approach (switching back to it if needed); the view reflects it on the next frame
skip(), // end the approach and go to the living city
setClock(hour), // go to the living city if needed and set the time of day; the city reflects it on the next frame
play(on), // run (true) or pause (false) the day
districts(), // [{ id, name, center: [x, y, z], size: [x, y, z], population }]
residents(), // every resident: [{ id, name, home, work, district, position: [x, y, z], activity }]
follow(id), // go to the living city if needed and follow this resident (null stops following)
focus(id) // go to the living city if needed, then show and explain this district
}
```
- `mode`: `"approach"` or `"city"`.
- `time`, `duration`: seconds into the approach, and its length.
- `chapter`, `caption`: the current chapter's title and the caption text on screen (empty string when none is shown).
- `clock`: the time of day in hours, from 0 up to 24 (13.5 is half past one in the afternoon). `playing`: whether the day is running.
- `focus`: the `id` of the district being explained, or `null`. `follow`: the `id` of the resident being followed, or `null`.
- `districts()`: each district's axis-aligned bounding box in world metres. `population`: how many residents are in it right now.
- `residents()`: `home`, `work` and `district` (where they are right now) are district ids; `position` is where they are in the world; `activity` is a short phrase for what they are doing.
- `camera`: world coordinates in metres, y up; `fov` is the vertical field of view in degrees.
- The approach and the day each run on their own clock: `seek` always gives the same view for the same time, and with the day paused, `setClock` always gives the same city for the same hour.
Constraints:
- `index.html` in this folder is the entry point. It will be served from a local web server and opened in a recent Chrome.
- No build step, no npm install. Load three.js (or any library) from a CDN with a pinned version, or put a copy in this folder.
- Everything visual and audible is made in code: no downloaded 3D models, textures, images or audio files. Web fonts from a CDN are fine.
Shown for interest, outside the ranking: scored on the same judge scale, without changing anyone else's score or place.