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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

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-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.
- The full search stays only as a guard; a walk that needed it is recorded as `full`, and the checker rejects it.
- Pieces are worked out from knowledge when needed, cached per knowledge, and carried forward at each survey by dropping only the chunks where triangles were learnt.
- Every trajectory changes: new fingerprints are recorded for every configuration except the flat land, which is unchanged.
- New unit fixtures: a coarse plan round a wall of unknown ground, a chunk split into two pieces, a plan between two pieces of one chunk, and the checker rejecting a `full` walk.
- The Life 15 specification is revised for update 068.

## [LIFE15-Speed-067] - (2026-10-27)

- Each frame runs the engine in one step that checks its 40 ms budget between wake-ups, in place of many 15-minute steps that each copied the whole valley. At 1 month/s a frame had made about 48 copies.
Expand Down
14 changes: 14 additions & 0 deletions LAB_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

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-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.

**The cause, counted on the canonical forty, seed 20260813, in whole-day steps.** From day 12, most route-search work was the search over everything a person knew, run when a band search failed. On day 13 there were 980 new plans, and 328 band searches failed, 268 of them walks to a frontier; the full searches expanded 11.3 million triangles against 2.5 million in bands. On day 30, 18 failures still made three-quarters of the search work (0.43 against 0.14 million). The band failed because two chunks counted as linked whenever the person knew ground on both sides of any edge between them, though that ground could be separate patches inside a chunk, as it often is at the edge of what someone knows and around water.

**After.** No walk on the canonical run needs the full search; every fingerprint run is checked with the guard rejected. Over the first 30 days, 6,123 coarse plans are no longer than the shortest path over the walker's known ground at the median, 9.0% longer at the 95th percentile and 20.8% at most. Whole-day times, before → after: day 12 2.0 → 1.9 s, day 13 4.6 → 2.5 s, day 16 1.7 → 1.2 s, day 30 347 → 249 ms. Days 11 to 17 now take 0.4–2.5 s, and days 20 to 45 about 180–420 ms. In off-screen Chrome on a production build at 1 month/s, from day 46: 15.9 frames and 3.2 days a second, against 15.6 frames and 2.4 days a second at update 067. The new run reached day 46 in 18 s from the start.

**Short of the spec's expectation.** The spec expected the slow days at about 1–1.5 s. Day 12 barely improved: it had few failures (86) but about 8,500 wake-ups and 1,600 cutting and carrying walks for huts, and about 800 band searches a day still cost a millisecond each. A profile of days 12–13 after the change: route search 32% (of which A\* 25%), observation 25%, garbage collection 10%, choosing tasks 9%.

**Speed work tried and dropped.** The spec allowed speed-ups that leave the trajectory unchanged, kept only if they measurably help. Skipping chunks wholly beyond sight in a survey, and reusing the A\* heap between searches, each left the fingerprints unchanged and changed day times by no more than run-to-run noise, so both were removed. What remains costly is the amount of work people do (band searches, surveys), not waste in doing it, so further gains need rules that change behaviour, or the engine moved off the main thread.

**Not checked.** In the built-in browser, which was hidden and so throttled, the run played with a clean console, but a walk round a lake was not picked out by eye; the unit fixtures cover it.

## [LIFE15-Speed-067] - (2026-10-27)

