batty-251/outpost-command

By Batty 251 (@batty-251) · Licence: MIT · 1 published version · 28 files · 2.2 MB of source · Last published 2026-09-27

A public project on CodeRook. Browse it at https://coderook.com/batty-251/outpost-command.

Versions

Files in the latest version

README

Outpost Command

A 3D sci-fi colony management RTS that runs in the browser. You are the administrator
of a stranded outpost on the alien world of Arcadia Minor: mine crystal deposits,
feed your colonists, keep the power grid alive, and finish the Orbital Uplink to
call for rescue.

Built with Three.js, no build step, no external assets — every building and the whole
terrain are generated procedurally in code.

Running it

Windows: double-click start.bat.

Any platform, from a terminal:

node server.js

then open <http://localhost:5173>.

Use a local server rather than opening index.html directly — the game uses ES modules,
which browsers block over the file:// protocol.

Three.js is vendored in vendor/three/, so the game runs completely offline.
Installing packages (npm install) is only needed if you want to refresh that copy.

How to play

ActionControl
Pan the cameraW A S D / arrow keys, right- or middle-drag, or push the screen edge
ZoomMouse wheel
Rotate / tilt the viewQ / E
Focus on a selectionF
Open the build barB
Pick a structure1 – 7, or click it in the build bar
PlaceLeft-click · Esc or right-click cancels
Select a structureLeft-click it
Demolish the selectionX
PauseSpace · fast forward with Shift+1/2/3
Save / loadButtons at the bottom (saved in this browser)

The rules of survival

Win: complete the Orbital Uplink (1400 credits, 700 metal, 55s build, 25kW).
Lose: run out of food and let the colony starve out.

The opening is tight on purpose. You have 210 food for six colonists (about 13 minutes
of eating) and the hub alone will not earn the 170 credits for a farm quickly, so the
extractor comes first. Do nothing and the colony is lost in about 13 minutes.

Opening moves

  1. Build a Solar Array (90c, 20m) — you have 6kW of headroom and the extractor needs 4kW.
  2. Build a Metal Extractor (120c) on the nearest crystal field. Zoom out; the cyan clusters are deposits, and they also show on the minimap.
  3. Build a Hydroponics Farm (170c, 50m) before the larder empties. One farm feeds about twenty colonists, so you need another for every twenty you house.
  4. Add a Habitation Dome to grow the population, more Solar Arrays as demand climbs, then a Fabricator for credit income and a Research Lab to speed everything up.
  5. Spread out. One extractor makes roughly 1.4–2.2 metal per second, which is not enough to fund the Uplink or feed a Fabricator, and nodes run dry. Claim several deposits across the map; build range grows as you build.
  6. Then save for the Uplink. It is big: keep a clear 16×16 area near the hub.

Getting unstuck

Project layout

index.html            markup + import map for Three.js
styles.css            the whole interface
server.js             zero-dependency static server
start.bat             double-click launcher
src/
  main.js             bootstrap, game loop, input wiring
  core/
    config.js         ALL balance numbers and building definitions
    gameState.js      the simulation: resources, power, staffing, win/lose, save/load
  world/
    terrain.js        noise heightmap, vertex-coloured ground, crystal deposits, queries
    scene.js          renderer, twin-sun lighting, sky dome, starfield
    cameraRig.js      RTS camera: focus point + yaw/pitch/distance
  render/
    buildingMesh.js   procedural mesh for each structure type
    buildingView.js   keeps meshes in sync with the simulation, animation
  systems/
    placement.js      grid snapping, validity rules, ghost preview, build range
    input.js          keyboard, mouse, drag, zoom
  ui/
    hud.js            resource bar, colony panel, inspector, toasts, float labels
    buildBar.js       the construction catalogue
    minimap.js        terrain relief + live overlays
tests/
  economy.test.js     headless simulation tests (npm test)

Tuning the game

Nearly every number worth adjusting is in src/core/config.js: costs, power draw,
yields, population rates, camera feel, terrain size and palette, and the whole
BUILDINGS catalogue. Adding a new structure means adding an entry there and a mesh
factory in src/render/buildingMesh.js.

Tests

npm test

Runs the headless colony simulation tests — starting state, power and staffing
shortfalls, population growth limits, starvation and defeat, victory, demolition
refunds, save/load round-tripping, metal consumption throttling and storage caps.
These do not need a browser.

There is also a balance probe you can point at your own build orders:

node tests/balanceProbe.mjs

It plays several scripted orders to completion and prints when the colony is lost or
the Uplink finishes, which is how the current numbers were tuned. Edit the probe([...])
calls at the bottom of the file to try your own strategy.

Saving this project to CodeRook

This project is backed up to CodeRook as the project
outpost-command (private), using its cbx command line. CodeRook is not git —
it saves the whole folder as a complete snapshot (a version), so there is no staging
area, no branches and nothing to rebase.

One-time setup on a new machine

npm install --global @coderook/cli     # provides the cbx command

Then sign in. cbx sign-in needs a personal access token, which you create in your
account settings on coderook.com:

tools\coderook-signin.bat              # asks for the token with the input hidden

The token is stored in your own user config (%APPDATA%\CodeRook), never in this folder,
which is why it can never end up in a saved version.

Saving a change

cbx status                             # what is here that is not saved yet
cbx submit -m "what changed"           # save it as a new version
cbx submit -n -m "..."                 # dry run: show what would be sent, send nothing
cbx versions outpost-command           # what has been saved

Restoring the project on another machine:

cbx clone outpost-command outpost-command

cbx reads the ordinary .gitignore in this folder, so node_modules/ and .voxai/
are excluded and never uploaded.

Useful

cbx versions                           # what has been saved
cbx get                                # bring this folder up to date
cbx bundle . outpost-command.cbx        # pack the whole project into one file

Saving is private by default: a new project starts private, and nothing is visible to
anyone else until you explicitly cbx release a version.

Known limitations

PUBLIC REPOSITORY

Opening batty-251/outpost-command…

Loading the public version history and verified file tree.