polis-genesis 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- polis_genesis-0.2.0/LICENSE +21 -0
- polis_genesis-0.2.0/PKG-INFO +217 -0
- polis_genesis-0.2.0/README.md +194 -0
- polis_genesis-0.2.0/pyproject.toml +44 -0
- polis_genesis-0.2.0/python/polis_genesis/__init__.py +5 -0
- polis_genesis-0.2.0/python/polis_genesis/__main__.py +4 -0
- polis_genesis-0.2.0/python/polis_genesis/cli.py +97 -0
- polis_genesis-0.2.0/python/polis_genesis.egg-info/PKG-INFO +217 -0
- polis_genesis-0.2.0/python/polis_genesis.egg-info/SOURCES.txt +11 -0
- polis_genesis-0.2.0/python/polis_genesis.egg-info/dependency_links.txt +1 -0
- polis_genesis-0.2.0/python/polis_genesis.egg-info/entry_points.txt +3 -0
- polis_genesis-0.2.0/python/polis_genesis.egg-info/top_level.txt +1 -0
- polis_genesis-0.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eyad Ahmed
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: polis-genesis
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A living autonomous multi agent society simulation with neural minds, realistic economics, and 3D visualizer
|
|
5
|
+
Author: Eyad Stein
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/eyadstein/polis-genesis
|
|
8
|
+
Project-URL: Documentation, https://eyadstein.github.io/polis-genesis/world.html
|
|
9
|
+
Project-URL: Repository, https://github.com/eyadstein/polis-genesis
|
|
10
|
+
Project-URL: Issues, https://github.com/eyadstein/polis-genesis/issues
|
|
11
|
+
Keywords: simulation,multi-agent,artificial-life,society,neural-network,generative-agents,threejs,rust
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Rust
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Games/Entertainment :: Simulation
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Polis Genesis
|
|
25
|
+
|
|
26
|
+
> **An autonomous town simulation where artificial life meets a living
|
|
27
|
+
> 3D world.**
|
|
28
|
+
|
|
29
|
+
[](https://eyadstein.github.io/polis-genesis/)
|
|
31
|
+
|
|
32
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/ci.yml)
|
|
33
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/pages.yml)
|
|
35
|
+
[](LICENSE)
|
|
37
|
+
[](https://pypi.org/project/polis-genesis/)
|
|
38
|
+
|
|
39
|
+
**[🌐 Open the live simulation
|
|
40
|
+
→](https://eyadstein.github.io/polis-genesis/)**
|
|
41
|
+
|
|
42
|
+
------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
**Polis Genesis** is a real-time, 3D town simulation built around
|
|
47
|
+
autonomous agents. Each resident has its own genome, needs, moods,
|
|
48
|
+
memories, relationships, and a neural-network-driven mind.
|
|
49
|
+
|
|
50
|
+
Residents make decisions, work, interact, form families, and participate
|
|
51
|
+
in an evolving virtual society. Rather than relying entirely on scripted
|
|
52
|
+
events, the simulation brings together individual behavior and
|
|
53
|
+
interconnected systems to explore how a virtual society develops.
|
|
54
|
+
|
|
55
|
+
Try the hosted viewer without installing anything:
|
|
56
|
+
|
|
57
|
+
**[Enter Polis Genesis](https://eyadstein.github.io/polis-genesis/)**
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Autonomous agents** --- neural-network-driven behavior that learns
|
|
62
|
+
from experience.
|
|
63
|
+
- **Needs and daily life** --- food, water, sleep, work, social
|
|
64
|
+
interaction, and other needs shape decisions.
|
|
65
|
+
- **Economy** --- jobs, salaries, housing, taxes, and a shared town
|
|
66
|
+
treasury.
|
|
67
|
+
- **Families and genealogy** --- relationships, children, genetic
|
|
68
|
+
inheritance, and mutation.
|
|
69
|
+
- **Law and order** --- crime, police, courts, fines, and prisons.
|
|
70
|
+
- **Dynamic environment** --- day/night transitions, seasonal
|
|
71
|
+
lighting, waterways, fountains, and ambient sound.
|
|
72
|
+
- **Interactive 3D viewer** --- a browser-based world built with
|
|
73
|
+
Three.js and Vite.
|
|
74
|
+
- **Python CLI** --- console, server, and web commands for interacting
|
|
75
|
+
with the simulation.
|
|
76
|
+
- **Snapshots and analytics** --- JSON exports, statistical reports,
|
|
77
|
+
and replay functionality.
|
|
78
|
+
|
|
79
|
+
## Getting Started
|
|
80
|
+
|
|
81
|
+
### Try it online
|
|
82
|
+
|
|
83
|
+
Open the live demo:
|
|
84
|
+
|
|
85
|
+
**https://eyadstein.github.io/polis-genesis/**
|
|
86
|
+
|
|
87
|
+
### Install the Python package
|
|
88
|
+
|
|
89
|
+
``` bash
|
|
90
|
+
pip install polis-genesis
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Run the simulation
|
|
94
|
+
|
|
95
|
+
Start the console interface:
|
|
96
|
+
|
|
97
|
+
``` bash
|
|
98
|
+
polis-genesis console
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Start the local server:
|
|
102
|
+
|
|
103
|
+
``` bash
|
|
104
|
+
polis-genesis serve
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Open the local viewer address printed by the server. Depending on the
|
|
108
|
+
configuration, it may be available at
|
|
109
|
+
`http://localhost:8787/world.html`.
|
|
110
|
+
|
|
111
|
+
Launch web mode:
|
|
112
|
+
|
|
113
|
+
``` bash
|
|
114
|
+
polis-genesis web
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Build from Source
|
|
118
|
+
|
|
119
|
+
### Prerequisites
|
|
120
|
+
|
|
121
|
+
- Rust and Cargo
|
|
122
|
+
- Node.js and npm
|
|
123
|
+
- Python for Python tooling
|
|
124
|
+
|
|
125
|
+
### Run the simulation
|
|
126
|
+
|
|
127
|
+
From the repository root:
|
|
128
|
+
|
|
129
|
+
``` bash
|
|
130
|
+
cargo run --release -p polis_cli -- 1 3000 200
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Start the 3D viewer
|
|
134
|
+
|
|
135
|
+
``` bash
|
|
136
|
+
cd viewer
|
|
137
|
+
npm ci
|
|
138
|
+
npm run dev
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Vite prints the local development URL in the terminal.
|
|
142
|
+
|
|
143
|
+
### Build the production viewer
|
|
144
|
+
|
|
145
|
+
From the `viewer` directory:
|
|
146
|
+
|
|
147
|
+
``` bash
|
|
148
|
+
npm run build
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The generated static site is written to `viewer/dist`. GitHub Actions
|
|
152
|
+
builds and deploys the viewer to GitHub Pages.
|
|
153
|
+
|
|
154
|
+
## Technology Stack
|
|
155
|
+
|
|
156
|
+
Component Technology
|
|
157
|
+
------------------------ ----------------
|
|
158
|
+
Simulation engine Rust
|
|
159
|
+
3D rendering Three.js
|
|
160
|
+
Front-end tooling Vite
|
|
161
|
+
Python interface Python
|
|
162
|
+
Continuous integration GitHub Actions
|
|
163
|
+
Demo hosting GitHub Pages
|
|
164
|
+
|
|
165
|
+
## Roadmap
|
|
166
|
+
|
|
167
|
+
- [x] Core engine, genomes, needs, moods, and movement
|
|
168
|
+
- [x] Economy, jobs, and housing
|
|
169
|
+
- [x] Relationships, children, and inheritance
|
|
170
|
+
- [x] Memory and social interaction
|
|
171
|
+
- [x] Law enforcement and justice systems
|
|
172
|
+
- [ ] Schools, belief systems, culture, and sports
|
|
173
|
+
- [ ] Expanded survival mechanics and emergent epochs
|
|
174
|
+
- [ ] Enhanced observation, replay, and analytics
|
|
175
|
+
|
|
176
|
+
## Documentation
|
|
177
|
+
|
|
178
|
+
- [Design overview](docs/DESIGN.md)
|
|
179
|
+
- [Contributing guidelines](CONTRIBUTING.md)
|
|
180
|
+
- [Changelog](CHANGELOG.md)
|
|
181
|
+
- [License](LICENSE)
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
Contributions, bug reports, and ideas are welcome.
|
|
186
|
+
|
|
187
|
+
1. Fork the repository.
|
|
188
|
+
2. Create a branch for your changes.
|
|
189
|
+
3. Implement your changes and add tests where appropriate.
|
|
190
|
+
4. Run the relevant checks.
|
|
191
|
+
5. Submit a pull request describing your changes.
|
|
192
|
+
|
|
193
|
+
Run the Rust checks:
|
|
194
|
+
|
|
195
|
+
``` bash
|
|
196
|
+
cargo test --workspace --all-features --locked
|
|
197
|
+
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
For viewer changes:
|
|
201
|
+
|
|
202
|
+
``` bash
|
|
203
|
+
cd viewer
|
|
204
|
+
npm ci
|
|
205
|
+
npm test
|
|
206
|
+
npm run build
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
Distributed under the [MIT License](LICENSE).
|
|
212
|
+
|
|
213
|
+
------------------------------------------------------------------------
|
|
214
|
+
|
|
215
|
+
**Explore the world. Observe the agents. Watch the town evolve.**
|
|
216
|
+
|
|
217
|
+
**[ENTER POLIS GENESIS →](https://eyadstein.github.io/polis-genesis/)**
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Polis Genesis
|
|
2
|
+
|
|
3
|
+
> **An autonomous town simulation where artificial life meets a living
|
|
4
|
+
> 3D world.**
|
|
5
|
+
|
|
6
|
+
[](https://eyadstein.github.io/polis-genesis/)
|
|
8
|
+
|
|
9
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/pages.yml)
|
|
12
|
+
[](LICENSE)
|
|
14
|
+
[](https://pypi.org/project/polis-genesis/)
|
|
15
|
+
|
|
16
|
+
**[🌐 Open the live simulation
|
|
17
|
+
→](https://eyadstein.github.io/polis-genesis/)**
|
|
18
|
+
|
|
19
|
+
------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
**Polis Genesis** is a real-time, 3D town simulation built around
|
|
24
|
+
autonomous agents. Each resident has its own genome, needs, moods,
|
|
25
|
+
memories, relationships, and a neural-network-driven mind.
|
|
26
|
+
|
|
27
|
+
Residents make decisions, work, interact, form families, and participate
|
|
28
|
+
in an evolving virtual society. Rather than relying entirely on scripted
|
|
29
|
+
events, the simulation brings together individual behavior and
|
|
30
|
+
interconnected systems to explore how a virtual society develops.
|
|
31
|
+
|
|
32
|
+
Try the hosted viewer without installing anything:
|
|
33
|
+
|
|
34
|
+
**[Enter Polis Genesis](https://eyadstein.github.io/polis-genesis/)**
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **Autonomous agents** --- neural-network-driven behavior that learns
|
|
39
|
+
from experience.
|
|
40
|
+
- **Needs and daily life** --- food, water, sleep, work, social
|
|
41
|
+
interaction, and other needs shape decisions.
|
|
42
|
+
- **Economy** --- jobs, salaries, housing, taxes, and a shared town
|
|
43
|
+
treasury.
|
|
44
|
+
- **Families and genealogy** --- relationships, children, genetic
|
|
45
|
+
inheritance, and mutation.
|
|
46
|
+
- **Law and order** --- crime, police, courts, fines, and prisons.
|
|
47
|
+
- **Dynamic environment** --- day/night transitions, seasonal
|
|
48
|
+
lighting, waterways, fountains, and ambient sound.
|
|
49
|
+
- **Interactive 3D viewer** --- a browser-based world built with
|
|
50
|
+
Three.js and Vite.
|
|
51
|
+
- **Python CLI** --- console, server, and web commands for interacting
|
|
52
|
+
with the simulation.
|
|
53
|
+
- **Snapshots and analytics** --- JSON exports, statistical reports,
|
|
54
|
+
and replay functionality.
|
|
55
|
+
|
|
56
|
+
## Getting Started
|
|
57
|
+
|
|
58
|
+
### Try it online
|
|
59
|
+
|
|
60
|
+
Open the live demo:
|
|
61
|
+
|
|
62
|
+
**https://eyadstein.github.io/polis-genesis/**
|
|
63
|
+
|
|
64
|
+
### Install the Python package
|
|
65
|
+
|
|
66
|
+
``` bash
|
|
67
|
+
pip install polis-genesis
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Run the simulation
|
|
71
|
+
|
|
72
|
+
Start the console interface:
|
|
73
|
+
|
|
74
|
+
``` bash
|
|
75
|
+
polis-genesis console
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Start the local server:
|
|
79
|
+
|
|
80
|
+
``` bash
|
|
81
|
+
polis-genesis serve
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Open the local viewer address printed by the server. Depending on the
|
|
85
|
+
configuration, it may be available at
|
|
86
|
+
`http://localhost:8787/world.html`.
|
|
87
|
+
|
|
88
|
+
Launch web mode:
|
|
89
|
+
|
|
90
|
+
``` bash
|
|
91
|
+
polis-genesis web
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Build from Source
|
|
95
|
+
|
|
96
|
+
### Prerequisites
|
|
97
|
+
|
|
98
|
+
- Rust and Cargo
|
|
99
|
+
- Node.js and npm
|
|
100
|
+
- Python for Python tooling
|
|
101
|
+
|
|
102
|
+
### Run the simulation
|
|
103
|
+
|
|
104
|
+
From the repository root:
|
|
105
|
+
|
|
106
|
+
``` bash
|
|
107
|
+
cargo run --release -p polis_cli -- 1 3000 200
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Start the 3D viewer
|
|
111
|
+
|
|
112
|
+
``` bash
|
|
113
|
+
cd viewer
|
|
114
|
+
npm ci
|
|
115
|
+
npm run dev
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Vite prints the local development URL in the terminal.
|
|
119
|
+
|
|
120
|
+
### Build the production viewer
|
|
121
|
+
|
|
122
|
+
From the `viewer` directory:
|
|
123
|
+
|
|
124
|
+
``` bash
|
|
125
|
+
npm run build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The generated static site is written to `viewer/dist`. GitHub Actions
|
|
129
|
+
builds and deploys the viewer to GitHub Pages.
|
|
130
|
+
|
|
131
|
+
## Technology Stack
|
|
132
|
+
|
|
133
|
+
Component Technology
|
|
134
|
+
------------------------ ----------------
|
|
135
|
+
Simulation engine Rust
|
|
136
|
+
3D rendering Three.js
|
|
137
|
+
Front-end tooling Vite
|
|
138
|
+
Python interface Python
|
|
139
|
+
Continuous integration GitHub Actions
|
|
140
|
+
Demo hosting GitHub Pages
|
|
141
|
+
|
|
142
|
+
## Roadmap
|
|
143
|
+
|
|
144
|
+
- [x] Core engine, genomes, needs, moods, and movement
|
|
145
|
+
- [x] Economy, jobs, and housing
|
|
146
|
+
- [x] Relationships, children, and inheritance
|
|
147
|
+
- [x] Memory and social interaction
|
|
148
|
+
- [x] Law enforcement and justice systems
|
|
149
|
+
- [ ] Schools, belief systems, culture, and sports
|
|
150
|
+
- [ ] Expanded survival mechanics and emergent epochs
|
|
151
|
+
- [ ] Enhanced observation, replay, and analytics
|
|
152
|
+
|
|
153
|
+
## Documentation
|
|
154
|
+
|
|
155
|
+
- [Design overview](docs/DESIGN.md)
|
|
156
|
+
- [Contributing guidelines](CONTRIBUTING.md)
|
|
157
|
+
- [Changelog](CHANGELOG.md)
|
|
158
|
+
- [License](LICENSE)
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
Contributions, bug reports, and ideas are welcome.
|
|
163
|
+
|
|
164
|
+
1. Fork the repository.
|
|
165
|
+
2. Create a branch for your changes.
|
|
166
|
+
3. Implement your changes and add tests where appropriate.
|
|
167
|
+
4. Run the relevant checks.
|
|
168
|
+
5. Submit a pull request describing your changes.
|
|
169
|
+
|
|
170
|
+
Run the Rust checks:
|
|
171
|
+
|
|
172
|
+
``` bash
|
|
173
|
+
cargo test --workspace --all-features --locked
|
|
174
|
+
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
For viewer changes:
|
|
178
|
+
|
|
179
|
+
``` bash
|
|
180
|
+
cd viewer
|
|
181
|
+
npm ci
|
|
182
|
+
npm test
|
|
183
|
+
npm run build
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
Distributed under the [MIT License](LICENSE).
|
|
189
|
+
|
|
190
|
+
------------------------------------------------------------------------
|
|
191
|
+
|
|
192
|
+
**Explore the world. Observe the agents. Watch the town evolve.**
|
|
193
|
+
|
|
194
|
+
**[ENTER POLIS GENESIS →](https://eyadstein.github.io/polis-genesis/)**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "polis-genesis"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "A living autonomous multi agent society simulation with neural minds, realistic economics, and 3D visualizer"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Eyad Stein" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"simulation",
|
|
15
|
+
"multi-agent",
|
|
16
|
+
"artificial-life",
|
|
17
|
+
"society",
|
|
18
|
+
"neural-network",
|
|
19
|
+
"generative-agents",
|
|
20
|
+
"threejs",
|
|
21
|
+
"rust",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Rust",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
30
|
+
"Topic :: Games/Entertainment :: Simulation",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
polis-genesis = "polis_genesis.cli:main"
|
|
35
|
+
polis = "polis_genesis.cli:main"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/eyadstein/polis-genesis"
|
|
39
|
+
Documentation = "https://eyadstein.github.io/polis-genesis/world.html"
|
|
40
|
+
Repository = "https://github.com/eyadstein/polis-genesis"
|
|
41
|
+
Issues = "https://github.com/eyadstein/polis-genesis/issues"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["python"]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command line interface for Polis Genesis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import shutil
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
import webbrowser
|
|
11
|
+
|
|
12
|
+
def find_cli_binary() -> str | None:
|
|
13
|
+
# Look in cargo target directories
|
|
14
|
+
candidates = [
|
|
15
|
+
os.path.join(os.path.dirname(__file__), "..", "..", "target", "release", "polis_cli.exe"),
|
|
16
|
+
os.path.join(os.path.dirname(__file__), "..", "..", "target", "debug", "polis_cli.exe"),
|
|
17
|
+
os.path.join(os.path.dirname(__file__), "..", "..", "target", "release", "polis_cli"),
|
|
18
|
+
os.path.join(os.path.dirname(__file__), "..", "..", "target", "debug", "polis_cli"),
|
|
19
|
+
shutil.which("polis_cli"),
|
|
20
|
+
shutil.which("polis_cli.exe"),
|
|
21
|
+
]
|
|
22
|
+
for c in candidates:
|
|
23
|
+
if c and os.path.exists(c):
|
|
24
|
+
return os.path.abspath(c)
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
def cmd_console(args: argparse.Namespace) -> None:
|
|
28
|
+
bin_path = find_cli_binary()
|
|
29
|
+
if bin_path:
|
|
30
|
+
subprocess.run([bin_path, "console", str(args.seed), str(args.population), str(args.ticks), str(args.delay)])
|
|
31
|
+
else:
|
|
32
|
+
# Fall back to cargo run
|
|
33
|
+
cmd = ["cargo", "run", "--release", "-p", "polis_cli", "--", "console", str(args.seed), str(args.population), str(args.ticks), str(args.delay)]
|
|
34
|
+
try:
|
|
35
|
+
subprocess.run(cmd)
|
|
36
|
+
except FileNotFoundError:
|
|
37
|
+
print("cargo was not found. Please install Rust from https://rustup.rs to compile polis_cli.")
|
|
38
|
+
sys.exit(1)
|
|
39
|
+
|
|
40
|
+
def cmd_serve(args: argparse.Namespace) -> None:
|
|
41
|
+
bin_path = find_cli_binary()
|
|
42
|
+
cmd = [bin_path or "cargo", "serve" if bin_path else "run", *(["--release", "-p", "polis_cli", "--", "serve"] if not bin_path else []), str(args.seed), str(args.population), str(args.port)]
|
|
43
|
+
try:
|
|
44
|
+
subprocess.run(cmd)
|
|
45
|
+
except KeyboardInterrupt:
|
|
46
|
+
print("\nTown server stopped.")
|
|
47
|
+
|
|
48
|
+
def cmd_web(args: argparse.Namespace) -> None:
|
|
49
|
+
url = args.url or "https://eyadstein.github.io/polis-genesis/world.html"
|
|
50
|
+
print(f"Opening Polis Genesis in browser: {url}")
|
|
51
|
+
webbrowser.open(url)
|
|
52
|
+
|
|
53
|
+
def cmd_info(_args: argparse.Namespace) -> None:
|
|
54
|
+
print("==================================================")
|
|
55
|
+
print(" Polis Genesis: Society & Mind Simulator")
|
|
56
|
+
print(" Version: 0.2.0")
|
|
57
|
+
print(" Repository: https://github.com/eyadstein/polis-genesis")
|
|
58
|
+
print(" Website: https://eyadstein.github.io/polis-genesis/world.html")
|
|
59
|
+
print("==================================================")
|
|
60
|
+
print(" Districts: 16 districts with central water fountains")
|
|
61
|
+
print(" Needs: Hunger, Thirst, Energy, Social, Purpose")
|
|
62
|
+
print(" Actions: Eat, Drink, Rest, Work, Socialize, Wander")
|
|
63
|
+
print(" Economics: Real estate, rents, progressive taxes")
|
|
64
|
+
print("==================================================")
|
|
65
|
+
|
|
66
|
+
def main() -> None:
|
|
67
|
+
parser = argparse.ArgumentParser(prog="polis-genesis", description="Polis Genesis Autonomous Simulation")
|
|
68
|
+
subparsers = parser.add_subparsers(dest="command", help="Subcommand to execute")
|
|
69
|
+
|
|
70
|
+
p_console = subparsers.add_parser("console", help="Run interactive terminal world")
|
|
71
|
+
p_console.add_argument("--seed", type=int, default=1, help="World RNG seed")
|
|
72
|
+
p_console.add_argument("--population", type=int, default=120, help="Initial population")
|
|
73
|
+
p_console.add_argument("--ticks", type=int, default=500, help="Total simulation ticks")
|
|
74
|
+
p_console.add_argument("--delay", type=int, default=70, help="Milliseconds between ticks")
|
|
75
|
+
p_console.set_defaults(func=cmd_console)
|
|
76
|
+
|
|
77
|
+
p_serve = subparsers.add_parser("serve", help="Run live town server")
|
|
78
|
+
p_serve.add_argument("--seed", type=int, default=1, help="World RNG seed")
|
|
79
|
+
p_serve.add_argument("--population", type=int, default=200, help="Initial population")
|
|
80
|
+
p_serve.add_argument("--port", type=int, default=8787, help="Server port")
|
|
81
|
+
p_serve.set_defaults(func=cmd_serve)
|
|
82
|
+
|
|
83
|
+
p_web = subparsers.add_parser("web", help="Open the 3D visualizer website")
|
|
84
|
+
p_web.add_argument("--url", type=str, default=None, help="Target URL")
|
|
85
|
+
p_web.set_defaults(func=cmd_web)
|
|
86
|
+
|
|
87
|
+
p_info = subparsers.add_parser("info", help="Show system and simulation information")
|
|
88
|
+
p_info.set_defaults(func=cmd_info)
|
|
89
|
+
|
|
90
|
+
args = parser.parse_args()
|
|
91
|
+
if hasattr(args, "func"):
|
|
92
|
+
args.func(args)
|
|
93
|
+
else:
|
|
94
|
+
cmd_info(args)
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: polis-genesis
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A living autonomous multi agent society simulation with neural minds, realistic economics, and 3D visualizer
|
|
5
|
+
Author: Eyad Stein
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/eyadstein/polis-genesis
|
|
8
|
+
Project-URL: Documentation, https://eyadstein.github.io/polis-genesis/world.html
|
|
9
|
+
Project-URL: Repository, https://github.com/eyadstein/polis-genesis
|
|
10
|
+
Project-URL: Issues, https://github.com/eyadstein/polis-genesis/issues
|
|
11
|
+
Keywords: simulation,multi-agent,artificial-life,society,neural-network,generative-agents,threejs,rust
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Rust
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Games/Entertainment :: Simulation
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Polis Genesis
|
|
25
|
+
|
|
26
|
+
> **An autonomous town simulation where artificial life meets a living
|
|
27
|
+
> 3D world.**
|
|
28
|
+
|
|
29
|
+
[](https://eyadstein.github.io/polis-genesis/)
|
|
31
|
+
|
|
32
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/ci.yml)
|
|
33
|
+
[](https://github.com/eyadstein/polis-genesis/actions/workflows/pages.yml)
|
|
35
|
+
[](LICENSE)
|
|
37
|
+
[](https://pypi.org/project/polis-genesis/)
|
|
38
|
+
|
|
39
|
+
**[🌐 Open the live simulation
|
|
40
|
+
→](https://eyadstein.github.io/polis-genesis/)**
|
|
41
|
+
|
|
42
|
+
------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
**Polis Genesis** is a real-time, 3D town simulation built around
|
|
47
|
+
autonomous agents. Each resident has its own genome, needs, moods,
|
|
48
|
+
memories, relationships, and a neural-network-driven mind.
|
|
49
|
+
|
|
50
|
+
Residents make decisions, work, interact, form families, and participate
|
|
51
|
+
in an evolving virtual society. Rather than relying entirely on scripted
|
|
52
|
+
events, the simulation brings together individual behavior and
|
|
53
|
+
interconnected systems to explore how a virtual society develops.
|
|
54
|
+
|
|
55
|
+
Try the hosted viewer without installing anything:
|
|
56
|
+
|
|
57
|
+
**[Enter Polis Genesis](https://eyadstein.github.io/polis-genesis/)**
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Autonomous agents** --- neural-network-driven behavior that learns
|
|
62
|
+
from experience.
|
|
63
|
+
- **Needs and daily life** --- food, water, sleep, work, social
|
|
64
|
+
interaction, and other needs shape decisions.
|
|
65
|
+
- **Economy** --- jobs, salaries, housing, taxes, and a shared town
|
|
66
|
+
treasury.
|
|
67
|
+
- **Families and genealogy** --- relationships, children, genetic
|
|
68
|
+
inheritance, and mutation.
|
|
69
|
+
- **Law and order** --- crime, police, courts, fines, and prisons.
|
|
70
|
+
- **Dynamic environment** --- day/night transitions, seasonal
|
|
71
|
+
lighting, waterways, fountains, and ambient sound.
|
|
72
|
+
- **Interactive 3D viewer** --- a browser-based world built with
|
|
73
|
+
Three.js and Vite.
|
|
74
|
+
- **Python CLI** --- console, server, and web commands for interacting
|
|
75
|
+
with the simulation.
|
|
76
|
+
- **Snapshots and analytics** --- JSON exports, statistical reports,
|
|
77
|
+
and replay functionality.
|
|
78
|
+
|
|
79
|
+
## Getting Started
|
|
80
|
+
|
|
81
|
+
### Try it online
|
|
82
|
+
|
|
83
|
+
Open the live demo:
|
|
84
|
+
|
|
85
|
+
**https://eyadstein.github.io/polis-genesis/**
|
|
86
|
+
|
|
87
|
+
### Install the Python package
|
|
88
|
+
|
|
89
|
+
``` bash
|
|
90
|
+
pip install polis-genesis
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Run the simulation
|
|
94
|
+
|
|
95
|
+
Start the console interface:
|
|
96
|
+
|
|
97
|
+
``` bash
|
|
98
|
+
polis-genesis console
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Start the local server:
|
|
102
|
+
|
|
103
|
+
``` bash
|
|
104
|
+
polis-genesis serve
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Open the local viewer address printed by the server. Depending on the
|
|
108
|
+
configuration, it may be available at
|
|
109
|
+
`http://localhost:8787/world.html`.
|
|
110
|
+
|
|
111
|
+
Launch web mode:
|
|
112
|
+
|
|
113
|
+
``` bash
|
|
114
|
+
polis-genesis web
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Build from Source
|
|
118
|
+
|
|
119
|
+
### Prerequisites
|
|
120
|
+
|
|
121
|
+
- Rust and Cargo
|
|
122
|
+
- Node.js and npm
|
|
123
|
+
- Python for Python tooling
|
|
124
|
+
|
|
125
|
+
### Run the simulation
|
|
126
|
+
|
|
127
|
+
From the repository root:
|
|
128
|
+
|
|
129
|
+
``` bash
|
|
130
|
+
cargo run --release -p polis_cli -- 1 3000 200
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Start the 3D viewer
|
|
134
|
+
|
|
135
|
+
``` bash
|
|
136
|
+
cd viewer
|
|
137
|
+
npm ci
|
|
138
|
+
npm run dev
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Vite prints the local development URL in the terminal.
|
|
142
|
+
|
|
143
|
+
### Build the production viewer
|
|
144
|
+
|
|
145
|
+
From the `viewer` directory:
|
|
146
|
+
|
|
147
|
+
``` bash
|
|
148
|
+
npm run build
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The generated static site is written to `viewer/dist`. GitHub Actions
|
|
152
|
+
builds and deploys the viewer to GitHub Pages.
|
|
153
|
+
|
|
154
|
+
## Technology Stack
|
|
155
|
+
|
|
156
|
+
Component Technology
|
|
157
|
+
------------------------ ----------------
|
|
158
|
+
Simulation engine Rust
|
|
159
|
+
3D rendering Three.js
|
|
160
|
+
Front-end tooling Vite
|
|
161
|
+
Python interface Python
|
|
162
|
+
Continuous integration GitHub Actions
|
|
163
|
+
Demo hosting GitHub Pages
|
|
164
|
+
|
|
165
|
+
## Roadmap
|
|
166
|
+
|
|
167
|
+
- [x] Core engine, genomes, needs, moods, and movement
|
|
168
|
+
- [x] Economy, jobs, and housing
|
|
169
|
+
- [x] Relationships, children, and inheritance
|
|
170
|
+
- [x] Memory and social interaction
|
|
171
|
+
- [x] Law enforcement and justice systems
|
|
172
|
+
- [ ] Schools, belief systems, culture, and sports
|
|
173
|
+
- [ ] Expanded survival mechanics and emergent epochs
|
|
174
|
+
- [ ] Enhanced observation, replay, and analytics
|
|
175
|
+
|
|
176
|
+
## Documentation
|
|
177
|
+
|
|
178
|
+
- [Design overview](docs/DESIGN.md)
|
|
179
|
+
- [Contributing guidelines](CONTRIBUTING.md)
|
|
180
|
+
- [Changelog](CHANGELOG.md)
|
|
181
|
+
- [License](LICENSE)
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
Contributions, bug reports, and ideas are welcome.
|
|
186
|
+
|
|
187
|
+
1. Fork the repository.
|
|
188
|
+
2. Create a branch for your changes.
|
|
189
|
+
3. Implement your changes and add tests where appropriate.
|
|
190
|
+
4. Run the relevant checks.
|
|
191
|
+
5. Submit a pull request describing your changes.
|
|
192
|
+
|
|
193
|
+
Run the Rust checks:
|
|
194
|
+
|
|
195
|
+
``` bash
|
|
196
|
+
cargo test --workspace --all-features --locked
|
|
197
|
+
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
For viewer changes:
|
|
201
|
+
|
|
202
|
+
``` bash
|
|
203
|
+
cd viewer
|
|
204
|
+
npm ci
|
|
205
|
+
npm test
|
|
206
|
+
npm run build
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
Distributed under the [MIT License](LICENSE).
|
|
212
|
+
|
|
213
|
+
------------------------------------------------------------------------
|
|
214
|
+
|
|
215
|
+
**Explore the world. Observe the agents. Watch the town evolve.**
|
|
216
|
+
|
|
217
|
+
**[ENTER POLIS GENESIS →](https://eyadstein.github.io/polis-genesis/)**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
python/polis_genesis/__init__.py
|
|
5
|
+
python/polis_genesis/__main__.py
|
|
6
|
+
python/polis_genesis/cli.py
|
|
7
|
+
python/polis_genesis.egg-info/PKG-INFO
|
|
8
|
+
python/polis_genesis.egg-info/SOURCES.txt
|
|
9
|
+
python/polis_genesis.egg-info/dependency_links.txt
|
|
10
|
+
python/polis_genesis.egg-info/entry_points.txt
|
|
11
|
+
python/polis_genesis.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
polis_genesis
|