A* algorithm: path in straight line?

311 Views Asked by At

Question for people acquainted with A* pathing algorithm. Is there a way to find straight line path throught A* algorithm while only having G-cost and H-cost values (and F-cost) and not having coordinates of the individual cell? (the cell does not exposes its coordinates. I want to know if it is posible to keep it that way, or i have to rewrite it so it do exposes them)

The G>G type algorithm gives this result: image

While H>H gives this: Cant post cos reputation :(

I managed to make G-H>G-H, but it is wonky, and work half of the time. Here is one of the bad examples, and the way i want it to work: image

If that is not possible tho, what is the best way to make algorithm that do have access to cell's coordinates? Thanks in advance!

EDIT: by G>G or H>H i mean if F costs of the cells are equal, then G or H costs (respectively) are compared to decide what cell to pick.