Smarter AI: global pathfinding using distance maps
Next beta will probably feature an update to ActorFOV that uses the (CPU hungry) FOV calculations to creation distance maps for all actors at a low cost.
A distance map is an in memory map for each actor that stores a value equal to "game.turn + LOS_radius - distance from source".
Since we can compute it with FOV it's nearly free to do so, and we can use it for fun things:
- Easy pathfinding, just take the value at your coord on your target's distance map, and check all directions for a value higher than yours, if there is, go there. You'll thus "follow the track" of your target, and get lost if it teleports away (which is good)
- Easy fear: do the same but for lower value and you will naturally flow to unseen areas
This feature is kinda like a follow-by-sent which might not be logical for all monsters though. You could also say it follows tracks left on the ground or something like that.
There will be a new "move_dmap" AI that does just that.
I think I'll use it on most T4 monsters.
Comments, improvements?