You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1e1e038
Browse filesBrowse the repository at this point in the historyBrowse files
To make Emscripten available in future shells, add this to your shell startup file:
119
+
120
+
```bash
121
+
source~/Developer/emsdk/emsdk_env.sh
122
+
```
123
+
124
+
If you prefer not to auto-activate it in every shell, run that `source` command only before rebuilding the engine.
125
+
126
+
On macOS with Homebrew, this also works:
127
+
128
+
```bash
129
+
brew install emscripten
130
+
emcc --version
131
+
```
132
+
133
+
134
+
## The WASM engine
135
+
136
+
The engine is a **pnpm workspace package** (`@micropolis/engine-wasm` in `packages/micropolis-engine/`). It is still built with **GNU make** and **Emscripten** (no CMake). A normal **`pnpm --filter micropolis run build`** runs **`prebuild`**, which invokes **`pnpm --filter @micropolis/engine-wasm run build`** → **`make install`** in that directory.
137
+
138
+
To rebuild the engine only:
139
+
140
+
```bash
141
+
cd packages/micropolis-engine
142
+
make clean install
143
+
```
144
+
145
+
Or from the repo root:
146
+
147
+
```bash
148
+
pnpm --filter @micropolis/engine-wasm run build
149
+
```
150
+
151
+
`make install` builds the C++ engine and copies these generated artifacts into `apps/micropolis/src/lib/`:
152
+
153
+
```text
154
+
micropolisengine.js
155
+
micropolisengine.wasm
156
+
micropolisengine.data
157
+
```
158
+
159
+
The checked-in makefile builds the engine for browser, worker, and Node environments:
160
+
161
+
```text
162
+
-s 'ENVIRONMENT=web,worker,node'
163
+
```
164
+
165
+
Node support is required for `pnpm --filter micropolis run micropolis -- sim ...` (or `cd apps/micropolis && pnpm run micropolis -- sim ...`).
166
+
167
+
168
+
## The micropolis CLI
169
+
170
+
The `micropolis` CLI reads, analyzes, visualizes, edits, and patches `.cty` save files, runs the WASM simulator headlessly, and exposes the command bus.
171
+
172
+
Run from the `apps/micropolis/` package directory after `pnpm install` at the repo root (or prefix with `pnpm --filter micropolis run` from the MicropolisCore root).
173
+
174
+
```bash
175
+
cd apps/micropolis
176
+
177
+
# City information and analysis (paths relative to this directory)
178
+
pnpm run micropolis -- city info ../../content/micropolis/cities/scenario_tokyo.cty
179
+
pnpm run micropolis -- city analyze ../../content/micropolis/cities/scenario_boston.cty
180
+
pnpm run micropolis -- city analyze --format json ../../content/micropolis/cities/radial.cty
pnpm run micropolis -- visualize emoji ../../content/micropolis/cities/radial.cty
185
+
186
+
# Edit city metadata
187
+
pnpm run micropolis -- city edit city.cty --funds 50000 --tax 9 --year 1960
188
+
189
+
# Patch scenario files with the values the engine injects at runtime
190
+
pnpm run micropolis -- city patch-scenario ../../content/micropolis/cities/scenario_tokyo.cty --dry-run
191
+
192
+
# Export to JSON (with optional tile map data)
193
+
pnpm run micropolis -- city export --format json --include-map city.cty
194
+
195
+
# Pipe from stdin
196
+
cat city.cty | pnpm run micropolis -- city info -
197
+
```
198
+
199
+
Full test suite and command reference: [documentation/notes/micropolis-js-tests.md](documentation/notes/micropolis-js-tests.md)
200
+
201
+
202
+
## How the engine talks to the UI
203
+
204
+
The WASM engine talks to the Svelte UI through a callback chain:
205
+
206
+
```
207
+
C++ Micropolis Core (WASM)
208
+
calls callback
209
+
Embind JSCallback Wrapper
210
+
delegates
211
+
MicropolisReactive.engineCallback
212
+
updates
213
+
$state / $derived Runes
214
+
triggers
215
+
Svelte 5 Runtime
216
+
updates DOM
217
+
UI Components + WebGL Renderer
218
+
```
219
+
220
+
221
+
## Working alongside MOOLLM
222
+
223
+
Soul City ties this repository to [MOOLLM](https://github.com/SimHacker/moollm) — the microworld skill framework where the **micropolis** skill, AI tutors, and related designs live. To work across engine code, the SvelteKit app, and MOOLLM skills in one flow:
224
+
225
+
1.**Check out MOOLLM and MicropolisCore in the same directory** (sibling folders under one parent, e.g. `~/Developer/` or `~/src/`):
Keeping them side-by-side makes paths predictable and matches how multi-root workspaces list folders.
234
+
235
+
2.**Add both repositories to your Cursor workspace** — and any other related checkouts you use (e.g. SimObliterator Suite for VitaMoo, design-only repos): use **File → Add Folder to Workspace…** (or your OS equivalent) and include each repo root, or open a multi-root `.code-workspace` file that lists those paths. Cursor can index and search across all of them together.
236
+
237
+
3.**Follow MOOLLM’s setup and install instructions first** (clone is already done if you used step 1):
-[MOOLLM QUICKSTART.md](https://github.com/SimHacker/moollm/blob/main/QUICKSTART.md) — open the repo in Cursor and wait until **Settings → Cursor Settings → Indexing → Codebase Indexing** reaches **100%**, as in MOOLLM’s quickstart.
241
+
242
+
4.**Then** install and build MicropolisCore using the prerequisites and commands below (Emscripten, `pnpm`, WASM engine, `micropolis` app).
243
+
244
+
Using the same layout with **other AI coding tools** (for example **Claude Code**) is plausible so both trees stay in context, but that workflow is **not yet tested or documented** here—Cursor + MOOLLM is the supported path today.
245
+
246
+
MOOLLM does not replace the Node/pnpm toolchain here; it complements this repo for skills, YAML Jazz, and agent orchestration alongside the engine and web app.
0 commit comments