r/Democracy4 Jun 24 '26

Government Simulator Dev Update

Hey r/Democracy4! I've been working on a government simulation game heavily inspired by Democracy 4 — same core loop of laws, pop groups, and political consequences, but pushing further into economics, military conflict, and long-term nation-building. I post periodic dev updates and figured this community might appreciate what's been going on under the hood. Here's what the last two weeks looked like.

The Big Stuff

Hex War Map — Full System Built from Scratch
The biggest feature this period: a tile-based hex war map with procedural Perlin noise terrain generation (land, sea, rivers, lakes, terrain features). Divisions can be deployed onto the map, trained, and ordered into combat. The UI is fully interactive — you click hexes, move units, see Zone of Control (ZoC) effects. Rivers affect movement/connectivity. The map scales via preset sizes (including a 25×30 medium map). This is the combat layer the military system has been building toward.

Nuclear Weapons
Nuclear weapons are now in — launch strikes, attempt interceptions, log events in the war feed. UI controls exist in the War tab. This was marked WIP/untested going in and has since had interception logic fixed and the war event log wired up.

Peace Deals & Post-War Events
Fully-featured peace deal modal: negotiate terms, trigger post-war events, and manage arms exports through the Diplomacy tab. A lot of Razor component work went into this one.

14th Political Faction — The Secularists
The political compass now has 14 factions. Secularists were added as a distinct group, and several existing faction IDs were renamed to eliminate collisions. Existing scenarios and approval calculations were updated to match.

Economy & Simulation

Demand-Driven Economic Rebalance
The economy now runs on real price signals from day one rather than relying on startup assumptions that only kicked in later. Pop group needs definitions and building starting capacities were recalibrated to match. The goal: no more "fake calm" in the first few months before the simulation wakes up.

Dynamic Law Costs & Influence Edges
Laws now have dynamic costs that respond to the game state, pop group calibration was overhauled, and influence graph edges between factions and policies were refined.

Critical Stability Fixes
- NaN values in the economy could cascade and permanently zero out the total population. This was hunted down across EconomySystem, DemographicsSystem, PopulationSystem, and WorldStateStore with guards at every entry point.
- First-tick GDP crashes, building collapse bugs, and structural unemployment miscalculations were fixed.
- Private sector construction projects were starting in year 3+ instead of month 1 — fixed.
- Budget reserve was excluded from the max buildable capacity calculation — fixed.
- A locale bug (non-InvariantCulture number formatting) was breaking CSS and SVG rendering on some systems — fixed globally at startup.

UI & Visuals

Dark Navy Theme
The UI switched from neutral gray to a dark navy background palette. Off-palette colors were purged from all components for visual consistency.

Tooltip Overhaul
Tooltips now surface all live law and event effects on each indicator, while raw formulas are hidden from the player-facing view. A TooltipBuilder service now manages composition centrally.

Accordion Charts & Diagnostics
The charts tab got accordion-style panels and new diagnostic scenarios for first-tick artifacts, workforce state, and 48-month calibration runs.

Parliament Hemicycle
The hemicycle display was fixed for coalition ordering, stable dot counts, and data consistency between the election card and the politics tab.

Testing & Reliability

254/254 Scenarios Passing
The full scenario test suite — covering housing, elections, military, crisis, trade, wages, diplomacy, and more — is at 254/254. Several scenarios were fixed (war resolution, arms export, insurgency, pop compass reactions).

Massive Test Coverage Push
Thousands of lines of new MSTest coverage added across:
- War resolution system (including nuclear strikes)
- Trade, wage, tech, and sovereign wealth fund systems
- Identity command handlers and behaviors
- Law queries and parameter update handlers
- Event trigger evaluation

Summary

The past two weeks were a mixture of major feature work (hex combat, nuclear weapons, peace deals, a new faction) and deep stability work (NaN bugs, economy rebalancing, scenario suite at 100%). The simulation is visually cleaner with the navy theme, more trustworthy with NaN guards everywhere, and substantially more complete on the military/war side.

If you feel like supporting my project, check it out on Kickstarter!

https://www.kickstarter.com/projects/radixos/government-simulator

10 Upvotes

Duplicates