Quote:Original post by Codeka Have you tried running that through A*? I'm pretty sure it will work in the way you want it to, as long as your heuristic is correct. |
Check them again :P
And yes i tested it.
The heuristic function takes the deltas (x y and z) make them positive, multiply x and y by two and then add all the results and multiplies all with 1.0 + a p factor where p is minimummovementcost/longestpathexpected (i did 1/100).
So the resulting function is (2*(x+y)+z) * (1.0 + p) (assuming that x,y and z are already positive).
I created a overestimated heur function (since each x or y movement cost 1 and diagonal movement cost 1.4) to make A* expand faster the nodes even if i don't get the shortest path (anyway this algorithm is used by monsters, so if they are a bit "dumb" it's not a problem).
So, imho, the only way the algorithm can reach the point i want to go is to go backward, but going backward the nodes will have worse F cost than the starting one..
Edit: ops, i reread what i wrote and i found why it won't work.
When i read A* articles i understood that the node to find should be the best, better also than the prevoius node and not only the best among the nodes on the open list.
So this way i'll have what i want right?