On hilly ground the route up is different from the route down
Enemies walk straight up a cliff the player cannot climb, or avoid a slope that they could simply slide down. Here is how to price a step by the height change, why going back along the same route may be impossible, and how to keep the search honest.
Why this works
Climbing and dropping are different efforts with different limits, so a step is not equal in both directions, and a way down may have no way back up. Pricing each step by its change in height lets the same route search respect cliffs and slopes.
When not to use it
Don't bother on flat maps or when units fly, swim or teleport, where height means nothing. Also skip it if the hills are only decoration and the player cannot feel the difference. Plain flat costs are easier to tune and explain.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 30 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 "On hilly ground the route up is different from the route down" (read_entry uphill-costs-more-than-downhill) 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