Jump to content
  • Advertisement
Sign in to follow this  

Question about Dijkstra's algorithm

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to implement Dijkstra's algorithm for pathfinding through a graph of waypoints. My question is, is the order in which you "visit" nodes (pop them out of the priority queue" the same order as the shortest path? This is what I am assuming right now. Whenever I pop a waypoint from the priority queue, I place its waypoint ID number into a separate queue. When I'm done, I have a queue filled with waypoint IDs, from which I can recover positions for my bot to get to. However, the bot is not obeying the graph edges for some reason! If it sets a goal on the other side of the map, it flies (this is a space shooter) straight to it, unconditionally. Have I assumed something incorrectly? I'm pretty sure that I'm at least handling the waypoint ID's correctly - I push and pop from the queue's front... Let me know if you want to see some code. (There's quite a bit of it I think.) Thanks. :Edit: Oops..errr yeah that's definitely wrong. Nevermind. [Edited by - ITGER on March 26, 2005 5:31:15 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!