Cradlecrown
A real-time civilization strategy game that runs in the browser.
Cradlecrown, previously called Age of Blocks, is a strategy game I built with TypeScript and Canvas. A match starts with Sumer, Egypt, the Indus, Shang or the Minoans. At the end of each age, the player chooses one of three civilizations to continue with. The existing army and previously earned bonuses carry over.
There are 65 civilizations across five regions, each with its own signature unit.
Technical details
The client is written in TypeScript and HTML5 Canvas without a game engine.
Online matches run through a Node.js and Socket.IO server. Single player uses the same simulation code in the browser, so I do not maintain two separate implementations of the game rules.
In a test scene with 300 units fighting at once, I reduced frame time from about 139 ms to 30 ms by caching unit poses instead of redrawing them from scratch every frame.
Deployment
The game runs on DigitalOcean. The deployment script pulls the latest code, builds the client in a separate directory, replaces the static files and restarts the match server with PM2.
After one release was deployed without its audio files, I added a build check that stops the deployment if those files are missing.
I publish release notes in the Journal on this site. The in-game news section reads the same posts.