Consolidate shared trail-game pieces into retro-kit
Consolidate shared trail-game pieces into retro-kit
#29 in Riparion/riparion-retro — merged 2026-06-11
What
Lift the genuinely game-agnostic pieces that were copy-pasted across Oregon Trail, Fort Nash, and Kaintuck into retro-kit:
rations::EatLevel— the ration enum (food_cost = 8 + 5·E), re-exported by each trail game'sengine::state. Serde wire-format is unchanged, so existing localStorage saves still load.scoring::{calendar_date, arrival_date, leftover_value}— the arrival-date calendar walk, parameterized by epoch/period/year, plus the leftover-supplies valuation. Each game keeps its ownscore/rank/HighScore(constants and fields diverge; Kaintuck's has nomiles).game_flow::{Persisted, use_persistence}— the identical save-on-transition / clear-and-record-on-game-overuse_effect, captured as a trait + helper generic overGso the per-gameSignalstays concrete. Each gameimplsPersisted(Kaintuck scores onstate.trader, the trail games onstate.party); eachapp.rscollapses its hand-rolled effect touse_persistence(game).
retro-kit 0.1.2 → 0.1.5; game patch versions bumped accordingly.
What deliberately did not change
- UI components stay per-game (
GameRootdispatch,StatusBar,Cover,InteractionHost,GameOver). Dioxus 0.7 keys context by concrete type, so a generic version would fight the framework for little gain. - The oregon-trail/fort-nash engines stay separate. They look ~99% identical by line count, but a close diff shows the overlap is the probability/formula skeleton while the divergence is dominated by ~200 inline narrative strings + real behavioral forks (
SteadyTask::Icedeath path, the third Cumberland-River crossing, the Ford-minigame-vs-plain-toll event slot, fortnights vs weeks). Merging would replace readable inline voice with a string table — a maintainability regression. NOTES.md records the rationale so it isn't re-litigated.
Verification
cargo test --workspace— all green (24 test binaries, 0 failures); retro-kit gained 7 host-side tests for the moved math.- All 9 games + examples still compile;
Cargo.lockrefreshed. - wasm smoke (oregon-trail):
just build oregon-trailsucceeds; driven headless — boots with no page errors,use_persistencewrites the save ({version:2, data}),eat_levelstill serializes as the bare string"Moderately"(save compat intact), and reload offers RESUME JOURNEY.
🤖 Generated with Claude Code
Last updated 2026-06-12
Links to this note
Credits
Merged pull requests, newest first.