Skip to content

Sprint 2.4: Regional market dynamics — MarketRegion, α-formula pricing, regional events, UI tab#99

Merged
makr-code merged 2 commits into
mainfrom
copilot/sprint-2-4-regionale-marktdynamik
Apr 12, 2026
Merged

Sprint 2.4: Regional market dynamics — MarketRegion, α-formula pricing, regional events, UI tab#99
makr-code merged 2 commits into
mainfrom
copilot/sprint-2-4-regionale-marktdynamik

Conversation

Copilot AI commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

The market was purely global with no regional price variation. This implements per-region supply/demand with independent price evolution, region-scoped market events, and visible price comparison in the Economy UI.

Core engine (EconomySimulation.js)

  • MarketRegion class — independent supply/demand state per good, prices evolve via α-formula:
    price_t+1 = clamp(price_t × (1 + α × (demand − supply) / max(1, supply)), min, max)
    
    α = 0.03 per GAMEPLAY_DATA_MODEL.md §6.1. Supports region-scoped events (shortages, blockades) with full serialize/deserialize.
  • MARKET_REGION_DEFS — two pre-defined regions:
    • core_worlds (Kernwelten): manufactured goods surplus, raw material scarcity
    • frontier_sectors (Grenzgebiete): raw material surplus, +20% transport surcharge, finished goods scarce
  • GalacticMarket extended — new methods: getRegion(), getRegionPrice(), getAllRegionPrices(), applyRegionalEvent(), tickRegions(). Regions included in serialization.

API (api/market.php)

  • New get_region_prices action — returns per-region price breakdown for all goods (or a single good_type). Uses live market_region_quotes rows when available; falls back to supply-bias estimate against the global price.

Frontend

  • js/network/api.jsmarketRegionPrices(good_type?) method.
  • RuntimeEconomyController.js — new "Regional Market" tab: color-coded comparison table (cheapest = green, most expensive = orange) across all regions.

Database (sql/migrate_regional_market_v1.sql)

  • market_regions — region registry with transport cost multiplier
  • market_region_quotes — live supply/demand/price per (region, good), seeded with asymmetric initial values reflecting each region's economic character
  • market_region_events — region-scoped event log

Tests

30 new tests covering MarketRegion α-formula ticking, price clamping, regional events, serialization, and GalacticMarket integration. All 2575 unit tests pass.

Copilot AI linked an issue Apr 12, 2026 that may be closed by this pull request
… regional events, UI tab, API)

Agent-Logs-Url: https://github.com/makr-code/GalaxyQuest/sessions/663fabb2-f484-4283-b1aa-cb20cc521a26

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement regional market dynamics for Sprint 2.4 Sprint 2.4: Regional market dynamics — MarketRegion, α-formula pricing, regional events, UI tab Apr 12, 2026
Copilot AI requested a review from makr-code April 12, 2026 06:29
@makr-code
makr-code marked this pull request as ready for review April 12, 2026 06:31
@makr-code
makr-code merged commit a868b4a 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.4: Regionale Marktdynamik integrieren

2 participants