Dijkstra Maps Visualized
roguebasin.com
roguebasin.com
latest 'community' version: https://github.com/tmewett/BrogueCE
reddit community with seeded contests: https://www.reddit.com/r/brogueforum/
original game: https://sites.google.com/site/broguegame/
Web Archive link: https://web.archive.org/web/20230107220815/http://www.rogueb...
One can drive mobs of cattle (and other domesticated species) by taking advantage of exactly this behaviour.
Since many rogue-likes are played on ASCII grids, using an array to store the gradient field is not that memory intensive. I suspect one can do this in a "continuous" setting by overlaying a gradient field by consider each point of interest (enemies, players, gold) to deform the gradient in some way, say with a localized Gaussian falloff or something similar.
EDIT: Sorry, this specific algorithm is linear falloff in all directions. So it's more akin to calculating Voronoi regions and saving the distance to the point of interest.
I may have missed it in the article but I didn't see anything about trying localized search, everything seemed to use global context to find fairly optimal routes across the grid (graph) surface. Again, I did just skim so pardon me if I missed the interesting nugget.
Maybe I should delete my parent response.
Related: the gradient operation (∇ in vector calculus) on the distance field (called "dijkstra map" on that page) gives you a vector field (called "flow field" in pathfinding).
[1] https://www.redblobgames.com/pathfinding/distance-to-any/
.....x^3
......|
......|
@.....|
----->5
In Manhattan distance, that's 5+3 = 8, in Euclidean distance that's the length of the hypotenuse or about 5.83, but roguelike distance is max(5,3) = 5.(I have just learned that this is also called chessboard distance or Chebyshev distance https://en.wikipedia.org/wiki/Chebyshev_distance , yes the same Chebyshev as in Chebyshev's inequality https://en.wikipedia.org/wiki/Chebyshev%27s_inequality .)