Skip to the page
LiamMcraft

A faster world: the first round of speed fixes

By LiamAbout 2 minutes to readChangelog

Testing first. On Thursday I ran a full bug and speed test on the live game: hundreds of simulated years, every kind of card, saves, and CPU profiles at every zoom at 1× and Max. The game held up well (no errors, no broken values), but it slowed down as the world grew, and Max speed couldn't keep its pace. So today is the first round of fixes, each one measured against Thursday's numbers on the same machine.

Towns stop re-checking the same ground. Half of the simulation's time was spent by towns looking for a place to put their next building, testing every candidate spot against every path point in the town. Paths now remember where their stretches lie, so a spot far from most of a path skips them, and the path-crossing checks only look closely at buildings near the line. A 200-year world now simulates about 38% faster, and it plays out exactly the same: I checked that the world after 200 years is identical, building for building.

The map repaints without stalling. When the season changes, the land is recoloured: snow, autumn leaves, bare branches. That used to repaint whole map tiles in one go, which at Max made far zoom crawl. Now each tile is repainted a few rows at a time inside each frame's budget, while the old picture stays up until the new one is ready. The background weather-and-plants engine also stopped sending all 57,000 plants to the page twice a second. It now sends just the per-tile summary the map uses. In the same tests, far zoom at Max went from 12 to about 25 frames a second, and continent zoom from 15 to 47.

Clouds that don't stutter. The local clouds were rebuilt in one go several times a second, which made small hitches at region zoom. They're now rebuilt a slice at a time and slid along with the wind in between, so they cost about a third of what they did, and they slowly change shape as they drift.

Explorers at sea find their way again. Yesterday's update taught boats to steer round headlands, but in some bays they bounced back and forth for most of a year. Sea explorers and traders now plan a route round the coasts before they set out, and anyone who stops getting closer to their next stop carries on the straight way after a few days. In a 250-year test, no traveller got lost (56 did before).

Lighter on memory and downloads. The pictures of town ground kept in memory are capped at about 60 MB instead of 200, and checked every second. The ambient sound loops are only downloaded the first time they're needed, which saves about 3 MB at startup.

Next comes the bigger change: moving the simulation onto its own thread so drawing never waits for it, then moving its busiest parts to Rust, one piece at a time and each checked against the current version.

GameClose stops the game. Your progress saves in this browser.Open full page