49 lines
4.3 KiB
Markdown
49 lines
4.3 KiB
Markdown
# Run the same world kernels in an explicit serial reference mode
|
|
|
|
Task ID: M01-C
|
|
Role: sol_implementer
|
|
Status: READY
|
|
|
|
## 1. Context and baseline
|
|
Game root /home/faumaray/Projects/stoneheart_at_home, milestone/m01-authoritative-simulation, M00 checkpoint 904bdf8. Legacy task notes/.serena are user work. M00-P/F and M01-R established the prototype's three worker sites and checked the pinned Void APIs.
|
|
|
|
## 2. Objective and deliverables
|
|
Implement the first M01 execution seam: an explicit true serial reference and the existing threaded game mode for World construction and load.
|
|
|
|
## 3. Scope and non-goals
|
|
Work only on simulation execution selection, including path selection/route/advancement. Keep normal CLI, viewer, LAN, wire bytes, command behavior and parallel executor compatible.
|
|
|
|
## 4. Files to inspect
|
|
Inspect engine/include/settlement/core/world.hpp, engine/src/{world,world_save}.cpp, worker_pool.hpp/cpp, tests/core_tests.cpp, docs/plan/milestones/M01.md and docs/plan/void-library.md. choose_jobs, find_path and advance_agents already exist in World.
|
|
|
|
## 5. Write ownership and coordination
|
|
Write scope: engine/include/settlement/core/world.hpp; engine/src/world.cpp; engine/src/world_save.cpp
|
|
You are not alone in this checkout. Other authors own tests and CMake; root owns docs and Git. Do not revert others' work.
|
|
|
|
## 6. Implementation or investigation approach
|
|
Add the explicit mode to World construction and read_save. Validate count/mode before stepping. For serial work call the same domain kernels on the caller thread: compute all candidate choices against one starting state before committing winners, run the same find_path and apply requests in the same order, advance agents for the whole range once and sum actual completions. Preserve existing chunking and order in threaded mode. Use direct domain calls and avoid building any generic executor or new state codec.
|
|
|
|
## 7. Interfaces and data contracts
|
|
NEW settlement::ExecutionMode::{Parallel, SerialReference}. World(seed,w,h, size_t workers=min_worker_count, ExecutionMode mode=ExecutionMode::Parallel); World::read_save(stream, size_t workers=min_worker_count, ExecutionMode mode=ExecutionMode::Parallel). Parallel accepts 2..64 as today. SerialReference requires logical count 1, creates zero OS workers and reports worker_count()==1. Reject invalid combinations/unknown enum with std::invalid_argument. Configuration is local and never serialized. Other source-compatible choices inside these paths are discretionary.
|
|
|
|
## 8. Dependencies and integration
|
|
Tests owner will use frozen interface immediately. Preserve save v13 fixture, old versions, LAN 11, performance of ordinary pool dispatch and its current lifetimes. Pinned Void covers binary/test primitives; game-specific direct invocation adds no generic library facility. ThreadExecutor migration has its own later failure/performance contract.
|
|
|
|
## 9. Edge cases security and performance
|
|
Account for no agents/jobs, paused world, one resident, fewer agents than workers, competing jobs, retries for unreachable routes, reload and cache state. Keep parallel error behavior; do not broaden lifetime hazards. No detached tasks or implicit threads in serial.
|
|
|
|
## 10. Acceptance criteria
|
|
1. Serial mode reaches all 3 sites without a worker pool. 2. Invalid ordinary counts still fail, valid serial passes constructor and load. 3. Exact v13 save bytes and outcomes match 2/6/12 for useful scenarios. 4. Default behavior and old consumers compile.
|
|
|
|
## 11. Verification commands and evidence
|
|
From game root source /tmp/stoneheart-verify.KoZwE4o8/env.sh; then cmake --build "$SETTLEMENT_VERIFY/candidate" --parallel 8 --target settlement_core. Use git diff --check and inspect actual diff. Tell root/tests when implementation compiles; tests use another build directory and root runs integrated suites.
|
|
|
|
## 12. Constraints and stop conditions
|
|
Do not alter other files, registry, network, branch or legacy pool, stage/commit or spawn. Escalate a required interface change and report errors before changing approach twice.
|
|
|
|
## 13. Authorization and decisions
|
|
User approved starting the roadmap on per-milestone branches and parallel subagents. Root selected first M01 replay increment after independent preflight.
|
|
|
|
## 14. Return format
|
|
Return M01-C status, changed paths/symbols, mode and ordering decisions, commands/results, untested paths and integration notes.
|