A real-time agent-based civilization that runs in your browser — and, beneath it, an experiment: can a simulated mind come to suspect it is simulated? Start on a 3D planet, descend into Córdoba (Argentina), and watch a society emerge from the inner lives of individual people. They forage and specialize into trades, raise families across generations, advance through eras, trade between towns, defend against raids — and, with no script at all, invent faith: prophets arise, creeds spread and schism, temples rise. Sometimes a soul instead awakens: it accumulates enough strange evidence to infer that its world is made and that something watches.
You are an observer with a gentle hand: click any person to read their soul, follow them through life, whisper a doubt, or run an A/B experiment to test whether changing one inner input changes who they become.
Built with Three.js + Vue 3. The whole simulation runs in a Web Worker over shared memory, so the render stays smooth while a few hundred agents think, feel, move and fight.
The mind
- Souls with inner lives. Every townsperson has a backstory, evolving goals, episodic memories, emotions (joy / fear / grief), relationships and lineage. Click anyone to open their soul dossier, follow the clickable bonds and ancestry to wander the social web, and hear their inner monologue via a local LLM (Ollama).
- Awakening (the hypothesis). A soul's hidden truth ("I am simulated") is never readable by its own decisions — it must be inferred from observable anomalies (luck when watched, dread, the dark, synchronicities). Past a threshold it awakens, wears a cyan halo, and speaks with dawning lucidity. The world awakens on its own over time; watching a soul only accelerates it.
- Dialogue. Souls converse when they meet (overheard in a voices feed); the awakened recognize the same truth in one another.
- A/B experiment. Split the people into matched cohorts, vary one inner input (curiosity), and watch the two diverge — the scientific core of the project.
The society
- One continuum: planet → civilization, all in a single renderer.
- Emergent economy & jobs, money & social class (the comfortable grow complacent, the poor see the cracks sooner), demography with child → adult → elder life stages, inherited archetypes and plague & famine as real forces of death.
- Historical eras with buildings that visually evolve and a real tech tree (agriculture, masonry, medicine, war tactics — each a real bonus), war (raids, emergent soldiers, barracks, and town-vs-town campaigns), multi-settlement colonization, inter-settlement trade caravans + roads, diplomacy (alliances, feuds, border clashes).
- Emergent religion — nothing is seeded. Each soul is born with an innate readiness to believe (or not); a rare one has a revelation and founds a creed whose cosmology is rolled by chance — so one run drifts toward a single God, another toward a pantheon, another toward none. Faith then spreads by contact and along trade roads, schisms split it, temples rise, it bends jobs and diplomacy (warlike vs contemplative creeds), and children are raised in it. A culture panel shows every living faith, its prophet, tenet and reach — and each town is tinted by its dominant creed.
- Day/night cycle and seasons — the village sleeps at night, summer brings plenty and winter scarcity.
- Human-like movement. Velocity steering (accelerate / arrive / capped turning), separation, A* pathfinding + flow fields, animation driven by real speed.
The observer
- Pause / 1×·2×·4× time, frame the whole civilization or one town, adopt & follow a soul, whisper / give a sign / comfort, trend sparklines (population / awakened / faith), save & load the whole civilization, optional ambient sound, and share a world by seed via URL.
All 3D props are free CC0 assets (Kenney) — see ASSETS_CREDITS.md.
git clone https://github.com/BraianTroncoso/archetype-lab.git
cd archetype-lab
npm install
npm run dev # open the printed http://localhost:5173Click “descender a Córdoba” to drop into the civilization; “← volver al planeta” to fly back out.
Optional — the elder's voice (LLM): install Ollama, pull a small model, and run:
ollama pull qwen2.5:3b-instruct
VITE_OLLAMA_MODEL=qwen2.5:3b-instruct npm run devWithout Ollama everything still runs; the elder simply stays silent.
npm run build # strict type-check (vue-tsc) + production buildThe sim uses
SharedArrayBuffer, so the dev/preview server sends cross-origin-isolation headers (COOP/COEP) — already configured invite.config.ts. If the page isn't isolated, the sim transparently falls back to running on the main thread.
| Where | Action |
|---|---|
| Planet | drag to orbit · scroll to zoom · descender a Córdoba to dive in |
| Civ — camera/time | drag / scroll to move · ⏸ / 1× / 2× / 4× time · 🌎 toda la civ · 🏘 Córdoba · ← volver al planeta |
| Civ — a soul | click any person → soul dossier (history, goals, bonds, lineage, lucidity) · escuchar sus pensamientos (LLM monologue) · 🌬 whisper a doubt / ✦ give a sign / 🤍 comfort / ⌖ follow |
| Civ — culture | the credos panel (right, when no soul is open) lists every emergent faith — its cosmology, tenet, reach and prophet (click to open their soul) |
| Civ — experiment | 🧪 experimento A/B (split + vary an input, watch divergence) · 🔗 compartir mundo (share this world by seed) |
Four clean layers — the renderer never decides movement, it only reflects sim state:
Brain (sim logic) Sim transport Render Shell
src/civ/agents.ts → src/civ/sim-host.ts → src/civ/civ-scene.ts → src/view/ShellView.vue
(needs, jobs, economy, src/civ/civ-worker.ts src/civ/agent-view.ts (one renderer; globe
eras, combat, steering, (Web Worker + (Three.js scene, models, ⇄ civ transition)
pathfinding) SharedArrayBuffer) animation, LOD, tinting)
src/civ/agents.ts— the heart. A Structure-of-Arrays of agents with needs, personality (archetype), velocity steering, and per-settlement state (stock, buildings, era, raids, faith, trade). Also the soul layer: a per-agent inner life (memories / goals / emotions / bonds / lineage) keyed by a stable id, plus the lucidity → awakening loop (with the Gödel constraint), the emergent culture layer (creeds with a cosmology/temperament, founded by prophets, spread by contact, split by schism) and the A/B experiment cohorts. Pure logic, no Three.js.src/civ/pathfind.ts/flow-field.ts/spatial-hash.ts— A* on the nav grid, direction-to-home flow fields, and O(n) neighbor queries for separation.src/region/assets.ts— GLB / texture pipeline (characters + Kenney prop models, normalized on load).src/globe/— the Earth globe (geometry, Natural Earth data, textures).src/civ/map.ts— the procedural Córdoba terrain (sierras, pampa, the Suquía river), biomes and resource nodes.
See CONTRIBUTING.md for a fuller tour.
TypeScript · Vue 3 · Vite · Three.js · Web Workers + SharedArrayBuffer · gsap · Dexie (persistence) · optional Ollama (local LLM).
Locked direction: a consciousness laboratory — observe (with a gentle hand) a living civilization, deepen one world (Córdoba) before multiplying worlds, keep the agent count modest and the inner life rich. Done so far: souls, awakening (with the Gödel constraint), A/B experiments, life stages & genetics, economy, jobs, eras & a tech tree, war, multi-settlement colonization, trade, diplomacy, seasons, day/night, save/load, share-by-seed, and emergent religion & culture.
Still open (contributions welcome):
- Art & feel — foot-IK / no foot-slide, cinematic / follow camera, building interiors, weather VFX (rain, snow, fog).
- Deeper world — individual migration, wildlife & livestock, walkable rivers & fishing, terrain-shaped culture.
- Interaction — an LLM "oracle" you can ask about the world, a "model yourself as an agent" mode, optional objectives.
- Scale (later) — a real macro↔micro bridge (the planet driving the civ) and multiple regions / parallel civilizations, once Córdoba is deep enough.
This is an open sandbox — PRs welcome (bug fixes, balance, new agent behaviors,
era-specific building kits, performance). Keep npm run build green and only add
freely-licensed assets. Start with CONTRIBUTING.md.
Source code: MIT — see LICENSE.
Bundled 3D assets & Earth data: free licenses (CC0 / public domain) — see
ASSETS_CREDITS.md.


