Polis Genesis
An autonomous town simulation where artificial life meets a living 3D world.
Overview
Polis Genesis models a town of autonomous residents. Each person has a genome, needs, mood, memories, relationships, and a mind that chooses actions. Residents work, trade, find homes, form families, talk, and respond to crime and the changing environment as the town evolves.
The Rust engine keeps simulation state and seeded behavior reproducible. A Python command-line package runs the tools, while a browser viewer renders exported worlds and replays in 3D. A local HTTP server can also drive the viewer with a live simulation.
Features
- People and behavior: genomes, needs, moods, movement, memory, relationships, conversation, and family life.
- Town systems: jobs, wages, markets, housing, taxes, law enforcement, courts, and a shared treasury.
- World simulation: seeded runs, reports, JSON snapshots, and recorded replays.
- Resumable Rust state: versioned JSON saves preserve the full simulation, including its random-number generator; these are separate from viewer snapshots.
- 3D viewer: districts, residents, detailed homes, civic buildings, varied trees, spaced streets, fountain plazas, a beach promenade, bridges, animated water, and a distant castle backed by low-poly mountains, built with Three.js and Vite. Parked cars are visual markers for occupied homes with a resident balance of at least 250 coins; vehicles are not yet owned or simulated by the Rust economy.
- Optional local speech: the
ollamafeature can use a local Ollama model; rule-based speech remains the default and fallback. - Python analysis: a standard-library report script reads exported town JSON.
Architecture
flowchart LR
User[User] --> Py[Python package and CLI]
User --> Bin[Rust CLI]
Py --> Bin
Bin --> Core[polis_core: world, people, economy and justice]
Core --> Mind[polis_mind: rule-based or optional Ollama speech]
Bin -->|snapshot and replay JSON| Viewer[TypeScript viewer]
Bin -->|local HTTP town API| Viewer
Viewer -->|Vite development server| Browser[Web browser, Three.js]
Snapshot[Exported town JSON] --> Analysis[Python analysis tool]
Getting started
Install the Python package
Requires Python 3.9 or newer. Install the published package with:
python -m pip install polis-genesis
The package provides polis-genesis and polis commands. For example, start the interactive console with the default seed, population, and duration:
polis-genesis console
Set the seed, population, number of ticks, or console delay with options:
polis-genesis console --seed 7 --population 120 --ticks 500 --delay 80
Start a local town API server (default port 8787):
polis-genesis serve --seed 1 --population 200 --port 8787
Open the hosted viewer from the command line with polis-genesis web.
Run from source
Install stable Rust and Cargo, Python 3.9 or newer, and Node.js with npm. From the repository root, run a simulation and print its report:
cargo run --release -p polis_cli -- 1 3000 200
The positional arguments are seed, ticks, and population. To write a snapshot and replay as well:
cargo run --release -p polis_cli -- 1 3000 200 town.json replay.json 10
Analyze the exported snapshot with the Python standard library:
python tools/analyze.py town.json
Town exports use format 3 and record the exact seed, initial population, map size, and market food stock over time. The viewer also reads format 2 snapshots.
Rust applications can save and resume the complete simulation state:
let save = world.save_json()?;
let resumed = polis_core::World::load_json(&save)?;
Simulation saves currently use format version 1. The loader rejects unsupported versions and validates restored state. Town exports and replay files remain separate formats for the viewer.
Run the live 3D viewer locally
In one terminal at the repository root, start the simulation server:
cargo run --release -p polis_cli -- serve 1 200 8787
In a second terminal, install viewer dependencies and start Vite:
cd viewer
npm ci
npm run dev
Open the Vite URL printed in the terminal and navigate to world.html. The development server forwards /api requests to the town server on 127.0.0.1:8787. On Windows, ./run.ps1 starts both processes and opens the viewer.
With the live town server connected, the viewer toolbar includes Add 1 person, Add 5 people, and Add 20 people controls. Recorded replays, including the static GitHub Pages demo, cannot change their population; start the live server above to use these controls.
Build the static viewer from the viewer directory with:
npm run build
The output is written to viewer/dist. GitHub Actions builds the site and publishes it to Pages.
Releases and project status
The next coordinated release is v0.4.0. Its versioned tag triggers GitHub Actions to build the cross-platform Rust CLI binaries and static viewer bundle, create the GitHub release, and publish the Python package. The Python package metadata and CLI version output are aligned at 0.4.0. See the changelog for changes and the GitHub releases page for release assets.
Documentation
- Agent architecture and evaluation
- Design notes
- Viewer performance notes
- Contributing guide
- Changelog
- MIT License
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md for setup, project rules, and checks used by CI.
License
Polis Genesis is distributed under the MIT License.
Metadata
Release files for polis-genesis 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| polis_genesis-0.4.0.tar.gz | 7.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polis_genesis-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / polis_genesis-0.4.0.tar.gz
| Download URL | polis_genesis-0.4.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65bf96690bfd715ac523730da69c746b38da1417e60eff8fd7e631915e8ed10a
|
|
BLAKE2b-256 checksum How to use checksums |
84a9610bdea11c5462f8ad93ab9507555c4e796eb23486420cbee747523065ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / polis_genesis-0.4.0-py3-none-any.whl
| Download URL | polis_genesis-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3605054498a8981cdf9ba6653e496350194285418b3cd2cc091faecfa2ed21c
|
|
BLAKE2b-256 checksum How to use checksums |
8058462b0a23e81dd1232c3776ba90f9dc91713d2649e7a84b6252a52671ffac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for polis-genesis 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for polis_genesis-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.