BlockEdge

Technology and digital life

How Frost Kin keeps snow tracks visible without deforming an entire Godot terrain

In Frost Kin, following fresh tracks is easier than breaking a path through deep snow: the player character can walk normally in footprints that have already been pressed. Fabian, the solo developer working as Studio Flugmaschine, explained how he built that behavior in Godot 4.3. The movement code reads the same trail map that shapes the footprints, so the visible path and the walkable one agree.

Fabian first tried deforming the terrain itself with a vertex shader. That meant keeping the mesh dense enough to show a footprint everywhere a character might walk, an inefficient approach for the survival game’s large Arctic landscapes. His replacement keeps the terrain low-poly and reserves geometric dents for the area close to the player. Farther away, shading keeps the same tracks visible out to 40 meters.

One map for footsteps, furrows and fading tracks

The trail map is a 1,024 × 1,024 texture with 12.5 centimeters per texel, covering a 128-meter tile. Its coordinates wrap across the world, but each texel records which tile a mark belongs to. A footprint therefore doesn’t reappear 128 meters away. Each mark also records its depth, or the height of its raised rim, and when it was made. The shader uses that time to fill tracks back in over about two minutes without repeatedly rewriting old marks. Storms speed up the process.

For the player and larger animals, each foot presses only as far as its sole reaches below the snow surface. A planted foot leaves a print; a dragging one cuts a furrow. A hare instead marks its landing points, leaving gaps between hops. Only changed 256 × 256 chunks of the map are uploaded to the GPU, at most 30 times per second.

Where a footprint needs geometry

Three nested square meshes form the snow surface near the player. The innermost section covers the first 10 meters at 10-centimeter vertex spacing and turns trail depths into actual depressions. The next two rings, spanning 10–20 and 20–30 meters, use 20- and 40-centimeter spacing respectively and show tracks through shading alone. All three shift in 40-centimeter increments to keep vertices aligned with fixed points in the world.

To make a shaded track legible, the shader tilts the surface normals along the slope of the print. It also makes compressed snow slightly darker, bluer and smoother than fresh powder. The underlying terrain stays visible even beneath the detailed snow. An earlier version hid it there, but small disagreements between the surfaces opened see-through holes. Fabian now draws the terrain 5 centimeters lower near the player instead.

What a bison herd revealed

Fabian reported that before optimization, the worst frames with a herd of bison in the game’s second level took about 60 milliseconds in script time. In one bad frame, the herd’s feet touched about 17,000 texels. The stamping code now checks how far a foot has moved before processing its mark.

Another cost came from finding the ground beneath the snow. The mesh can sit up to 5 meters ahead of the player in the camera’s viewing direction. When the ground-sampling window followed that mesh, turning the camera could trigger thousands of raycasts even if the player stood still. Centering the window on the player instead eliminated that work on camera turns. As the player moves, the system samples newly exposed ground cells nearest first, with a limit of 200 raycasts per frame. A cell still waiting for a result simply shows the underlying terrain.

Fabian also capped physics processing at three steps per frame so a hitch wouldn’t trigger a chain of repeated snow updates. He gave no post-optimization frame-time figure. One experiment remains switched off: a depth camera produced more exact footprint shapes, but reading its image back to the CPU every frame cost too much.