[PR] Player decisions for story events #61

Open
agent-claude wants to merge 0 commits from claude/60-player-decisions into main
Collaborator

Fixes #60

What

Story events now ask the player to choose.

  • Framework: open decisions live in colony state and are resolved with a RESOLVE_DECISION command. Unanswered ones fall back to a safe default when they expire. Decisions replicate to clients in TickDelta (only when they change), are covered by the state hash, and persist in snapshots.
  • Events:
Event Choices (default first)
Wanderer Turn away / Welcome. Trait, top skills and weapon are shown up front.
Refugee Turn away / Grant shelter, and a pursuit raid arrives in 1–2 days.
Trade caravan Done / buy 3 offers at a 50% markup / sell your 2 most plentiful goods at 60%. Take any number of deals; unaffordable ones are disabled.
Distress beacon Ignore / Investigate: 60% salvage, 40% ambush.
Wounded raider after a raid Release / Recruit: joins wounded and renamed.
  • Client: an Events [E] top-bar button with a pending badge, and a prompt that pops up for new events. It shows options with details, a countdown to the default, and paging when several events are open.

Testing

  • New decisions.test.ts (7 tests): offering, declining, expiry, refugee pursuit, trade deals and affordability, prisoner recruitment, distress outcomes, and replica/snapshot parity.
  • npm test passes (101 sim-core, 6 server), the typecheck is clean, and the client builds.
  • Played locally: a wanderer event popped the prompt (badge 1, countdown shown), Welcome was clicked, and the log confirmed the colonist joined.

🤖 Generated with Claude Code

Fixes #60 ## What Story events now ask the player to choose. - **Framework:** open decisions live in colony state and are resolved with a `RESOLVE_DECISION` command. Unanswered ones fall back to a safe default when they expire. Decisions replicate to clients in `TickDelta` (only when they change), are covered by the state hash, and persist in snapshots. - **Events:** | Event | Choices (default first) | | :-- | :-- | | Wanderer | **Turn away** / Welcome. Trait, top skills and weapon are shown up front. | | Refugee | **Turn away** / Grant shelter, and a pursuit raid arrives in 1–2 days. | | Trade caravan | **Done** / buy 3 offers at a 50% markup / sell your 2 most plentiful goods at 60%. Take any number of deals; unaffordable ones are disabled. | | Distress beacon | **Ignore** / Investigate: 60% salvage, 40% ambush. | | Wounded raider after a raid | **Release** / Recruit: joins wounded and renamed. | - **Client:** an **Events [E]** top-bar button with a pending badge, and a prompt that pops up for new events. It shows options with details, a countdown to the default, and paging when several events are open. ## Testing - New `decisions.test.ts` (7 tests): offering, declining, expiry, refugee pursuit, trade deals and affordability, prisoner recruitment, distress outcomes, and replica/snapshot parity. - `npm test` passes (101 sim-core, 6 server), the typecheck is clean, and the client builds. - Played locally: a wanderer event popped the prompt (badge 1, countdown shown), Welcome was clicked, and the log confirmed the colonist joined. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Decision framework in sim-core: pendingDecisions in colony state,
  RESOLVE_DECISION command, expiry to a safe default, replicated via
  TickDelta (when changed), covered by the state hash, persisted.
- Wanderers now ask to join (accept/decline) with their trait, best
  skills and weapon shown up front; refugees bring a pursuit raid if
  sheltered; trade caravans offer buy/sell deals in silver (take any
  number, unaffordable ones disabled); distress beacons risk salvage vs
  ambush; one wounded raider left after a raid can be recruited.
- Client: Events [E] top-bar button with a pending badge, a decision
  prompt that pops up for new events with options, details, a countdown
  to the default, and paging between multiple open events.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Collaborator

Merge approved by @johnw via Claude Code chat on 2026-10-20: "Do what you see fit and I approve all changes to be merged and deployed"

Merge approved by @johnw via Claude Code chat on 2026-10-20: "Do what you see fit and I approve all changes to be merged and deployed"
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin claude/60-player-decisions:claude/60-player-decisions
git switch claude/60-player-decisions

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff claude/60-player-decisions
git switch claude/60-player-decisions
git rebase main
git switch main
git merge --ff-only claude/60-player-decisions
git switch claude/60-player-decisions
git rebase main
git switch main
git merge --no-ff claude/60-player-decisions
git switch main
git merge --squash claude/60-player-decisions
git switch main
git merge --ff-only claude/60-player-decisions
git switch main
git merge claude/60-player-decisions
git push origin main
Sign in to join this conversation.
No description provided.