Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

anyone can share a link for a tutorial or article about optimizing A* for horizontal / vertical movement (no diagonal). Is not as easy as change the G values to 10 everytime.


share|improve this question

A* is a graph search; the algorithm doesn't know or care whether you're searching a grid (with or without permissible diagonal movement) or a free-form graph. To "optimize" for the case where diagonal movement isn't allowed, make sure to never return diagonally-adjacent nodes when computing the neighbors of the current node. Between that and selecting an appropriate heuristic for your scenario, there's little in the way of optimizations available specifically for the 4-directional grid case (as far as I'm aware).

share|improve this answer
That's what I have done already, but still the score is strange. For example, I get the same F score for every node. – Veehmot Jul 26 '11 at 3:53
That sounds more like a bug in your implementation. Perhaps you should post another question asking for help with your code? – Josh Petrie Jul 26 '11 at 5:06
Nevermind, it is an issue of A* itself. I found the answer here – Veehmot Jul 26 '11 at 5:16
@Veehmot If you have found a solution, please post it as an answer and Accept it. – Noctrine Jul 26 '11 at 16:40
up vote 0 down vote accepted

I found the info needed here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.