{"id":51170355,"url":"https://github.com/duikindiesee/citylife","last_synced_at":"2026-06-27T00:01:11.949Z","repository":{"id":361362020,"uuid":"1254155475","full_name":"duikindiesee/citylife","owner":"duikindiesee","description":"CityLife: an AI-driven, stylized-3D city builder. v1 town plus an early v2 alien-planet colony. Evolves CityMind, inspired by Wes Roth.","archived":false,"fork":false,"pushed_at":"2026-06-20T13:08:06.000Z","size":1401,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-20T13:11:23.817Z","etag":null,"topics":["ai","city-builder","gamedev","llm","procedural-generation","simulation","three-js","typescript","webgl"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duikindiesee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-30T07:53:36.000Z","updated_at":"2026-06-20T11:59:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/duikindiesee/citylife","commit_stats":null,"previous_names":["duikland/citylife","duikindiesee/citylife"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/duikindiesee/citylife","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duikindiesee%2Fcitylife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duikindiesee%2Fcitylife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duikindiesee%2Fcitylife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duikindiesee%2Fcitylife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duikindiesee","download_url":"https://codeload.github.com/duikindiesee/citylife/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duikindiesee%2Fcitylife/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34835785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","city-builder","gamedev","llm","procedural-generation","simulation","three-js","typescript","webgl"],"created_at":"2026-06-27T00:01:07.477Z","updated_at":"2026-06-27T00:01:11.930Z","avatar_url":"https://github.com/duikindiesee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CityLife\n\nA stylized-3D, agent-driven city that **runs itself** while an **AI mayor governs it** — built to live on a screen and evolve on its own.\n\n\u003e **Origin \u0026 tribute.** CityLife grew out of **[CityMind — v1](https://github.com/duikland/citymind)**: an AI-driven city builder where each model reads the rules and writes a script to run the city. The whole idea was sparked by **[Wes Roth](https://www.youtube.com/@WesRoth)** — his benchmark-game video (each AI model generating its own script to play) lodged in my head and wouldn't leave, and his _own_ autonomous city-builder video kicked off this v2. Huge thanks, Wes, for the inspiration and the consistently great content. 🙏\n\u003e\n\u003e - The original spark: https://www.youtube.com/watch?v=bFO0uAMPx1g\u0026t=844s\n\u003e - The video that started v2: https://youtu.be/F_6go08nHv4\n\u003e\n\u003e **Two builds live in this repo:** the default app (`/`) now loads the **v2 Colony** (a procedural alien-planet colony builder, early Phase A); the **v1 Town** described below lives at **`/town.html`**. Direction docs: [`docs/TECH-SPEC.md`](docs/TECH-SPEC.md) (town) · [`docs/TECH-SPEC-v2-COLONY.md`](docs/TECH-SPEC-v2-COLONY.md) (colony) · [`docs/PHASE-B-PROMPT.md`](docs/PHASE-B-PROMPT.md) (next step).\n\n## What it is\n\n- **Layer 1 — the living city** (`src/engine/`): a deterministic, framework-agnostic simulation. Citizens have homes, jobs, wallets and daily routines (sleep → commute → work → shop). Businesses keep their own P\u0026L, produce commodities (ore/lumber/crops/oil/goods), pay wages every **Friday**, and a market discovers prices and GDP. Population grows or shrinks by **migration** driven by jobs + happiness. It runs forever with no AI attached.\n- **Layer 2 — the AI mayor** (`src/ai/`): on a **configurable check-in interval (default 10 min)** the governor reads a tiny digest of the city, asks a brain for a small plan, and applies **schema-validated** policy actions (tax, budget, ordinances, zoning). Every decision is logged with its reasoning.\n- **Renderer** (`src/render/`): plain three.js — instanced buildings, citizens, **cars + cargo-carrying trucks** driving the road grid, traffic-light posts, trees, a water coastline, day/night sun, and an art pass (ACES tone mapping + bloom). Behind a simple interface so it can be upgraded later.\n- **Logistics** (`src/engine/logistics.ts`): a road-tile graph + BFS pathfinding. Cars commute building→building; trucks run a freight cycle (resource → factory → market) carrying visible cargo; soft traffic-light phases pause vehicles at junctions.\n- **Runtime** (`src/runtime/`): the fixed-timestep loop, speed control, and the governor's interval timer that ties it all together for the browser.\n\n## The AI brain is swappable\n\n| Provider                 | Status                 | Notes                                                                                           |\n| ------------------------ | ---------------------- | ----------------------------------------------------------------------------------------------- |\n| **Heuristic**            | ✅ built-in, default   | A deterministic rule-based mayor. Always works, no install. Also the fallback if an LLM errors. |\n| **Ollama · Gemma (~4B)** | ✅ wired, needs Ollama | Local LLM. Pick it in the AI panel.                                                             |\n\n### Enabling the local Gemma brain\n\nThe model runs on **CPU** so the 4 GB GPU stays free for rendering:\n\n```powershell\n# install Ollama (https://ollama.com), then:\n$env:OLLAMA_NUM_GPU = \"0\"        # keep the model off the GPU\nollama pull gemma3:4b\nollama serve\n```\n\nThen choose **\"Ollama · Gemma (local)\"** in the AI Mayor panel. If Ollama isn't running, the governor silently falls back to the heuristic mayor.\n\n## Run it\n\n```powershell\nnpm install\nnpm run dev        # http://localhost:5188\nnpm test           # headless engine + governor tests\nnpm run build      # production build\nnpm run typecheck  # tsc --noEmit\n```\n\n## Using it\n\n- **Watch**: it starts running immediately. Use the speed buttons (1×–60×) up top.\n- **Govern**: in the AI Mayor panel set the **check-in interval** (presets 10s/1m/10m/30m or type minutes), pick the brain, toggle `auto`, or hit **Check in now**. The reasoning feed shows what the mayor did and why.\n\n## Status\n\nPhases 0–3 of the spec are functional in MVP form: the city lives, renders in 3D with traffic and an art pass, and the AI governs on a configurable interval. **Done:** agent-based citizens + economy, configurable AI governor, cars/trucks + road-graph logistics, trees/water, tone mapping + bloom. **Next** (see [`docs/TECH-SPEC.md`](docs/TECH-SPEC.md) §12): proper A\\* with congestion costs, web-worker sim, per-business competing AIs, test-harness model-vs-model meta-game, save/load, TV kiosk mode.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduikindiesee%2Fcitylife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduikindiesee%2Fcitylife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduikindiesee%2Fcitylife/lists"}