Spielerando

Scatter coins randomly on a level without piling them on top of each other

Dropping pickups at random spots gives clumps, overlaps and bare patches. Rejecting bad spots helps, until the area fills up and the search never ends. Here is a placement loop that keeps its spacing and always stops, even when the request cannot be met.

Why this works

Spacing is a rule each new item must pass against everything already placed, and a rule can be impossible to satisfy once the room fills up. A search that gives up after a fixed number of tries always ends, and handing back fewer items is better than a game that hangs.

When not to use it

Skip it when the placement is part of the design, such as a trail of coins that guides the player or a line of hand-placed rewards. Random spacing breaks that story. Place those by hand, and keep scattering for open filler areas.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 26 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 "Scatter coins randomly on a level without piling them on top of each other" (read_entry scatter-pickups-with-minimum-distance-and-giving-up) 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