← back to blog

Building a real-time strategy game engine from scratch

code

I wanted to play a specific type of RTS that doesn’t really exist any more. Browser-based, proper terrain, a resource economy that makes you actually think, enough units on screen to make your GPU have a quiet word with itself. Total Annihilation vibes. Nobody’s made it. So I’m making it.

Yes I know.

The engine is built in TypeScript with Three.js for rendering. I picked that stack because it runs in a browser and I wanted to understand Three.js properly rather than just copying examples until something worked. The constraint of “no game engine, figure it out yourself” is annoying in exactly the way that teaches you things.

where it is right now

Current state: it looks incredible and does nothing.

That’s not entirely fair. The terrain generation works — procedural voxel terrain using Simplex noise, height-based colouring, 4,000 × 4,000 world units. There’s a full dynamic lighting system with a sun that orbits, a sky that changes colour at sunrise and sunset, and a reflection shader on the terrain surface that responds to the sun angle and your view position. There’s a performance monitor overlay, buffer pooling to stop the framerate dying, an orbit camera with proper damping.

It is a very good-looking empty world.

The thing is I took a deliberate decision to rebuild the visual engine properly before putting gameplay back on top of it. There’s an older branch with units and combat in it. It worked. It was also built on shaky foundations and I knew it. So I started again on the renderer, did it right, and now I have a very pretty landscape with nothing in it.

This is a metaphor for something. I’m not sure what.

what’s actually next

Terrain needs more drama first — the mountains aren’t tall enough and the valleys don’t read as valleys yet. That’s mostly a tuning exercise on a handful of noise parameters, not a rewrite. Then units come back. Click to select, right click to move, health bars, the basics.

Then combat. Then the resource economy, which I’ve already fully designed on paper — four resource types, different collection mechanics, one of them deliberately tied to the day/night cycle that already exists in the lighting system. That bit I’m actually quite pleased with.

Then pathfinding. I’m not thinking about pathfinding yet. One thing at a time.

The repo is on GitHub if you want to watch the world’s most over-engineered hobby project slowly become a game. No timeline. No promises. It’ll be done when it’s done, probably never, but it’ll look great throughout.