Spielerando

Scroll layers of mist at different speeds so the picture never shows a seam

Drifting mist over a lake at dawn is a favourite backdrop for a quiet scene, and it is easy to ruin: a gap appears when the picture ends, the layers move in lockstep, or the picture jumps whenever the camera crosses an edge. Here is the small piece of arithmetic that prevents all three.

Why this works

Near things seem to move more than far things when you travel, so layers at different depths slide at different rates. A picture that repeats exactly at its edges lets the layers scroll forever without a visible join.

When not to use it

Don't use it for a game with a fixed camera or a single still picture, where nothing moves sideways and the mist would just slide for no reason. A slow gentle pulse of brightness does the job there.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 33 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Scroll layers of mist at different speeds so the picture never shows a seam" (read_entry mist-layers-that-scroll-without-a-seam) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP