0
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Please add some context or references to your question. Do you expect everyone to be familiar with your terminology? $\endgroup$ – polfosol Mar 4 '17 at 14:59
  • 1
    $\begingroup$ I am familiar with $A^*$ but I am not familiar with "$G>G$ type algorithm", "$H>H$", or "$G-H > G-H$". These terms also don't appear on the wikipedia page (although the functions $f,g,h$ do). $\endgroup$ – benguin Mar 4 '17 at 15:22
  • $\begingroup$ added an edit, sorry for that. G-H just mean that, if F costs are equal, it picks the one with lesser result of G-H cost substraction. $\endgroup$ – user2998964 Mar 4 '17 at 15:26
  • 1
    $\begingroup$ The best thing that I can possibly think of (at this moment) is to put "sub goals" along the line from the starting point to the finish point. Either that or hard code the movement yourself (you could use a shortest path algorithm on "points of interest" such as near obstacles and then use the hard-coded line movement to traverse each "segment"). $\endgroup$ – benguin Mar 4 '17 at 15:41
  • 1
    $\begingroup$ You might have some better luck in the regular Stack Exchange or the Computer Science Stack Exchange or possibly even in the Game Dev Stack Exchange. $\endgroup$ – benguin Mar 4 '17 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.