Node based path-finding

About Monkey 2 Forums Monkey 2 Programming Help Node based path-finding

This topic contains 5 replies, has 4 voices, and was last updated by  Hezkore 2 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7167

    Hezkore
    Participant

    I’m trying to figure out a simple way to do node based path-finding, but my math skills are terrible so it’s proven to be a bit too hard for me.
    This is what I’ve got so far, it has no path-finding code.
    Could someone point me in the right direction here, or help me out with some example?
    At line 375 is where the path-finding code would go.

    #7170

    nerobot
    Participant

    Need to know finding rules. At least, can we go to the end point directly without nodes if end is near to start?

    My version:

    1. Go through all nodes and find nearest point to the end by calculating minimal total distance:
      • total = dist(start,node[i])+dist(node[i],end)
      • so we get nodeX, store it to the  path-list
      • note, that end point should be in this check as any other nodes
    2. Goto (2) but replacing ‘start’ with our ‘nodeX’. Until the nearest node will be ‘end’ point.

    In specific case there will be only start and end points as result if any other node have longer distance.

    #7181

    Mark Sibly
    Keymaster

    I think there’s a node/pathfinding demo in blitzmax!

    #7182

    impixi
    Participant

    I think there’s a node/pathfinding demo in blitzmax!

    samples/aaronkoolen/AStar/astar_demo.bmx?

    EDIT: Removed possibly incorrect info.

    @hezkore: I’m not sure I understand your requirements. Do you want to calculate the most efficient route through a set of given nodes?

    #7189

    Hezkore
    Participant

    @impixi Yep!
    I want to place a bunch of nodes and then set one of them as the start node and one as the ending node.
    Then I want a list of the nodes that are needed to go by in order to get to the ending node.

    I’ve started to translate some Monkey X code I’ve found, but it’s tricky heh.

    #7269

    Hezkore
    Participant

    Here’s a translated example.
    Click to place a few nodes, then drag a line between the nodes.
    Hover over a node and press S to place the path start.
    Do the same but press G to place the path goal.
    Press Enter to calculate the path.

    Original code: http://www.monkey-x.com/Community/posts.php?topic=2155

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.