# storing paths

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

## 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 on other sites
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 on other sites
Quote:
 Original post by RobAU78Well, 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!

• 17
• 10
• 19
• 14
• 19