Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to Econ-Engine are documented here. The changelog records what changed in each update. Design rationale, experiments, observations, and lessons are documented separately in [Lab Notes](LAB_NOTES.md).

## [LIFE15-Worker-069] - (2026-10-28)

- The Life engine runs in a Web Worker. The page keeps the clock and asks the worker for a goal 0.1 s ahead at the speed shown; the worker runs in slices of at most 50 ms and sends a view copy every stride minutes (the speed over 60, at least one).
- A view copy keeps only what the page reads: the routes of walks under way, each person's next wake-up in place of the wake-up queue, exchanges and walk records among the events, and current memory only for the followed person. It travels as its changes from the last copy sent.
- The page draws the newest copy at or before the clock; when the worker is behind, the clock waits instead of the page. Step shows the next minute once it arrives, and a change of speed jumps to the newest copy.
- The loading card stays until the worker has built its valley.
- New `viewCopy.ts`, `engineWorker.ts` and `engineLink.ts`; the playback functions in `valleyViewModel.ts` replace the per-frame engine step. New unit tests for the view copies, and rewritten playback tests.
- The engine is unchanged, so every fingerprint stays the same.
- The Life 15 specification is revised for update 069.

## [LIFE15-Planning-068] - (2026-10-27)

- A new route's coarse plan runs over a person's pieces, the joined-up patches of known ground within each 200 m chunk, in place of whole chunks. Two pieces are linked where the person knows ground on both sides of a chunk border. A chain of pieces always holds a path, so the band search no longer fails and the search over everything a person knows is no longer needed.
Expand Down
24 changes: 24 additions & 0 deletions LAB_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@

Every meaningful model, architecture, experimental, or design update should receive a newest-first entry. Use at most one base update number per Git commit. Refinements completed before that commit keep the same base number with a decimal suffix—for example, `003` and `003.1` belong to the same commit family. Allocate the next base number only for a later commit. Preserve the context, observed problem or research question, rationale, important implementation decisions, trade-offs, findings, and unresolved questions. Distinguish verified observations from hypotheses. If the original rationale is unknown, say so rather than inferring intent from the finished code.

## [LIFE15-Worker-069] - (2026-10-28)

After update 068 the page still ran the engine on its own thread, so every slow stretch of the engine was a slow frame: at 1 month/s the page drew about 16–19 frames a second. The owner asked for the engine in a worker thread and approved the revised specification.

**What was built.** The engine runs in a Web Worker; the page keeps the clock and asks for a goal 0.1 s ahead. Copying whole states between threads would have cost more than the engine: on day 13 the engine's state held 550 kB of routes and about 750 kB of memory tables a copy, which the screen does not read. The view copy keeps only the routes under way, each person's next wake-up, exchanges and walk records, and current memory for the followed person alone, and travels as its changes from the last copy.

**Copy cost, measured in Node on the canonical forty, seed 20260813, one day at 1 month/s (two copies a day).** Day 13: engine 2,723 ms, making the changes 17 ms, copying them 71 ms (about 940 kB a copy), applying them 4 ms. Day 30: engine 240 ms, changes 11 ms, copying 6 ms (about 140 kB), applying 1 ms. Before memory was thinned to the followed person, day 13's changes and copying took 284 ms and 591 ms over 59 copies.

**In off-screen Chrome, production builds, before (main) and after (this branch).**

| | main | worker |
|---|---|---|
| 1 min/s | 58 fps, longest frame 169 ms | 60 fps, longest 17 ms |
| 1 day/s | 47 fps, p95 50 ms, longest 167 ms | 58 fps, p95 17 ms, longest 83 ms |
| 1 month/s, days 5 to 36 | 15–19 fps, longest 133 ms | 52–60 fps, longest 67 ms |
| 1 month/s past day 36 | 16 fps, p95 100 ms; 3.3 days a second | 54 fps, p95 33 ms; 2.9 days a second |
| Start to first view | 7.4 s | 12.2 s |

Pause holds the clock, Step moves it one minute, and the console shows only the 404 that main shows too.

**Findings.** The page is now smooth at every speed: frames no longer wait for the engine. The simulation itself is no faster. The specification expected roughly 4–5 days a second at 1 month/s, but the worker reached 2.9 against main's 3.3; an earlier reading of 4.9 came from a check script that read the clock from the wrong text and is discarded. The copies cost the worker about 5–7% past day 30, which does not account for the whole gap; the rest is unexplained and may be run-to-run spread, since each figure is one ten-second run. Reaching a month a second needs the engine about ten times faster at these days, which is a question of cheaper behaviour or a simpler model at map speeds, as the specification says.

