A real-time strategy engine built from scratch in TypeScript and Three.js — no game engine, no shortcuts, no sanity. Inspired by Total Annihilation. Rendered entirely in the browser.
This is a hobby project with no deadline and entirely too much ambition, which is exactly how it should be. The goal is a browser-based RTS with procedurally generated voxel terrain, a proper resource economy, unit combat, and an AI that doesn’t immediately walk into walls.
The current branch (main, promoted from state-machine-implementation) is a terrain and rendering branch. It does not yet contain units or combat — those exist in old-main for reference, but the visual engine rebuild came first. Right now it looks incredible and does nothing. Progress.
LightingSystem.ts alone is 569 lines of carefully tuned nonsenseonBeforeCompile because Three.jsBufferPool.ts is a singleton memory pool that quietly saves the framerate’s lifeReflectionControls panel lets you tune terrain and sun params in real timePhase 2 is terrain improvement — taller mountains, deeper valleys, more readable geography. Primarily a tuning exercise on GameParameters.ts (HEIGHT_SCALE, PERSISTENCE, NOISE_SCALE) plus potentially a valley carving pass using a low-frequency subtracted noise layer.
Phase 3 brings units back: Unit.ts, UnitManager, click-to-select, right-click-to-move on terrain surface, health bars.
Then combat, then the resource system.
The resource design is already specced:
TypeScript (strict), Three.js, Webpack 5, simplex-noise, postprocessing (loaded, not yet wired).
TerrainGenerator.ts — the shader injection via onBeforeCompile is fragile by design and the reflection system depends on precise uniform setup. LightingSystem.ts — colour transitions are parameter-driven and carefully tuned. Touch either at your peril.