Archived

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

No

A* in staggered map

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
I''ve implemented a normal Isometric view. For pathfinding and obstacles I have overlaid the visible map with a normal square grid. I am currently implementing the pathfinding within this grid.

Share this post


Link to post
Share on other sites