Archived

This topic is now archived and is closed to further replies.

A* in staggered map

This topic is 5425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i have an A* algo implemented in my engine. But the problem is that I have a staggered map. And if i use the stndard heuristic functions to calculate how far the tile is away from the goal this results in very starne results. What heuristic shoul I use. Here''S one example of how it works now aaaaaaaaaaaaaaaaZ aaaaaaaaaaaaaaaa* aaaaaaaaaaaaaaaa* aaaaaaaaaaaaaaaa* S**************** and I want it like this aaaaaaaaaaaaaaaaZ aaaaaaaaaaaaaaa*a aaaaaaaaaaaaaa*aa aaaaaaaaaaaaa*aaa S************aaaa

Share this post


Link to post
Share on other sites
How about using the heuristic:

getMax(abs(x-endx), abs(y-endy))

where x is your current x and y locations and endx and endy
are your current goal coordinates. Make sure that the cost
of moving in diagonals is greater than that of normal movements
though. Hope this helps.

Share this post


Link to post
Share on other sites
How about using the heuristic:

getMax(abs(x-endx), abs(y-endy))

where x is your current x and y locations and endx and endy
are your current goal coordinates. Make sure that the cost
of moving in diagonals is greater than that of normal movements
though. e.g. the cost of moving diagonaly is 2 while moving horizontally or vertically will be 1. Hope this helps.

Share this post


Link to post
Share on other sites