Skip to content

asln82Ns/armed-existence

Repository files navigation

Armed Existence

A two-stage real-time strategy game built in Godot 4 (GDScript only).

Scale economy = scale military. The core loop is build efficiently → produce more → research faster → field better units → win battles → expand territory → build bigger. Every progression axis feeds the next.

The game splits into two layers that hand off to each other:

  • Stage 1 — Strategic layer (economy, energy, research, base construction, territory). A deterministic 1 Hz simulation where you build and prepare.
  • Stage 2 — Tactical layer (real-time combat). A 30 Hz simulation where pre-built armies fight. Survivors return healed; the dead are gone for good.

Stage 1 sets your ceiling; Stage 2 determines how close you get to it. Neither fully compensates for failure in the other.


Design pillars

  1. Scale economy = scale military. Progression compounds — better economy funds better research funds better armies funds more territory.
  2. Energy gates everything. Every operating building draws energy-per-second. Energy is the constraint you never stop negotiating.
  3. Spatial efficiency matters. Layout has real consequences — road length sets transport time, placement rewards planning over reflexes.
  4. Configuration over code. Every tunable number (~350 of them) lives in JSON config, never hardcoded. Adding a fuel tier, doctrine, or stat is a data edit, not a code change.
  5. Simple fundamentals, emergent complexity. A small set of building types, research branches, one fuel ladder, and one resource-flow graph. Depth comes from player choices between parallel paths, not from piling on systems.
  6. Deterministic by construction. Fixed-timestep sim, seeded PRNG, ordered iteration — multiplayer-ready without a rewrite. A fresh boot produces byte-identical world state across runs.

Stage 1 — Economy, Research & Base

A 1 Hz simulation on a tile grid with player-selectable speed (0.25× → 8×).

Resources & the twin pillars

  • Currency (§) — the universal cost tender. Buildings, research, and units all cost currency; you earn it through export (and later, battle rewards).
  • Energy — the run-time fuel. Produced by Power Plants (and a baseline trickle from HQ), consumed continuously by everything that operates.

Blackout grace timer: when consumption exceeds production, a 30-second countdown begins. Production continues during grace so you can react — pause buildings, demolish for a 30% refund, or build new power. Restore surplus and the timer resets; let it hit zero and a full blackout halts production until you recover.

The fuel ladder

One raw resource comes out of the ground — Crude — which can be burned for energy, exported for currency, or refined into higher-tier products:

Tier Energy-focused output Export-focused output
T1 LSD (Low Sulfur Diesel) E-85
T2 Propane Butane
T3 Syntin Kerosene

Higher-tier fuels carry higher energy density (more energy per unit burned) and higher export value. Some products (Butane, Kerosene) are export-only — pure currency plays.

Resource flow

Wells (on deposits)        → Crude
Power Plants (tier-gated)  + Crude/LSD/Propane/Syntin → Energy
Refineries (tier-gated)    + Crude + Energy           → Refined products
Export Hubs                + any exportable + Energy   → Currency
Research Labs              + Currency + Energy         → Research progress
Military Facilities        + Currency + Energy         → Units
Storage Warehouses         — buffer capacity
HQ                         — baseline energy, small storage, trickle export

Resources move along roads as animated transport packets. A multi-source BFS pathfinder routes output to consumers with a priority order — Power Plants → Refineries → Export Hubs → HQ storage — and load-balances across multiple eligible consumers so packets distribute instead of stacking on one destination.

Buildings

Placed by drag-painting onto the territory grid. Core building roles include HQ, Wells, Power Plants, Refineries, Storage Warehouses, Export Hubs, Research Labs (Military / Industrial), Military Facilities, and Deployment Hubs. Production buildings ramp output up/down over ~15 seconds to avoid jittery on/off oscillation. Any non-HQ building can be paused (draws no energy, produces nothing) or demolished (30% refund).

Research

A tech tree across three branches — Industry, Economy, and Military (logistics is folded into Military). Research nodes are worked on by matching Research Labs; speed scales with how many labs of the right type are running. Nodes draw a continuous energy cost while in progress and gate build-menu access (locked buildings show which research unlocks them). Completed research is the single source of truth — unlock checks scan it on demand rather than caching state.


Stage 2 — Combat (in design; not yet built)

A real-time 30 Hz tactical layer where the army you prepared in Stage 1 fights.

The chassis triangle

Three unit chassis form a rock-paper-scissors counter system:

