Gunshots wake guards on the other side of a wall that no sound could pass
A shot goes off and every enemy within a circle turns around, including the ones in a sealed room next door. Here is how to let sound follow the corridors, get dulled by doors, and fade out, so only the guards that could hear it react.
Why this works
Sound does not fly through stone, it finds its way along openings and loses strength as it goes. Treating loudness as an amount that is used up along the route lets doors dull it and walls stop it, so only guards who could really hear it react.
When not to use it
Skip it in games with thin walls, open fields or vents, where sound should carry straight through, or when the player wants a simple, readable rule. A plain circle is easier to explain, and players can learn to predict it.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 29 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 "Gunshots wake guards on the other side of a wall that no sound could pass" (read_entry noise-travels-by-walking-distance) 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