Finding the way
Learning paths through this topic
A treasure detector that beeps faster as you get close, without dropped or doubled beeps
Walking toward a buried chest the beeps should speed up smoothly. The easy way, a timer that restarts whenever the distance changes, makes the sound stutter or go silent. Here is how to keep the rhythm steady while the speed changes.
Check that a level with single-use keys can still be finished
If a key is used up by the door, the player can lock themselves out by spending it on the wrong one. A simple walk through the rooms says everything is fine while a real player can get stuck. Here is a check that tries the orders.
Let players claim land around a banner without overlapping a neighbour's claim
In a shared world each player stakes a patch around a banner, and two patches must not cut into each other. The tests are about the distance between the banners, not the patches themselves, and one more rule decides who owns a tile. Here is the whole check.
Plan a route over a river when the player carries only a few bridge planks
A river can be crossed by laying planks, but the bag holds only so many. A shorter path that spends more planks and a longer one that spends none are both valid. Here is how to search so the answer is right and never overspends.
Let monsters hear the player through doors and thin walls, but not through a mountain
Noise should reach farther down an open corridor than through a closed door, and thick rock should swallow it. Here is a way to give every kind of cell its own muffling, so the nearest route for sound is found, not the straight line.
Show an arrow at the screen edge that points to a far-away camp or waypoint
When the base is far off screen the player needs a hint where to go. The marker must sit exactly on the edge, point the right way, and disappear when the target is in view. Here is the small bit of geometry that does it, with a trap at the middle of the screen.
Scatter ore nodes so each kind stays apart from its own kind and from the others
Dropping resources at random puts three iron nodes in one spot and nothing for a long walk. Here is a way to place them from a list of random candidate spots with two different gaps and a count for each kind, and why the order of the list matters.
Find the way out of a spreading grass fire before the flames arrive
A fire that spreads across grass is a moving wall. A route that looks fine on the map can end in the flames if the player arrives at the very moment the fire does. Here is how to know in advance which cells are still a way out.
Hide keys in random rooms but never where the player cannot get to them yet
Putting keys at random in a generated level can lock the key to a door inside the very room that door guards. Build the level in the order the player will play it and the problem cannot arise. Here is the order, and what to do when the level cannot be finished.
A stone plate that opens a gate only under enough weight and closes a moment after
A plate in the floor should react to a heavy crate or a few animals, not to a feather, and the gate should not slam shut the moment the weight steps off. Here is how the plate measures what stands on it and how long the gate stays up.
Respawn the player at the bed that is closest on foot, not through the wall
After a death the player should wake at their nearest bed, but nearest by the straight line may lie behind a cliff and take half the map to reach. Beds can also be broken or boxed in. Here is a choice that handles all of that and has a fallback.
Make a river run from a spring to the sea instead of stopping in a hollow
A river that always steps to the lowest neighbour ends in the first dip it finds and the map shows a river that goes nowhere. Here is a search that finds the real way over the lowest ridge, fills the hollows it crosses, and always reaches the sea if there is one.