1
Programming / Dijkstra Map
« on: September 24, 2013, 10:20:34 PM »
I can't figure out the safety behavior from:
http://roguebasin.roguelikedevelopment.org/index.php?title=The_Incredible_Power_of_Dijkstra_Maps
m is a monkey that needs to flee the approaching player.
So first I do this:
"Start with a Dijkstra map calculated around goal points at the player's location and at any player allies from which your monsters will also want to flee."
Which produces this:
Then it says:
"Multiply every value in the map by a negative number somewhere in the neighborhood of -1.2"
"Take the result and pass it back through the Dijkstra scanning function. "
That's what I am stuck on. The scanning function involves:
"If any floor tile has a value that is at least 2 greater than its lowest-value floor neighbor, set it to be exactly 1 greater than its lowest value neighbor."
But how will that ever be true? How will any tile be at least 2 greater than its lowest-value floor neighbour when I have multiplied them all by 1.2?
As it stands the monkey is just going to sit in that dead end as the player approaches rather than jump out and flee to the south.
I suspect I've misread something and got the wrong end of the stick concerning the -1.2 multiplication and the rescan. But I've read it again and again and nothing springs to mind.
http://roguebasin.roguelikedevelopment.org/index.php?title=The_Incredible_Power_of_Dijkstra_Maps
m is a monkey that needs to flee the approaching player.
So first I do this:
"Start with a Dijkstra map calculated around goal points at the player's location and at any player allies from which your monsters will also want to flee."
Which produces this:
Code: [Select]
# # # # # # # # #
@ 1 2 3 4 5 6 m #
# # # # # 6 # # #
# 7 #
Then it says:
"Multiply every value in the map by a negative number somewhere in the neighborhood of -1.2"
Code: [Select]
# # # # # # # # #
@ -1.2 -2.4 -3.6 -4.8 -6 -7.2 m #
# # # # # -7.2 # # #
# -8.4 #
"Take the result and pass it back through the Dijkstra scanning function. "
That's what I am stuck on. The scanning function involves:
"If any floor tile has a value that is at least 2 greater than its lowest-value floor neighbor, set it to be exactly 1 greater than its lowest value neighbor."
But how will that ever be true? How will any tile be at least 2 greater than its lowest-value floor neighbour when I have multiplied them all by 1.2?
As it stands the monkey is just going to sit in that dead end as the player approaches rather than jump out and flee to the south.
I suspect I've misread something and got the wrong end of the stick concerning the -1.2 multiplication and the rescan. But I've read it again and again and nothing springs to mind.