The animals weren’t casting the shadows

← All field notes

We were certain the animals were the problem. Hundreds of creatures on a hillside, each one its own thing for the graphics card to draw, and a frame rate that seemed to sag as the herd grew. Five blocks of work were chartered against that idea. The first block built no fix at all. It only measured, and it ended the plan in an afternoon.

The world had filled out over the spring. The roster reached fifty-six species and the temperate population climbed from 441 creatures to 629, which is roughly when the busiest scenes started to feel heavy. The diagnosis wrote itself: too many animals, drawn as too many separate batches. Halve the batches, get the frame back.

What we did before building any of it was to put an instrument in the running scene. Live switches for every lever the plan wanted to pull, so each candidate change could be flipped on and off during play while the cost was recorded. Not to prove the plan right. To price it.

The meter that could not count past sixty

The instrument found something before it found anything about creatures. The frame counter the engine hands you is clamped by the display’s refresh limiter, and it physically cannot report above roughly sixty. Lift the limiter and time the real frame period, and the same scene that had been calmly reading 60.0 was running at about 2,347 frames a second, with a median frame taking 0.426 milliseconds.

So every “we hold 60” in this project’s history was a ceiling, not a measurement — not the first time a frame-rate number was honest and still lied. Including the curve the whole diagnosis was built on. A clamped counter cannot tell you that you have headroom, and it cannot tell you that a change you made did nothing at all.

The belief had been unfalsifiable with the tools we owned.

That is a worse finding than a slow frame. We had measured before we cut once already, back when the plants first outgrew their scene and the cost turned out to be nowhere near the drawing. The habit held. The instrument didn’t. The cap turned out to be only the first thing wrong with the meter — a second defect sat underneath it.

Fifty-four percent of the drawing, eight percent of the cost

With a real timer, we swept the levers on the real machine against a production-sized world: 629 creatures, 3,184 plants. Three independent runs, swept in both directions, with 0.4% of drift between them.

The creatures were 54% of the draw calls, exactly as the plan claimed. They were also 8% of the shadow pass, the separate render of the scene from the sun’s point of view, whose cost scales with how much geometry lands in it rather than how many separate objects sent it. Switching off every animal’s shadow bought 4.3%.

The plant canopy was the mirror image. Two percent of the draw calls — the forest itself had always been almost free to draw. Ninety percent of the shadow pass. Switching off the tree canopy shadows bought 59.2%.

Halving the draw calls moves the frame four percent. The number the plan was denominated in turned out to be almost unrelated to the number we cared about. The frame was not labouring under animals. It was labouring under leaves, in the pass that works out where the shade falls.

An aerial golden-hour view of a soft voxel woodland, tree canopies casting long dappled shadows across a grassy slope with a few animals grazing between them.Concept art · pre‑alpha
Ninety percent of the shadow work, and the reason we kept it: the shade the canopies lay across the ground.

The biggest number in the arc, and we left it

Fifty-nine percent is a lot of frame rate for one switch. We measured it, wrote it down, and declined it.

Dappled light under trees is load-bearing for a game whose whole premise is sitting and watching a world. Trading it away is an aesthetic judgment about what The Long Watch is, not an engineering one, and an aesthetic judgment should be made by eye, not from a number. The switch stays a keypress away behind the same instrument that measured it. If the shade is ever missed less than the frames are wanted, it is a one-line change.

Creature shadows went the same way for a smaller reason: without them the animals would visually float, and 4.3% doesn’t buy that. Pulling the sun’s shadow cutoff distance in from its 100-metre default to 40 metres returned 2.47 frames a second, which is not enough to shorten the world for. The glow effect cost 0.34 milliseconds, below the plan’s own bar for being worth removing. For scale: turning the sun’s shadows off entirely, every last one, buys 96.5%. Nobody proposed it. It was there to show how much of the frame the shadow pass owns.

The shortcut that measured slower

One lever felt too obviously correct to bother pricing: stop animating distant creatures and let far-off movers share a single frozen pose. Fewer animation groups, less work, more frames.

It cut the count of active animation groups by 15%, from 482 down to 409, and cost 3.33 frames a second. Reproduced in both sweep directions, across two runs. The apparent mechanism is that collapsing scattered far-off movers into shared groups smears each group across the world, which pushes it into more shadow bands than the animals it replaced. The saving was real and the cost was larger.

It was inert anyway. Only 14 of the 629 creatures ever sit far enough from the camera for the distance policy to touch them, which is 2.2% of the world’s animals. The mechanism was finished and shipped switched off at zero, next to the planned cap on batch counts that was abandoned outright once its whole thesis had been contradicted by the sweep.

What shipped

One change. The sun draws its shadows into bands by distance from the camera, sharper close in, coarser far out. There were four bands. Now there are two, so a tree canopy renders into two shadow passes instead of four. Shadow geometry fell from 15.75 million primitives to 9.59 million, draw calls from 2,204 to 1,574, and the baseline frame rate went from 69.23 to 88.45. Twenty-six point four percent, for 18.36 frames a second.

It is the only option on the table that buys real frame rate at zero cost to what the world looks like.

Not one shadow left the scene. Every tree still casts, every animal still casts, the shade still moves across the ground the way it did that morning. The world looks identical and runs a quarter faster, which is the entire argument for it. That the change is purely a matter of seeing, with nothing beneath it disturbed, is the same discipline that let the animals get real bodies without the simulation noticing.

The declined levers are written down with their measured numbers beside them, so nobody rebuilds the batch-count work later on a rationale the data already killed. That is what a number is for after you decline it. The 59.2% is still sitting there, one keypress away, waiting on an eye rather than a spreadsheet. The very next brief was written with no diagnosis in it at all, and found half the frame going into a message nobody read.

Keep reading

Concept art · pre‑alpha