Skip to content

feat(economy): Sprint 2.1 — wire Tier-2/Tier-3 production chains end-to-end#97

Merged
makr-code merged 3 commits into
mainfrom
copilot/complete-production-chains-tier-2-3
Apr 12, 2026
Merged

feat(economy): Sprint 2.1 — wire Tier-2/Tier-3 production chains end-to-end#97
makr-code merged 3 commits into
mainfrom
copilot/complete-production-chains-tier-2-3

Conversation

Copilot AI commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Tier-2 and Tier-3 production was computing at flat rates without enforcing input dependencies — T3 buildings produced freely regardless of T2 stock. The production flow had no UI representation.

Backend (api/economy_flush.php)

  • Added ECONOMY_TIER3_INPUT_RATIOS constant mapping each T3 good to its required T2 inputs + consumption ratios (mirrors EconomySimulation.js recipes)
  • T3 buildings now drive T2 consumption rates; T3 output rate is scaled down proportionally when T2 stock is insufficient:
// e.g. consumer_goods requires steel_alloy × 1.0 + electronics_components × 1.0
'consumer_goods' => [['steel_alloy', 1.0], ['electronics_components', 1.0]],

API (api/economy.phpget_production)

  • Added chain_status to the response: per T3 good, reports ok/low/starved, per-input stock levels (qty, capacity, pct), and output stock — all derived from current T2 stock after flush.

Frontend (js/engine/runtime/RuntimeEconomyController.js)

  • Bug fix: warningHtml in _renderOverviewTab was declared after an early return — war/pirate conflict banners were never rendered in the overview tab.
  • Added ⛓ Production tab with a per-colony Tier-2 → Tier-3 chain visualizer:
    • Each chain node is color-coded 🟢 ≥50% / 🟡 10–50% / 🔴 <10% capacity
    • T3 nodes surface their T2 input stocks inline
    • Per-colony bottleneck warnings from economyBottleneck
    • Conflict banner (war / pirate damage) carried through to this tab

Tests (tests/js/runtime-economy-controller.test.js)

  • 18 new unit tests covering: three-tab HTML structure, T2 all-building production, T3 blocked when T2 inputs absent, multi-tick depletion, PROCESSING_RECIPES Tier-3 input validity

Copilot AI and others added 2 commits April 12, 2026 06:27
- Fix dead code bug in RuntimeEconomyController._renderOverviewTab (warningHtml was unreachable)
- Add Production Chain tab to RuntimeEconomyController with Tier-2→Tier-3 flow visualization
  - Color-coded status (🟢 ok / 🟡 low / 🔴 starved) for each chain node
  - Bottleneck warnings rendered per colony
  - War/pirate conflict banner shown in production tab
- Add PRODUCTION_CHAIN constant and GOOD_ICONS for all Tier-2/3/4/5 goods
- Add _loadProductionTab() and _renderProductionTab() to the controller
- Add Tier-3 input consumption in economy_flush.php (ECONOMY_TIER3_INPUT_RATIOS)
  - T3 buildings now consume T2 goods (e.g. consumer_factory uses steel_alloy + electronics_components)
  - T3 production rate is gated by available T2 stock (scale-down when T2 inputs depleted)
- Add chain_status to api/economy.php get_production response
  - Per Tier-3 good: status (ok/low/starved), input stock info, output stock info
- Add 18 new tests in tests/js/runtime-economy-controller.test.js
  - All 2563 tests pass

Agent-Logs-Url: https://github.com/makr-code/GalaxyQuest/sessions/889849a5-507a-45ff-bc64-e2d0f85149c4

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot AI changed the title [WIP] Complete production chains for Tier-2 and Tier-3 goods feat(economy): Sprint 2.1 — wire Tier-2/Tier-3 production chains end-to-end Apr 12, 2026
Copilot AI requested a review from makr-code April 12, 2026 06:30
@makr-code
makr-code marked this pull request as ready for review April 12, 2026 06:33
@makr-code
makr-code merged commit f335ac2 into main Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sprint 2.1: Produktionsketten für Tier-2 und Tier-3 Güter vollenden

2 participants