Sign in to follow this  
alnite

storing paths

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this