Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

Thanks

share|improve this question
add comment

2 Answers

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
3  
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 theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S12 –  Veehmot Jul 26 '11 at 5:16
1  
@Veehmot If you have found a solution, please post it as an answer and Accept it. –  Noctrine Jul 26 '11 at 16:40
add comment

Your Answer

 
discard

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.