Repository navigation
M0: ADR 0008, units and a living world (and what units and resource nodes cost) - #38
Merged
Merged
Conversation
…esource nodes cost M0 of the pivot from abstract expansion to simulated units. Two probes on a 2000 x 2000 world: - tests/probe/units.probe.ts: a gatherer loop for 2,000 / 10,000 / 30,000 units. Movement is nearly free (a stepped walker and a sleeping one cost the same); pathfinding is the whole cost, about 48 us a leg. With routes shared between units 30,000 units cost 1.2 ms a tick instead of 42 ms, 10,000 cost 0.7 ms. - tests/probe/nodes.probe.ts: resource nodes as rows. There are 960,000 (not 2M): 9.6 MB, built in 23 ms, a spatial index in 30 ms and 9.6 MB, nearest-tree in 26 us, hashing half the time of the tile layers and a save of 9.6 MB instead of 24 MB. Nodes as entities is confirmed; the tile-data fallback is not needed. ADR 0008 records the decisions (event-driven units, shared routes, nodes as passive rows, territory from buildings, provinces leave the engine path, zoom-gated sprites, one tick stays a day, about 10,000 units as the budget) and the stages M1 to M6, with the limits. The roadmap and docs index are updated. No engine behaviour changes; MinHeap.clear gains a test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cn5qp59UwGNst3umuaQf6u
9 tasks done
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First stage of replacing the points-and-provinces expansion (ADR 0007) with simulated units: villagers and settlers who walk, gather, carry, build and spread, with resource nodes as entities and territory from buildings, drawn as zoom-gated pixel sprites. This PR is M0 only: two probes that fix the budget, and ADR 0008. No engine behaviour changes. Later stages stack on this branch (M1 entities and a world you can see, M2 gather loop, M3 settle and build, M4 live, M5 spread, M6 crowds and god powers).
Changes
tests/probe/units.probe.ts: a gatherer loop (idle, pick a spot, A* over the 4-tile cost grid, walk, work, walk home, deposit) for 2,000 / 10,000 / 30,000 units, every walker stepped each tick vs units that sleep until they arrive vs routes shared between units.tests/probe/nodes.probe.ts: the two resource slots as passive rows: count, memory, build time, a spatial index, nearest-node query time, hash and save size against the six tile layers.docs/decisions/0008-units-and-a-living-world.md: the decisions and what the probes measured; roadmap, docs index and development docs updated.tests/heap.test.ts: a test for the existingMinHeap.clear()(a heap serving many searches).Findings (2000 x 2000, seed 1337, Node 22, one machine)
Related Issues
None.
Type of Change
Checklist
pnpm build) — not run locally; CI runs itpnpm lint) — ESLint and Prettier on the touched packages, run locallypnpm typecheck) — simulation package, run locallypnpm test; andpnpm test:determinismif the engine changed) — heap tests run locally; engine unchanged, so determinism suite not re-runHonest limits
Generated by Claude Code