• Advertisement
Sign in to follow this  

storing paths

This topic is 4330 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

I am implementing A* and I've got a fairly good book about it. However I am a little stuck on implementing paths right now. That's why I am asking this in this forum not the AI forum. I am asking about storing paths, not the A*. The only solution I could come up so far was to keep a queue of vectors. Objects would pop a vector and traverse it one a time until the queue is empty. Using this approach, however, would assume that a vector must not intersect with any impassable barriers, and if a new path is created, the old path (composed of vectors) must be tossed away. This approach might work, but considering the amount of work it's doing, I'd like to hear an alternative approach. How do you guys handle your paths?

Share this post


Link to post
Share on other sites
Advertisement
Well, A* is usually done with a graph (i.e. a set of interconnected nodes). All you would really need to do is make a Node class where each instance has references to other Nodes on the graph that it's connected to (i.e. its "neighbors"). As you traverse the graph, you would just build the path as a set of nodes.

Let me know if this helps.

- Rob

Share this post


Link to post
Share on other sites
Quote:
Original post by RobAU78
Well, A* is usually done with a graph (i.e. a set of interconnected nodes). All you would really need to do is make a Node class where each instance has references to other Nodes on the graph that it's connected to (i.e. its "neighbors"). As you traverse the graph, you would just build the path as a set of nodes.

Let me know if this helps.

- Rob


Ah, that would make a lot more sense. Objects would go from nodes to nodes. Thanks!

Share this post


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

  • Advertisement