Spielerando

Light a cave with several torches so walls block it and overlaps do not add up

A torch should light the room around it, fade with every step, and stop at walls instead of shining through them. Two torches should not simply double. Here is the rule for each cell, and why pulling a torch down means working it out again.

Why this works

Light that follows walkable paths behaves like people do: it fades with each step and cannot pass walls. Taking the brighter of two lights, instead of adding them, keeps every spot no brighter than its nearest torch, so darkness stays something you can plan around.

When not to use it

Wrong for open outdoor scenes or glowing magic that should shine through walls, and too heavy for a huge map lit by hundreds of flames every moment. There, a simple round glow, or light worked out only near the player, is cheaper.

In the full entry

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

Say this to your AI

Use the Spielerando entry "Light a cave with several torches so walls block it and overlaps do not add up" (read_entry survival-torch-light-around-corners) 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