Polish under the hood: the terrain math gets one home

May 9, 2026 — by Matthew Kissinger

This one isn't a feature. It's a fix for a tiny rendering quirk that has been quietly there since 2024, and a piece of cleanup that makes the next round of polish easier to land.

The bug

The terrain in Sheep Dog Sim is a heightfield — a grid of height samples that defines how high the ground is at every (x, z) point on the map. Everything that "sits on the ground" — the dog, the sheep, the trees, the rocks, the camera — needs to ask the heightfield "what's the Y here?" and place itself accordingly.

For a long time, there were two slightly different ways of asking that question: one path that the visible terrain mesh used, and another path that everything else used. The two answers agreed almost everywhere, except in a small set of edge-case pixels where they could disagree by a few centimetres. To compensate, an old workaround added a defensive 5-centimetre lift to one of the paths. It mostly worked — you'd only ever notice it if you put the camera very close to a sheep on a particular slope at a particular angle.

But "mostly works" is the kind of phrase that ends up costing time later. If you're trying to add a new on-ground system — a fence editor, a new prop type, an objective marker — and you can't predict whether the ground is actually at Y or Y + 0.05, every new feature inherits the ambiguity.

The fix

The terrain math now lives in one place. There's a single function that knows how to compute the visible-mesh Y at any (x, z) point, and every consumer (the renderer, the prop placement, the camera, the future fence editor) calls it. The compensating 5-centimetre lift has been deleted.

The deterministic simulation — the part of the code that runs both on the server and on every connected client to keep multiplayer in sync — still uses the raw heightfield, not the mesh-aligned one. That separation is intentional. The simulation cares about being identical across machines, byte for byte; the renderer cares about looking right. They're allowed to disagree by a hair, as long as the disagreement is now centralised and understood.

What you'll notice

Honestly? Probably nothing. If you spent a lot of time in close-up Follow camera mode chasing a sheep across uneven terrain, there's a chance you'll notice that contact looks a touch tighter. Otherwise this is invisible polish — the kind of cleanup that doesn't sell screenshots but makes the next few feature cycles ship faster and with fewer "wait, why does this float" bugs along the way.

Play Sheep Dog Sim →

← Back to game