deadhead-space-freight-tycoon/memory-bank/change-requests/CR-008-fresh-boards.md

4.2 KiB
Raw Permalink Blame History

Change Request CR-008 — Boards That Feel Fresh

Project: Deadhead: Space Freight Tycoon Applies to: a build with CR-001 to CR-007 complete Do this: as Phase 10H, after Phase 10G and before Phase 11 Related docs: CR-006-boards-that-fit.md, CR-007-cargo-goods.md, DECISIONS.md


1. Why

User report: "The jobs aren't refreshing after you wait. You get the same jobs even after the timer hits zero. Leaving the page and coming back still doesn't refresh and neither does refreshing the page manually."

Investigation: the board does refresh. The server stores a new board each period (the user's dev database has one per 10-minute period, with different goods, masses and payouts). A browser left on the board refetched one second after the timer hit zero and showed the new cards; a reload showed the same new board. But the new board looks like the old one:

  • An early player (one Courier, Earth and the Moon discovered) is offered almost only Earth → Moon runs of three Standard goods (CR-006 fits the board to the fleet; CR-007 has three Standard goods on that route).
  • Payout depends only on good, mass and distance, and the Moon's distance barely changes, so the same good and mass pays the identical amount on every board ("Consumer Goods 16 t · 614 cr" recurs).
  • Nothing on screen says the board changed.

The user chose three fixes (asked): show the refresh, vary pay per job, and add more early goods.

2. Decisions

Record as plan §0.5.60–0.5.62.

  • 0.5.60 Market rate. Each board contract (not tutorial) gets its own pay rate, drawn uniformly within ±contractPayVariance (default 15 %) of 1 and multiplied into its payout. The average payout is unchanged.
  • 0.5.61 More early goods. Five Standard goods join the catalog so early routes vary: Earth → Moon gains Water Recyclers, Spare Parts (Priority-eligible) and Lunar Base Supplies; Moon → Earth gains Crew Personal Effects and Recycled Alloys.
  • 0.5.62 Visible refresh. When the board shown for a location changes (the timer rolls over while open, or the player comes back to a newer board), the screen announces "New contracts posted" and tags each contract that wasn't on the last board the player saw there "New". The last seen board is remembered per location in the browser (a convenience; losing it only loses the tags). On a first visit nothing is tagged.

3. Steps — Phase 10H

Step 10H.1 — Content: pay variance and new goods

  • Config contractPayVariance (0.15, fraction). Goods per decision 0.5.61:
Id Name Mass (t) Pay × Priority Produced at Demanded at
water-recyclers Water Recyclers 3–18 1.1 No Earth Moon, Mars, Ceres
spare-parts Spare Parts 1–12 1.05 Yes Earth, Mars Moon, Ceres, Jupiter
lunar-base-supplies Lunar Base Supplies 2–20 1.0 No Earth Moon
crew-effects Crew Personal Effects 0.5–5 1.2 No Moon, Mars, Ceres Earth
recycled-alloys Recycled Alloys 5–30 0.95 No Moon Earth, Mars
  • Test: content tests pass with the new goods; Earth → Moon has at least five Standard goods and Moon → Earth at least four; the variance is a fraction.

Step 10H.2 — Sim: per-contract pay rate

  • Board contracts (fit and normal) draw a rate in [1 − v, 1 + v] after their other choices; contractPayout takes an optional market rate (default 1). Tutorial contracts use 1.
  • Test: payout scales with the rate; over 1,000 boards the rates stay within bounds and average 1 ± 0.01; the same good and mass on two boards can now pay differently; tutorial payouts are unchanged; the CR-007 class-mix test still passes.

Step 10H.3 — Client: visible refresh

  • Per decision 0.5.62: a role="status" notice "New contracts posted" and "New" pills on new contracts (which also rise in), remembered per location in localStorage (wrapped in try/catch).
  • Test: with a remembered earlier board, new contracts are tagged and the notice shows; with the same board remembered, nothing is; on a first visit, nothing is.

Step 10H.4 — Regression

  • Plan amendments (Step 3.8 payout, Step 9.4 board), full suite, coverage, lint, build; manual check across a real rollover. Stop for review.