Last Updated: 31 July 2026 (Documentation sync)
Scope: Pirates, Economy, War systems + Phase documentation
Status Summary: ~70% complete with significant incomplete features in Economy integration
Backend API (api/pirates.php)
GET ?action=status— List all pirate factions + threat scoresGET ?action=recent_raids&limit=N— Fetch pirate raid messages (last 24h)GET ?action=forecast— Risk index + recommended actionsPOST ?action=run_tick— Execute pirate simulation tick
Frontend (js/engine/runtime/RuntimePiratesController.js)
- Mirror UI panel for pirate intelligence
- Recent raids table display
- Pirate faction standings table
- Risk forecast with recommended actions
- Manual tick execution button
Database Schema
- Leverages
npc_factionstable (faction_type = "pirate") - Uses
diplomacytable for standing/relations - Uses
messagestable for raid notifications
Integration Points
api/npc_ai.php— NPC faction ticks (pirates included)- Diplomacy decay system working
- Raid spawning via NPC control logic
- No frontend window integration in
index.html— Pirates button exists but window management minimal - No pirate countermeasures system — No way to spend resources defending against raids
- No raid consequences — Raids don't affect colony resources/infrastructure
- No historical raid data — Only recent (24h) raids shown, no archive
- No pirate faction contracts — Can't trade with or negotiate with pirate factions
- Standing decay not visible — API returns standing but UI doesn't show changes/decay rate
- No persistent threat modeling — Risk forecast recalculated each call, not cached
- TODO: Raid escalation mechanics not implemented
- Attack wave forecasting (predicted raid intensity)
- Colony defense allocation
- Pirate extortion negotiations
- Tributary relationships bonuses
- Historical raid impact reconstruction
Backend API (api/economy.php)
GET ?action=get_overview[&colony_id=N]— Colony economy snapshotGET ?action=get_production&colony_id=N— Production building detailsPOST ?action=set_production_method— Switch production strategyGET ?action=get_policy— Current policy + tax ratesPOST ?action=set_policy— Change global economic policyPOST ?action=set_tax— Adjust tax rates (income/production/trade)POST ?action=set_subsidy— Toggle per-sector subsidiesGET ?action=get_pop_classes[&colony_id=N]— Pop class distribution
Market System (api/market.php)
GET ?action=get_prices— Dynamic pricing per goodGET ?action=buy— Purchase goods from marketGET ?action=sell— Sell goods to marketGET ?action=get_history— Transaction history (24h)GET ?action=get_active_events— Market events with price modifiers- Price elasticity implemented (supply/demand curve)
Trade Routes (api/trade.php)
GET ?action=list— All player's automated trade routesPOST ?action=create— Set up recurring trade routePOST ?action=delete— Remove trade routePOST ?action=toggle— Pause/resume routeGET ?action=list_suggestions— AI-recommended routesPOST ?action=apply_suggestion— Auto-create suggested routeGET ?action=list_proposals— Player-to-player trade proposalsPOST ?action=propose/accept/reject/cancel- Auto-dispatch logic on every trade.php call
Database Schema
economy_policies— Per-user global policyeconomy_production_methods— Building → method mappingeconomy_processed_goods— Inventory per colonyeconomy_pop_classes— Pop distribution per colonymarket_supply_demand— Per-system supply/demand trackingeconomy_market_events— Active price modifierstrade_routes— Recurring automated trades
Frontend (js/engine/runtime/RuntimeEconomyController.js)
- Policy tab with policy selection + descriptions
- Overview tab with colony goods + pop classes
- Production method switching per building
- Tax rate adjustment sliders
- Market event display integration
Production Integration
- Tier-2 goods production recipes only partially implemented
- Tier-3 goods (luxury, military, research items) not fully wired
- Pop class job assignments incomplete — colonist/citizen/specialist roles not enforced
- Production method efficiency multipliers not consistently applied
-
set_production_methodendpoint exists but toggle logic may be incomplete
Pop Class System
- Pop satisfaction mechanics not linked to goods consumption
- Shortage/starvation events not triggered
- Pop migration (upward mobility) not implemented
- Disease/overcrowding penalties not applied
-
economy_pop_classestable populated but tier-based needs tracking incomplete
Policy Enforcement
- War-economy policy (+30% military, −20% consumer goods) not enforced in production
- Autarky (no imports) policy has placeholder in code, not fully integrated
- Mercantilism (import restrictions) not blocking market purchases
- Subsidies (agriculture/research/military) boost logic stubbed
- Tax collection formula present but happiness/morale impact not wired to economy
Goods Scoping
- Market operations partially isolate by system (local prices) but global fallback always used
- Goods capacity per colony not enforced in UI (backend limits exist)
- Transport efficiency lost in route automation (no distance/time cost modeling)
Missing Endpoints
-
api/economy_policy.php(designed but merged into economy.php) — unclear scope - Faction trade contracts not exposed (api/npc_ai.php has stubs)
- Luxury good consumption/happiness feedback loop not visible
- No visual production chain (Tier-1 → Tier-2 → Tier-3 flow unclear)
- No manufacturing bottleneck warnings
- No "low stock" alerts for critical goods
- No economy-wide deficit forecasting
- Pop tier promotion criteria not exposed in UI
- No comparison of policy effects before switching
Backend API (api/war.php)
POST ?action=declare— Start war (target_user_id, war_goals, casus_belli)GET ?action=list— Active wars for playerGET ?action=get_status&war_id=N— Full war status snapshotPOST ?action=offer_peace— Propose peace termsPOST ?action=respond_peace— Accept/reject peace offer
Database Schema
warstable: attacker/defender, war_score, exhaustion, status (active/paused/expired)war_goalstable: per-side goals (annex_system, reparations, humiliation, etc)peace_offerstable: pending offers with expires_at
War Mechanics Implemented
- War score tracking (attacker vs defender side)
- Exhaustion system (accumulated fatigue per side)
- War goal progression (occupation control, reparations tracking)
- Peace offer expiration + auto-cleanup
- Forced peace logic (exhaustion > threshold triggers auto-peace)
- Territory control detection (colony count in target system)
Frontend (js/engine/runtime/RuntimeWarController.js)
- War overview panel
- Active wars list
- War status display (scores, exhaustion)
- Peace offer interaction
- War goal visualization
Integration Points
api/game_engine.php— War exhaustion tick + forced-peace checksgame.php— War runtime stats in projectionconfig/combat_config.php— All war balance constants
Frontend UI / UX
- War declaration UI dialog not fully wired (exists but incomplete)
- Goal customization UI missing (preset goals only)
- Casus belli selection not exposed in UI
- War summary panel lacks enemy fleet/colony threat visualization
- No "war intelligence" (enemy ship counts, resource scans)
- Peace negotiation UI minimal (accept/reject only, no counter-offers)
Mechanics Gaps
- War pre-declaration cooldown not enforced (code checks but no 404 response)
- Alliance-level wars not implemented (only 1v1)
- War goal scoring not visible in UI (backend tracks, frontend shows generic "unknown" state)
- No war attrition tied to active combat (exhaustion only from time, not losses)
- No fleet damage carryover between battles
- Tribute/indemnity terms not enforced post-peace
Missing Features
- War declarations by all players trigger global event (not in event log)
- Declarations don't trigger NPC diplomacy reactions
- No neutral nation penalties for breaking peace early
- No war-specific taxation enabled (economic war mechanics)
- Supply line disruption not implemented
- Siege mechanics (blockading colonies) not present
Data Gaps
- War goal progress calculation incomplete for some goal types:
humiliationgoal incomplete progress trackingreparationsgoal doesn't check treasury/paymenttechnology_theftgoal not in schema
- Peace offer terms not validated after acceptance
- War history not retained (wars deleted after expiry)
// FROM COMBAT_SYSTEM_DESIGN.md §12 Implementierungs-Roadmap:
- [ ] War-Exhaustion-Tick in game_engine.php finalisieren
- [ ] Allianz-System (wars between alliances)
- [ ] Tests: war-events.test.js (Vitest)
- [ ] WarOverviewPanel UI finalization
- [ ] New JS API calls for war.php routing
- [ ] project_war_snapshots.php script for debuggingFile: PHASE_1_COMPLETION_SUMMARY.md
Content: Initial combat system foundation, battle simulator basics, preliminary VFX
File: PHASE_2_COMPLETION.md / PHASE_2_IMPLEMENTATION.md
Status: Multi-entity weapon-fire VFX system
What was done:
- Extended weapon fire from installations to ships, debris, wormholes, beacons
- Unified BeamEffect pool rendering
- Combat bridge enhancements (alternating fire patterns)
- Performance optimized for 500+ entities
File: PHASE_2_VERIFICATION.md
Validated: All Phase 2 acceptance criteria met, test pass rates
File: PHASE_3_COMPLETION.md / PHASE_3_DEBRIS_SYSTEM.md
Status: Advanced debris destruction system
What was implemented:
- DebrisManager class with state machine (intact → damaged → critical → destroyed)
- Cumulative damage tracking + cooperative damage (multi-attacker)
- Fragment emission progression (6→12→24 particles)
- Material damage visualization (color/emissive lerping)
- 40+ comprehensive unit tests
- Integration with weapon-fire VFX system
API Routing — All systems use consistent /api/[system].php?action= pattern
Frontend Controllers — Runtime*Controller.js pattern for all UI panels
Event System — Window manager (WM) + custom events for inter-system communication
Database Normalization — Separate tables per system (economy_policies, wars, peace_offers, etc)
Configuration — Per-system config files (combat_config.php, galaxy_config.json)
War System (affects gameplay flow)
- War declaration UI → Full dialog with goal customization
- War goal progress calculation → Fix
humiliationandreparationstracking - Peace negotiation UI → Counter-offer capabilities
- Alliance wars → 2v2 or N-faction scenarios
- War-triggered NPC diplomacy reactions
Economy System (production chains)
- Tier-2 goods production completion → Wire all recipes
- Pop class satisfaction mechanics → Full happiness/morale system
- Policy enforcement → War-economy, autarky, mercantilism effects
- Manufacturing bottleneck warnings → Production cap alerts
- Goods capacity enforcement UI → Visual inventory constraints
Pirates System (player interaction)
- Raid countermeasures → Spend credits/military to deter
- Raid impact mechanics → Affect colony resources
- Pirate contract negotiations → Trade/tribute options
- Standing decay visibility → Show changes per tick
- Historical raid archive → Track and analyze patterns
- Economy-War coupling: War economy policy effects, military goods consumption
- Traders system: NPC traders respond to economy policy changes
- Research tree: Economy & war research prerequisites wired
- Achievement system: War/economy/pirate milestone tracking
- Journal events: Declarations, peace treaties, market events logged
Smoke Tests Present:
- ✅
test_pirates_endpoint_smoke.php - ✅
test_economy_endpoint_smoke.php - ✅
test_war_endpoint_smoke.php
Missing E2E Tests:
- War goal progression → Colony occupation → Score increase
- Peace negotiation flow → Offer → Counter → Accept
- Economy policy switch → Production method changes → Goods output changes
- Population class migration → Citizen promotion sequence
- Raid → Damage applied → Defense option → Outcome
| Endpoint | Method | Status | Missing |
|---|---|---|---|
status |
GET | ✅ Complete | Defense options, impact data |
recent_raids |
GET | ✅ Complete | Archive, filtering |
forecast |
GET | ✅ Complete | Predictive ML model, escalation |
run_tick |
POST | ✅ Complete | Return detailed raid list |
| Endpoint | Method | Status | Missing |
|---|---|---|---|
get_overview |
GET | Happiness/welfare integration | |
get_production |
GET | Efficiency breakdown, bottlenecks | |
set_production_method |
POST | Validation of tier requirements | |
get_policy |
GET | ✅ Complete | — |
set_policy |
POST | Enforcement hooks missing | |
set_tax |
POST | ✅ Complete | — |
set_subsidy |
POST | Subsidy calculation | |
get_pop_classes |
GET | Satisfaction values incomplete |
| Endpoint | Method | Status | Missing |
|---|---|---|---|
get_prices |
GET | ✅ Complete | Local scoping needs work |
buy |
POST | ✅ Complete | Wallet integration |
sell |
POST | ✅ Complete | Profit tracking |
get_history |
GET | ✅ Complete | — |
get_active_events |
GET | ✅ Complete | Event creation mechanism |
| Endpoint | Method | Status | Missing |
|---|---|---|---|
list |
GET | ✅ Complete | — |
create |
POST | ✅ Complete | — |
delete |
POST | ✅ Complete | — |
toggle |
POST | ✅ Complete | — |
list_suggestions |
GET | ✅ Complete | Improvement algorithm |
apply_suggestion |
POST | ✅ Complete | — |
list_proposals |
GET | ✅ Complete | — |
propose |
POST | ✅ Complete | Automated responses |
accept |
POST | ✅ Complete | — |
reject |
POST | ✅ Complete | — |
| Endpoint | Method | Status | Missing |
|---|---|---|---|
list |
GET | ✅ Complete | Sorting/filtering options |
get_status |
GET | ✅ Complete | Fleet composition, logistics |
declare |
POST | Goal customization, cooldown enforcement | |
offer_peace |
POST | ✅ Complete | Counter-offers, negotiation flow |
respond_peace |
POST | ✅ Complete | Terms enforcement post-peace |
config/combat_config.php — War balancing constants
config/galaxy_config.json — Diplomacy configs
config/db.php — Database connection
-- War progress tracking
SELECT war_id, goal_type, progress FROM war_goals ...
-- Economy summary
SELECT colony_id, goods_type, quantity, production_rate FROM colonies ...
-- Pirate threat model
SELECT faction_id, threat_score, raids_24h, standing FROM npc_factions ...# Initialize test data
docker compose exec -T web php scripts/bootstrap_25k.php
# Seed traders (for economy testing)
docker compose exec -T web php scripts/initialize_traders_system.php
# Test endpoints individually
php tests/js/api.test.js
php tests/js/war-events.test.js # If exists| System | Feature Completeness | Integration | Frontend | Comment |
|---|---|---|---|---|
| Pirates | 60% | 70% | 50% | Mechanics work, UI minimal, no consequences |
| Economy | 75% | 60% | 65% | API rich but production chains incomplete |
| War | 80% | 75% | 40% | Backend solid, UI needs major work |
| Market | 85% | 90% | 70% | Functional, scoping needs refinement |
| Trade | 90% | 85% | 80% | Mature system, well-integrated |
The GalaxyQuest codebase has solid backend infrastructure for Pirates, Economy, and War systems but uneven frontend integration and incomplete game mechanics.
Critical Path to 100% Functionality:
- Complete economy production chain (Tier-2/3)
- War goal UI + alliance wars
- Pirates defense mechanics
- Policy enforcement hooks
Estimated Effort: 200-300 developer hours to reach full feature parity.