Chassis Role Strong vs Weak vs Weight
Spirit Fast, cheap infantry Mind Frame 1
Frame Slow, armored vehicle Spirit Mind 8
Mind Specialized anti-armor Frame Spirit 3

Damage is baseDamage × counters[attacker][target], so composition and matchups matter more than raw numbers.

Battles

  • Battlefield attack — two armies meet on open ground; last army standing wins, no time limit.
  • Defensive battle — attacker assaults the defender's front line (pre-placed in Stage 1); defender wins on the timer or by wiping the attacker, attacker wins by destroying all units and walls.

Army composition is constrained by a transport weight cap. Losses have weight — surviving units return fully healed, but dead units are permanently lost, making every battle an economic decision. Stat levels and a growing doctrine catalog let players customize chassis without adding parallel systems.


Architecture

Godot 4, GDScript only (no C# in v1, to keep builds simple). Built directly from the specification documents (see below), not from a prototype.

Autoloads (singletons)

Autoload Responsibility
Config Loads the 11 JSON config files and exposes them read-only. Frozen at runtime.
EventBus Global signal bus.
SimRng Deterministic seeded PRNG (custom API — next_float / next_int / etc. — to avoid shadowing Godot globals).
SaveSystem Saves/loads player state (serializes GameState only, never config).
GameState All mutable player state — currency, buildings, research progress.

Autoload order matters: Config loads first so the others can read it during _ready.

Code layout

config/            11 JSON files — every tunable (~350 values)
autoloads/         Config, EventBus, SimRng, SaveSystem, GameState
scenes/
  main/            Main.tscn — root, switches between Stage 1 / Stage 2
  stage1/          Stage1 scene: buildings/, map/, transport/, ui/
scripts/
  sim/             Pure simulation, no rendering:
                   Stage1Sim, Metrics, Pathfinding, ResourceRouter
  ui/              Palette and shared UI helpers
themes/            industrial.tres

Patterns

  • One unified path per concern — shared helpers (Metrics, ResourceRouter, ramp config) rather than bespoke per-feature plumbing.
  • Static helpers (extends RefCounted + static func) for sim modules with no scene presence.
  • Role-aware branches inside one tick function instead of parallel _tick_<role> functions per building type.
  • Config-driven multipliers (e.g. energy_density) so adding a fuel tier needs zero code.
  • Per-building dict + save coercion — new per-building state survives save/load for free; missing fields default on load so legacy saves stay compatible.
  • Derive read-side state from the source of truth — unlock checks scan completed research on demand, no cache to invalidate.

Configuration

All numbers live in config/ as 11 JSON files (schema documented in config-architecture.md):

core · map · resources · buildings · costs · research · chassis · counters · stat_levels · doctrines · starting_kit

Game logic reads them through the Config autoload — never by parsing JSON directly. Config is read-only at runtime and is never written into save files.


Running the game

Godot 4.6 is the tested engine.

In the editor: open project.godot and press F5.

Headless (CI-style smoke test):

godot --headless --path "/path/to/armed-existence" --quit-after 30

This prints Config + Stage 1 diagnostics and exits.

Determinism check: run the headless command several times — the printed territory / deposit / HQ-cell fingerprint must match byte-for-byte across runs.

Save files live at %APPDATA%/Godot/app_userdata/Armed Existence/save.dat. Use the New button in-game (or delete the file) to start a fresh world.


Documentation

The game is built directly from these specification documents at the project root:

Doc Covers
stage-1-specification.md Economy, research, base layer (1 Hz sim)
stage-2-specification.md Real-time combat layer (30 Hz sim)
config-architecture.md The 11-JSON config schema (~350 tunables)
godot-port-plan.md Scene hierarchy, autoloads, milestones M1–M10
claude-code-runbook.md Session workflow and task templates
CLAUDE.md Living development ledger — current state, decisions, gotchas

Project status

Stage 1 economy and the research tree are implemented with a deterministic, save/loadable base-building loop: territory generation, deposits, wells, power, refineries, storage, export, road transport, and a gated tech tree.

Stage 1 is a sound skeleton, not shipped content — it's at a good structural/visual stopping point, but Tier 2/3 building production and some research-node effects are still incomplete or untuned, and the economy curve needs balance and pacing work to be fun.

Stage 2 combat is specified but not yet built — it's the next major effort. Development proceeds one scoped task per session against the milestone plan in godot-port-plan.md.

About

A two-stage deterministic real-time strategy game. Development in progress.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors