Context, and why this is not ready to start
This records a design requirement discovered while planning parallelism for the sibling projects lockstep and nrg. It is deliberately blocked: the single-threaded optimisations (trancecode/vantage#15, #16, #17 and lockstep's in-flight-effect indexing) must land and be measured first, because they change where the performance ceiling actually is. Recent measurement found a single four-line pathfinding fix worth 176x to 374x, so parallelism is not the next lever.
The requirement
A future parallel simulation scheme would run disjoint sets of entities on separate goroutines within one world, synchronising at barriers. This requires the ECS to tolerate concurrent mutation of entity sets that provably do not overlap.
Today it does not. Per the design that nrg/ARCHITECTURE.md describes: typed Accessor[T] handles return interior pointers into per-type dense storage, and structural changes can reallocate that storage. A structural change on one goroutine can therefore invalidate a pointer held by another, even when the two goroutines are touching entirely different entities.
What the consumer needs
- Concurrent reads and writes to components of disjoint entity sets, safe without a global lock.
- Structural changes (create, destroy, add or remove component) that do not invalidate pointers held by other goroutines operating on unrelated entities.
- Determinism preserved. Both consuming games depend on bit-identical replay and savegames, so any parallel path must produce results identical to the sequential path, and merges must happen in a fixed order. This is a hard requirement, not a preference.
Possible directions, not prescriptive
- Stable storage that never reallocates under structural change (chunked or paged storage).
- Handle-based access instead of interior pointers on the concurrent path.
- An explicit partitioned view or borrow API that hands out disjoint slices of the world.
Acceptance
- A written design describing the chosen approach and its determinism argument, agreed before implementation.
- A race-detector test that mutates two disjoint entity sets from two goroutines and asserts results identical to running them sequentially.
- No regression on single-threaded performance, which remains the common case.
✨ Content generated by Claude AI.
Context, and why this is not ready to start
This records a design requirement discovered while planning parallelism for the sibling projects
lockstepandnrg. It is deliberately blocked: the single-threaded optimisations (trancecode/vantage#15, #16, #17 and lockstep's in-flight-effect indexing) must land and be measured first, because they change where the performance ceiling actually is. Recent measurement found a single four-line pathfinding fix worth 176x to 374x, so parallelism is not the next lever.The requirement
A future parallel simulation scheme would run disjoint sets of entities on separate goroutines within one world, synchronising at barriers. This requires the ECS to tolerate concurrent mutation of entity sets that provably do not overlap.
Today it does not. Per the design that
nrg/ARCHITECTURE.mddescribes: typedAccessor[T]handles return interior pointers into per-type dense storage, and structural changes can reallocate that storage. A structural change on one goroutine can therefore invalidate a pointer held by another, even when the two goroutines are touching entirely different entities.What the consumer needs
Possible directions, not prescriptive
Acceptance
✨ Content generated by Claude AI.