Coalstead, nine times over
A day of making the game fast on a town nine times the size, with clouds, a darker night, a loading screen and haulers that stop changing their minds.
The day started with the grass. Zoomed in on the meadow outside Coalstead, the ground was covered in thin diagonal stripes, as if someone had raked it. That was the ground’s own shadow falling on itself, a known trouble with shadows on flat surfaces. Flat ground has nothing to cast a shadow on anyway, so now only the sides of the hills and the banks cast one.

Then I asked why the game ran at 70 frames a second when my screen can do 144. The perf overlay could not tell me yet, so it learned to show how long the graphics card takes per frame, how long the processor spends on drawing, and how many draw calls go out. The first real culprit was not the town at all. It was the day clock in the corner, which redrew all 24 of its hour wedges every frame, even with the game paused. Now the face is drawn again only when someone changes the working hours, and the hand only when it has actually moved. The build menu had the same habit with the prices on its buttons, and lost it too.
Coalstead itself is too small to show what a late game costs, so I built a bigger one: the whole town copied three by three onto one map, 612 buildings and 360 settlers. It ran at under 10 frames a second. The paths people wear into the grass were being repainted and sent to the graphics card many times a second, so now the wear is read every three quarters of a second and only two pieces of ground are sent per frame. Every animated model had its own little update, every frame, on screen or not. Now one loop moves them all, a model you cannot see only keeps its clock running, and a far one is posed about ten times a second instead of every frame. By the evening it was near 30 in a debug build, which is the slow kind.
Night was far worse. When the glimmers came out, the game dropped to 7 frames a second. The overlay showed why: the glimmers alone took 210 milliseconds a tick, where a whole tick should stay under 17. Every tile a glimmer looked at on its way to food checked every building in the town, and a glimmer walled in by lanterns or a crowd searched again every single tick, up to 4,000 tiles at a time. Now the ground keeps a grid it can answer per tile, and a search that found no way is not tried again until something changes. The glimmers walk exactly the same paths, in a few milliseconds a tick.

Loading that town took a while. So now there is a loading screen: a small cabin with a settler outside, a bush and a tree, all from the game’s own models, and a pixel bar whose squares fly in from the edges of the screen. The town is built in the background in small slices, and the screen stays up at least two seconds, so a quick load does not just flash past.
The sky got clouds, finally. They live in the sky itself, high up, so they never pass in front of the camera, and their shadows drift slowly over the town, even while the game is paused. The night got fixed on the way. It used to get darker through the evening, then brighter in the middle of the night, then darker again just before dawn. Now the night is one steady dark, dark enough that the lanterns are there for a reason.
Then I noticed the haulers. They were walking forward, back, forward, back, with nothing on their heads. A hauler picked which goods to fetch every tick again, and the search started at a different building each tick, so every tick it could pick a different one and turn around. It has been like that since the haulers first learned to fetch. Now a hauler keeps the fetch they chose until it is done or no longer needed. In one test run the haulers changed their minds 12,601 times before and 59 times after, and none of those turned back to what they had just left.
One thing I found and did not fix yet. At night some glimmers end up inside the fenced fields, and the fence is supposed to keep them out. A glimmer walks up to the field’s corner and hops over.
