The world arrives

A bug report about treetops pulls a thread, and the thread unravels all the way down to a single function that has quietly returned true since version 0.8 — hiding an entire planet's worth of mountains behind it.

The report

Two complaints came in from playtesting: distant treetops were still getting sliced off at the horizon, and the skeletons' walk animation kept freezing mid-stride, as if someone hit pause on just their bones. Two small bugs. Neither was small.

The tree gate that measured from the wrong floor

The renderer skips tree geometry for any ray high above the ground — a big, honest optimization. But "high above the ground" was measured from the planet's smooth sphere, not from the terrain standing on it. The moment hills entered the game, any tree growing on one poked its crown above the cutoff altitude and got decapitated. A tree is now allowed to be exactly as tall as a tree, measured from the dirt it grows in.

Eleven versions of a dead branch

Chasing that gate exposed something much bigger. Three releases ago we celebrated "reconnecting the terrain" — a height table baked once and read by rendering, physics, collision, and tree placement alike. Mountains! Lakes! Except the raymarcher's terrain code had been wired into the else side of a branch whose condition — one line, written back in v0.8.0 — always returns true. The terrain march, the height cache, the careful step-size logic: all of it compiled, shipped, and never executed once. Near the player, terrain rendered through the fine physics field and looked convincing. Past 64 metres, the planet was still a perfectly smooth billiard ball wearing distant trees like pins on a globe.

The fix moved the heightfield into the one code path that actually runs. The far field is the terrain now: rays sphere-trace against real relief with a per-ray height cache (one texture read per ~8 metres of travel, so the frame budget survives), and surface normals at distance come from the true slope of the land.

And then there were mountains

The before/after is not subtle. Before: a flat horizon dissolving into fog. After: three ridgelines stacked in atmospheric haze, a dark peak on the eastern skyline, and — dead north of spawn, exactly where the world-builder placed them — the Shaper's Teeth, 350 metres out and 90 metres tall, wearing snow caps the biome system painted on its own the instant far hits started reporting their real altitude. Nobody wrote a "snow on mountains" feature this week. The rules were already there, waiting for the mountains to exist.

The skeleton metronome

The frozen walk was a different flavor of lie. The animation clips had been converted from a format that pads every animation to the full timeline length — so a 1.4-second walk cycle arrived as a 10.42-second clip: 1.4 seconds of walking followed by 9 seconds of frozen hold. Every clip on two of the skeleton rigs had the identical duration, which was the tell. The converter now trims each clip at its last meaningful keyframe — walks loop in under a second, deaths take their full dramatic 2–3 seconds, and every animation plays at the length its animator intended.

Engine v0.22.6. Verified: 38 unit tests, 4 DFD physics gates, 38-stage two-server bot verification, headless perf gate at 21.91 ms against the 22 ms budget — real mountains cost about 0.7 ms. Lesson of the day, engraved in the loop's memory: before writing a fix into a branch, check that the branch can run.