Under the hood: how the game works

The Vanguard Expanse 4065 is a multi-layered simulation built on a custom JavaScript engine, with Electron, Node.js and HTML5 Canvas, over nine years of development. This page summarises the developer's own technical write-up for anyone curious about what's under the hood. Version 5200.0 was the Steam release candidate.

Three engines running in parallel

Rather than a static map, the game runs three procedural engines side by side:

  • The Macro-Engine handles galaxy generation, celestial physics and the economic simulation across coordinate space.
  • The Tactical Engine is a real-time particle and physics sandbox for fleet combat.
  • The Narrative Engine powers the Ghost Ship expansion: a text-generation and dungeon-crawling system that creates story beats on the fly.

The core simulation loop

At the heart of the game is a deterministic state machine that processes the universe's logic, conceptually 60 times a second, with the heavy logic throttled to one-second intervals.

The whole reality of your session lives in a single serialised state object rather than a database: resources tracked with floating-point precision, the tech tree, and an array for every ship with its hull, weapons and experience.

Saving used to cause small hiccups. Now the state is serialised and handed to a background Node.js process, so the operating system writes the file without pausing the screen. The autosave runs every 60 seconds, and the save uploads to Steam Cloud.

The galaxy engine

The galaxy isn't an image. It's a mathematical grid. To work out what exists at a given set of coordinates, the engine runs a procedural noise function instead of looking anything up.

Star types follow a weighted curve:

Star classHow commonWhat it means
M and K (red and orange dwarfs)About 70%Low energy, high mineral density
G and F (yellow and white)ModerateBalanced resources
O and B (blue giants)Under 1%Massive energy output, extreme danger
Neutron stars and black holesVery rareAnomalies

Only the stars in view are drawn, unvisited sectors are masked, and fuel cost rises with distance. That's why the game pushes you to build forward bases rather than jumping across the map.

The tactical combat engine

When a fleet engages, the game switches to a real-time sandbox. Every ship has hull, a regenerating shield that needs energy, an evasion value, and weapons with a damage type (laser or kinetic), cooldown and range.

Ships pick targets with a threat-weighted nearest-neighbour search: they ignore dead or cloaked ships and score each enemy on distance and damage output. Ships naturally go for dangerous targets that are close, rather than firing at random.

Lasers and explosions are drawn on their own canvas layer. The particle count is capped and the oldest particles are recycled first, so the frame rate stays above 30 FPS even with hundreds of missiles on screen.

The planetary economy

Resources are rates, not just totals. Production is roughly base rate x mine level x global multipliers x governor bonus, worked out every second. Production depends on the energy grid: if you use more energy than you make, everything slows down. That forces you to balance power plants against mines.

Governors with traits act as percentage modifiers, so planets can specialise into forge worlds or research hubs.

The Ghost Ship narrative engine

Each derelict is a generated chain of sectors (rooms). The ship's tier sets its size, and your intel level acts like a seed: better loot, but more hazards.

The radio chatter is built from decks of dialogue lines. When oxygen drops below 20%, the generic deck swaps for a panic deck, and when the loot is good, greed lines appear. No two boardings read the same. Inside a derelict, oxygen and gravity decay every ten ticks, and if oxygen hits zero, the mission fails.

Parliament

Laws have a chance to pass. Spending Influence on lobbying raises that chance before the vote is resolved, and passing a law writes a permanent modifier into your empire's numbers.

Optimisation

To run on low-end hardware, the page is only touched when a value has actually changed, objects that leave the screen or expire are destroyed, and the galaxy map uses one click listener that works out which star you clicked from the coordinates.

Security and cloud

The global leaderboards are protected. The game signs in silently with Google Firebase to get a secure ID, and the database rejects score uploads without one. Score values are scrambled in memory with a per-session key to defeat casual memory scanners, and only decrypted at the moment they're uploaded.

See the leaderboards on the studio website.