Can anyone suggest a quick way of working out a route from one point to another on a simple grid of say 64 tiles?
Can anyone suggest a quick way of working out a route from one point to another on a simple grid of say 64 tiles?
http://www.c5software.co.uk (site is being developed at the moment)
Wasn't there a tutorial about these sort of things in the tutorial section (A*). Or is it just that I have totally misunderstood the question?
Signature:
<br />This is a block of text that can be added to posts you make. There is a 255 character limit
There is a tutorial on the A* algorithm in the tutorials section. For the tutorial I've used a stringgrid to display the information so that it it is possible to see how the route is calculated.
Displaying the route on the grid is not included in the tutorial but an explanation on how to find the route is.
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
For what I need, I ended up coding a very simple routine...
Basically, for each step move one square nearer in the X position if possible, and move one square nearer in the Y position if possible. Store positions previously moved, and if you hit a dead end, work you way backwards trying alternative routes not in your 'walked' list.
I can post the code afterwards, it's not as good as A* but it works for what I need.
http://www.c5software.co.uk (site is being developed at the moment)
That is basically the logic behind A* anyway.
The key is keeping a priority list of unwalked paths. I did this in a String List. The problem with the logic you are using is that it may take tooo long to find the path if it isn;t in a reasonably direct route. The reason I called my algorithm Nearly A* is because it has the same problem - I try to walk striaght to the desitnation instead of in all possible directions at the same time.
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
Bookmarks