How wjnct55555/liberty-unquenched works
Purpose and runtime
Liberty Unquenched is a browser-only historical political and war simulation centered on CNT-FAI during Spain’s Second Republic and Civil War. React 19 and TypeScript run all rules and UI client-side; there is no backend, persistence layer, API key, or external game service. Vite boots from index.html through src/main.tsx, with the application root in src/App.tsx.
Application composition
App assembles the game’s screen-level experience: start flow, primary political interface, modal panels, events, ending states, music, and the optional war map. The main layout is divided into status/navigation surfaces and interactive content:
• src/components/MainArea.tsx
• src/components/SidePanel.tsx
• src/components/TopBar.tsx
Specialized overlays expose domestic politics, policy/economy, advisors, journals, achievements, super-events, and conclusions.
Central game state boundary
src/game/GameContext.tsx is the primary political-simulation state and mutation boundary, likely providing shared state/actions to UI and rules. Its domain contract is defined by:
• src/game/types.ts
• src/game/data.ts
• src/game/constants.ts
Political state includes date/progression, resources, parties, factions, social-class support, government, effects, active events, and related unlock/condition state. Game UI should consume and mutate this context rather than embedding rule decisions in components.
Content-driven political rule modules
Historical and player-driven content is organized as TypeScript rule definitions rather than remote data:
• src/game/action_affairs/index.ts
• src/game/government_affairs/index.ts
• src/game/military_affairs/index.ts
These modules define available decisions such as organizing, propaganda, policy, labor, diplomacy, and militia actions, including prerequisites, costs, cooldowns, and effects. Advisors and long-term objectives are parallel registries:
• src/game/advisors/index.ts
• src/game/journal/index.ts
The UI presents these definitions and previews effects via components such as src/components/AdvisorPanel.tsx and src/components/EffectPreviewTooltip.tsx.
Events and progression
The event registry drives timed/conditional historical progression and player choices:
• src/game/events/index.ts
• src/game/events/elections_1931_results.tsx
• src/game/events/civil_war/civil_war_setup.ts
Events read political state, apply mutations, and can branch into elections, crises, organization formation, revolts, civil-war setup, surrender, or ending outcomes. src/components/EventBoard.tsx renders regular choices; src/components/SuperEvent.tsx and src/components/EndingScreen.tsx handle high-impact narrative/state transitions.
Politics, electoral computation, and visualization
Party definitions, display names, coalitions, law stances, and election calculations form an interdependent political subsystem:
• src/game/parties.ts
• src/game/coalitions.ts
• src/game/utils/election.ts
Results feed domestic-politics UI and D3 seat visualization:
• src/components/DomesticPoliticsModal.tsx
• src/components/ParliamentChart.tsx
• src/lib/d3-parliament.ts
Changes to parties, support, or coalitions must preserve these shared type and calculation contracts.
Map and war subsystem
The province war game is a distinct state/model boundary from ordinary political state:
• src/map/types_map.ts
• src/map/MapView.tsx
• src/map/map_constants.ts
It models provinces, control, armies, resources, buildings, supply, combat, and military actions. src/map/ProvinceMap.tsx renders geographic interaction using bundled GeoJSON under public/date/; src/map/Sidebar.tsx provides command controls; src/map/lib/gameAi.ts supplies AI behavior. src/map/WarSummary.tsx aggregates opposing war capacity and outcomes.
Assets and deployment
Static imagery, music, terrain, and geographic datasets ship with the frontend under public/img/, public/music/, and public/date/. GitHub Actions builds and type-checks with Node 20, then deploys Vite output to GitHub Pages:
• .github/workflows/deploy.yml
• vite.config.ts
• package.json
The deployment relies on VITE_BASE_PATH so static asset paths work under the repository’s GitHub Pages subpath.
Main entry points: GameContext.tsx Political game context · App.tsx Application root · MapView.tsx War map view · vite.config.ts Vite build
Components 20
Browser Runtime
- Vite entry page
index.html - React bootstrap
src/main.tsx - Application root · Assembles screens, overlays, music, and optional war map.
src/App.tsx - Main game layout · Status, navigation, and interactive content surfaces.
src/components/MainArea.tsx - Bundled static assets · Imagery, music, terrain, and geographic datasets.
Political Simulation
- Political game context · Shared political state and mutation actions.
src/game/GameContext.tsx - Political domain contract · State types, seed data, and constants.
src/game/types.ts - Affairs registries · Player decisions, prerequisites, costs, cooldowns, and effects.
src/game/action_affairs/index.ts - Advisors & objectives
src/game/advisors/index.ts - Historical event registry · Timed and conditional choices drive historical branches.
src/game/events/index.ts - Events & endings · Renders choices, super-events, and conclusions.
src/components/EventBoard.tsx - Election subsystem · Parties, coalitions, stances, and seat calculations.
src/game/utils/election.ts - Domestic politics chart
src/components/ParliamentChart.tsx
War Map
- War state model · Provinces, armies, supply, combat, resources, and actions.
src/map/types_map.ts - War map view · Hosts geographic interaction and war controls.
src/map/MapView.tsx - Province map
src/map/ProvinceMap.tsx - War AI
src/map/lib/gameAi.ts - War summary
src/map/WarSummary.tsx
Build & Deploy
- Vite build · Uses VITE_BASE_PATH for GitHub Pages asset paths.
vite.config.ts - GitHub Pages deployment · Node 20 build, type-check, and deploy.
.github/workflows/deploy.yml
Connections 23
- Vite entry page → React bootstrap: loads
- React bootstrap → Application root: mounts
- Application root → Main game layout: composes
- Application root → Political game context: provides state
- Application root → Events & endings: opens overlays
- Application root → War map view: optionally shows
- Main game layout → Political game context: reads and mutates
- Political game context → Political domain contract: uses
- Political game context → Affairs registries: evaluates actions
- Political game context → Advisors & objectives: tracks content
- Political game context → Historical event registry: evaluates progression
- Historical event registry → Events & endings: supplies choices
- Events & endings → Political game context: applies outcomes
- Political game context → Election subsystem: supplies support and laws
- Election subsystem → Domestic politics chart: produces seats
- War map view → War state model: reads and mutates
- War map view → Province map: renders geography
- Province map → Bundled static assets: loads GeoJSON
- War map view → War AI: runs opposing actions
- War state model → War summary: aggregates capacity
- Vite build → Vite entry page: builds entry
- Vite build → Bundled static assets: serves with base path
- GitHub Pages deployment → Vite build: runs