**Not settled.** Start takes about 5 s longer, because the loading card now waits for the worker to build its own valley, and the worker builds more slowly than the page. A new run from Settings started, but three seconds after Start its clock still read zero, consistent with the slower build; it was not watched until it played.

## [LIFE15-Planning-068] - (2026-10-27)

Update 067 left days 11 to 17 at 1.2–4.6 s each and ordinary days at about 200–400 ms. The owner approved a revised Life 15 specification that plans coarse routes through pieces of known ground.
Expand Down
4 changes: 3 additions & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ The 3D world draws each firm and Government across its plot: `buildingScale` str

The page opens on `LifePage.tsx`, which shows the settings screen (`RunSettingsScreen.tsx`) until Start and then a `ValleyApp` for the run it built. `runSettings.ts` is pure: it turns the five run settings into a configuration, scaling the counts of places and landforms with the world's area, and returns the first thing wrong with them. A running `ValleyApp` never changes its settings; New run returns to the settings screen. `LifePage` keeps the loading card up until `ValleyApp` calls `onReady`, after the 3D view has drawn its first frame or failed to start.

The observer, `src/valleyView/`, keeps one state and a continuous displayed minute within the minute that state has reached. Every wake-up up to the drawn minute has run, and none after it, so each person is drawn from the task actually under way: position from `positionAt`, a gesture from the task's kind, energy from `energyAt`. Below a day per second people walk continuously. From a day per second up, people are hidden and the valley is drawn as a map of stocks, groups and huts. Each frame runs the engine in one step, which checks the 40 ms budget between wake-ups and always runs at least one wake-up minute. When the budget runs out first, the step ends at the last minute it ran, exactly as a step to that minute would, so the clock runs slower than asked rather than freezing the view; one copy of the valley a frame replaces the many a frame of short steps had needed. Plants and ground are drawn in 500 m tiles near the camera, and the followed forager's overlays are redrawn at most every 250 ms; each place's ring is draped on the ground once, since places and their radii never move. The panels refresh ten times a second, or twice a second at map speeds, and the history charts are drawn again only when a day ends, the followed forager changes or a run starts. Thickets, stands and outcrops are drawn as decoration: a fixed number of bushes, hazels, trees or rocks per place, sharing out the place's stock in turn, so what is drawn stays in proportion to what is there. The decoration uses no simulation stream.
The engine runs in a Web Worker, `engineWorker.ts`; `engineLink.ts` is the page's end of it. Both threads build the valley with the pure `createValley`, so the layout never crosses between them. The page keeps the clock and each frame asks the worker for a goal minute 0.1 s ahead at the speed shown; the worker runs towards it in slices of at most 50 ms and sends a view copy every stride (the speed over 60 minutes, at least one) and at the end of each slice. `viewCopy.ts` makes the view copy: only the routes of walks under way, each person's next wake-up in place of the queue, exchanges and walk records among the events, and current memory only for the followed person. A copy travels as its changes from the last copy sent (`changeOf`, `applyChange`), so parts the engine shared or recopied unchanged are not sent and keep their identity on the page.

The observer, `src/valleyView/`, keeps the copies received and a continuous displayed minute (`advancePlayback` in `valleyViewModel.ts`). It draws the newest state at or before the clock, at a minute less than one minute after it, so every wake-up up to the drawn minute has run and none after it, and each person is drawn from the task actually under way: position from `positionAt`, a gesture from the task's kind, energy from `energyAt`. When the worker is behind, the clock waits within the newest state's minute, so a slow day stops the clock and not the page. Step shows the next minute once it arrives; a change of speed jumps to the newest copy. Below a day per second people walk continuously. From a day per second up, people are hidden and the valley is drawn as a map of stocks, groups and huts. Plants and ground are drawn in 500 m tiles near the camera, and the followed forager's overlays are redrawn at most every 250 ms; each place's ring is draped on the ground once, since places and their radii never move. The panels refresh ten times a second, or twice a second at map speeds, and the history charts are drawn again only when a day ends, the followed forager changes or a run starts. Thickets, stands and outcrops are drawn as decoration: a fixed number of bushes, hazels, trees or rocks per place, sharing out the place's stock in turn, so what is drawn stays in proportion to what is there. The decoration uses no simulation stream.

The person panel shows body measurements and five trait bars; figures scale with height and weight. Recent exchange lines show kcal per kilogram and which party received the larger share.
Loading
Loading