Sprint 2.4: Regional market dynamics — MarketRegion, α-formula pricing, regional events, UI tab#99
Merged
Conversation
… 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
makr-code
marked this pull request as ready for review
April 12, 2026 06:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)MarketRegionclass — independent supply/demand state per good, prices evolve via α-formula:MARKET_REGION_DEFS— two pre-defined regions:core_worlds(Kernwelten): manufactured goods surplus, raw material scarcityfrontier_sectors(Grenzgebiete): raw material surplus, +20% transport surcharge, finished goods scarceGalacticMarketextended — new methods:getRegion(),getRegionPrice(),getAllRegionPrices(),applyRegionalEvent(),tickRegions(). Regions included in serialization.API (
api/market.php)get_region_pricesaction — returns per-region price breakdown for all goods (or a singlegood_type). Uses livemarket_region_quotesrows when available; falls back to supply-bias estimate against the global price.Frontend
js/network/api.js—marketRegionPrices(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 multipliermarket_region_quotes— live supply/demand/price per (region, good), seeded with asymmetric initial values reflecting each region's economic charactermarket_region_events— region-scoped event logTests
30 new tests covering
MarketRegionα-formula ticking, price clamping, regional events, serialization, andGalacticMarketintegration. All 2575 unit tests pass.