Ember Colony taught us what the engine was missing for one kind of game. Once its content was done, we wanted a game that would push harder. That's Wyrmworks: you hunt monsters, break their parts, and feed those parts into a factory that builds better gear, while your colonists keep the works running and the valley reacts to the noise you make. It's now our flagship, and Ember Colony stays on as a proof-of-concept demo. Wyrmworks is still a working title.
Three genres that need each other
Genre mashups often end up as three games bolted together, sharing an inventory and little else. The design for Wyrmworks starts from a rule meant to avoid that: what each genre can't do on its own has to come from one of the others.
| Part | What it can't do alone | Who supplies it |
|---|---|---|
| The hunt | Harder monsters need better gear, and better gear needs refined materials in volume | The factory |
| The factory | Machines need inputs the ground can't give, like sinew for belts and flame sacs for hot smelters, plus people to build and maintain them | The hunt and the colony |
| The colony | There's never enough labour, and people are slow, fragile and moody | Automation frees people up, and gear keeps them alive |
The fourth piece keeps the loop from running away: the valley itself. Industry makes Disturbance (noise, smoke, light at night, rotting carcasses), and the wildlife reacts. Herds move off, predators get bolder, and the biggest monsters wake up. How hard you push is up to you.
Four seasons as one campaign
The prototype went in on 25 October. Since then we've built it in milestones, one season of the campaign each:
- First Season (days 1–8): colonists with traits, needs, moods and work priorities, hunting parties, the first tiers and a storyteller that reacts to the valley.
- Ranch & Power (days 9–16): capturing and penning monsters, power networks, brownouts, and a dynamo driven by a captured Thunderhorn.
- The Valley (days 17–24): six more regions open up, with terrain, Disturbance as a field on the ground, swarms that go for lit machines at night, rot and sickness, turf wars between species, and the largest monster slowly waking.
- Foundry (days 25–32): powered belts, tunnels, overclocking with monster cores, breeding, injuries and prosthetics, and the Foundry tier.
One early decision made all of this harder to test. Season 2 could have been its own scenario with a fixed start. Instead it carries on from whatever colony season 1 left you. The design document is blunt about it: design comes first, and if that makes something hard to test, fix the testing. So the tests start from save files captured at the end of each season, and a scripted campaign bot plays the whole thing. On all three seeds we test, it plays through to the end of season 4 and wins seasons 2, 3 and 4.
Today the game is about 14,700 lines of NAL in 22 files, with 42 test files of its own. A simulation tick on day 28 takes about 1.15 ms in a release build, inside our 1.5 ms budget.
What it pushed into the engine
The rule from Ember Colony still holds: when the game needs something NAL can't do, we fix the engine instead of working around it. One kind of fix came up again and again this month. When NAL code turned out to be doing the engine's job, slowly, we moved that job into the engine.
- Ground fields. Disturbance started as a number per region. Now it's a grid over the ground that the engine spreads and decays in fixed steps, and saves. The player and the headless renderer can both draw it as a heat map.
- Terrain. A heightmap with height, slope and picking queries, keeping things on the ground, blocking cliffs for pathfinding, and drawing it as a lit mesh.
- Item buffers and belts. The stockpile, every machine's input and output slots, and every belt used to be NAL fields updated by NAL systems. They're now engine buffers, and the engine moves items along belts. We moved them over in steps, and at the end the campaign bot's results on all three seeds were identical to before, down to every daily row.
- Smaller pieces, like a stable hash function, adding and removing components at runtime, and a rate limit on
uievaluation.
Here's the Disturbance pattern on its own, cut down from the game. Machines stamp noise into a field, and a herd reads the field around it:
// Running machines stamp noise into the ground around them.
system MachineNoise {
query: [Machine, Transform3D];
interval: 1.0;
transform {
if (Machine.running) {
Field.add("disturb", Transform3D.x, Transform3D.z, Machine.noise, 12.0);
}
}
}
// A herd reads the mean Disturbance around it and moves off when it's loud.
system HerdUnease {
query: [Herd];
interval: 1.0;
transform {
Herd.calm = Field.mean("disturb", Herd.x, Herd.z, 20.0);
if (Herd.calm > 6.0) { Herd.x += 4.0; }
}
}The full example, with the field set up in on_start, passes nal-validate. In the game the same few calls drive which regions herds graze in, how calm the works are, and when the valley's monsters come looking.
The next step, measured first
After the fourth season come two things: tuning the whole game with its first playtesters, and a Sandbox mode, an endless game in the style of Banished on a generated map much bigger than today's 200 × 200. Before planning the map, we measured what the engine does with one. A benchmark loads the end-of-season-3 save and scatters scenery out to larger map sizes at today's density:
| Map size | Entities | Tick | Render extraction | Save |
|---|---|---|---|---|
| 200 (today) | 962 | 1.61 ms | 0.21 ms | 902 KB |
| 512 | 3,969 | 2.14 ms | 1.49 ms | 2.4 MB |
| 768 | 7,822 | 2.99 ms | 3.02 ms | 4.3 MB |
| 1024 | 13,068 | 4.26 ms | 4.87 ms | 6.9 MB |
These are single runs on one machine, and tick times vary by about ±0.2 ms between runs. Memory was fine, at about 2.9 KB a prop. The cost is that scenery props are ordinary entities: three quarters of today's entities are static scenery, and each one costs time every frame.
The obvious fix was frustum culling, so we built it. On the 768 map it threw away 95% of the render records and saved 4% of the time. Reaching each entity to test it costs more than the reads we skip. The real fix is to stop making scenery entities in the first place and draw it as instanced batches, and the Sandbox plan now treats that as the first gate.
Wyrmworks now has its own page, with the campaign, the wildlife and what the game has changed in the engine.