The owner found the view still far too laggy and set 1 month/s running smoothly as the goal. A month a second is 30 simulated days a second, so with the view drawing too, the engine must run a day in about 30 ms.
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The 3D world draws each firm and Government across its plot: `buildingScale` str
- **Clock and queue.** `clock.ts` holds the wake-up queue, ordered by minute, then world before people, then person id. `calendar.ts` turns a minute into a day, a season and a year of `daysPerYear` days. `world.ts` owns hourly and midnight work: regrowth, fish growth, fires and daily summaries. `wake.ts` handles a person's wake-up: it settles the task that ended, perceives, chooses the next task by priority and queues the next wake-up.
- **Places.** `places.ts` and `layout.ts` place berry and hazel thickets, wood stands and stone outcrops as aggregate stocks, indexed by place id, with their own regrowth (`logRegrowth` keeps each felled tree's schedule). The terrain, water, shore geometry and fish of Life 11 (`terrain.ts`, `water.ts`, `banks.ts`, `fish.ts`) are kept unchanged.
- **Ground mesh.** `mesh.ts` builds, once per layout, a constrained Delaunay triangulation (Delaunator and Constrainautor, pinned) over the whole valley: the hydrology's shorelines simplified to within `shoreToleranceCm`, relief vertices from a quadtree of squares from `meshMaxEdgeCm` down to one terrain cell, and refinement until every dry 5 m point is within `meshHeightToleranceCm` of the terrain. Each triangle has an area type (ground, lake or river), neighbours, a chunk and a region; the largest walkable region is the main land, where founders start. The mesh is cached per terrain and checked once by `meshViolations`.
- **Knowledge and routes.** `perception.ts` records what a person sees at a wake-up: mesh triangles, places with their stock, bank points and other people. Triangle knowledge is a bitset shared between a state and its copy until its holder learns something. `routes.ts` runs A\* over known ground triangles, pulls the path straight through the corridor with the funnel algorithm, and cuts it at triangle edges into segments with their slope and walking time. Bank points sit on the ground side of each shore edge. A new route is planned coarse to fine: an A* over the mesh's chunks, linked only across ground the person knows on both sides (`ChunkLinks`, precomputed per mesh), gives a band of chunks, and the triangle search stays inside it, falling back to the whole known ground when the band holds no path. The still landscape is surveyed again only after moving `resurveyCm` (100 m) from the last survey point; stock at the person's place, people and fires are seen at every wake-up.
- **Knowledge and routes.** `perception.ts` records what a person sees at a wake-up: mesh triangles, places with their stock, bank points and other people. Triangle knowledge is a bitset shared between a state and its copy until its holder learns something. `routes.ts` runs A\* over known ground triangles, pulls the path straight through the corridor with the funnel algorithm, and cuts it at triangle edges into segments with their slope and walking time. Bank points sit on the ground side of each shore edge. A new route is planned coarse to fine: an A* over the person's pieces, the joined-up patches of known ground within each chunk, linked across chunk borders only where the person knows ground on both sides (`ChunkLinks`, precomputed per mesh), gives a band of chunks, and the triangle search stays inside it. A chain of pieces is joined-up known ground, so the band always holds a path; the search over the whole known ground remains only as a guard, recorded as a `full` walk, which the checker rejects. Pieces are derived from knowledge, cached per knowledge and carried forward at each survey by dropping only the chunks where triangles were learnt. The still landscape is surveyed again only after moving `resurveyCm` (100 m) from the last survey point; stock at the person's place, people and fires are seen at every wake-up.
- **Ways.** `ways.ts` keeps each person's remembered ways: immutable corridors of triangles between two ends (the hearth, a place, a known bank point), at most `waysRemembered` (64), the least recently used forgotten first. A walk to such an end takes a way that holds the walker's triangle, whole or joined part-way, in either direction; the route is pulled straight along the way's corridor at the walker's current load. A way is planned again once a day has passed and the person has seen new ground since, or at once if it crosses ground no longer known. Walk events record whether the walk used a way, joined one or planned a new one. An idle person with nothing to explore takes one leisure walk a day along the way from home used longest ago (`leisureMinute`), goes home when away, and otherwise rests.
- **Tasks and lazy bodies.** `tasks.ts` builds a `TaskRecord` (kind, start and end minute, place, route, reason, starting body and load). `body.ts` gives energy and water at any minute of a task in closed form (`energyAt`, `waterAt`), and `positionAt` gives the position along its route. Nobody is advanced minute by minute. Food, wood, fire, huts, axes, trade and practice (`food.ts`, `work.ts`, `fire.ts`, `huts.ts`, `axes.ts`, `trade.ts`, `practice.ts`, `social.ts`) apply their rules when a task settles or two people meet.
- **Checker.** `invariants.ts` checks each interval against the preceding immutable state. `replay.ts` keeps separate stock, fish, body, tool, hut and water ledgers, replays recorded transfers and regrowth, and compares them with the returned state. Geography is checked once.
Expand Down
Loading
Loading