Results 1 to 5 of 5

Thread: Plotting routes on a grid

  1. #1

    Plotting routes on a grid

    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)

  2. #2

    Plotting routes on a grid

    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

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Plotting routes on a grid

    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)

  4. #4

    Plotting routes on a grid

    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)

  5. #5
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Plotting routes on a grid

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •