Page 6 of 9 FirstFirst ... 45678 ... LastLast
Results 51 to 60 of 90

Thread: A* pathfinding example !

  1. #51

    A* pathfinding example !

    Quote Originally Posted by bigsofty
    Path squeezes between 2 diagonal boxes?
    huh?
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  2. #52

    A* pathfinding example !

    Currently...

    Code:
    SX
    PXPPPPE
     PX
    Should be...

    Code:
    SX
    PX  PPE
     PXP
      P
    X= WALL
    S=START
    E=END
    P=PATH

    The path should go around the lower X, instead is squeezes between the lower and middle X.

  3. #53

    A* pathfinding example !

    there's a boolean parameter switch to turn this behavor on and off in code, tell the pathfinder not to use diagonals if that's bothering you, if it is something else, then you can specify the pathfinder it can't go there in the callback procedure.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  4. #54

    A* pathfinding example !

    Quote Originally Posted by Delfi
    there's a boolean parameter switch to turn this behavor on and off in code, tell the pathfinder not to use diagonals if that's bothering you, if it is something else, then you can specify the pathfinder it can't go there in the callback procedure.
    Ah, cool, nice work

  5. #55

    A* pathfinding example !

    hey, i know this is not really meant to be here, because you guys r doin som great work thinkin (!).

    I jst wanted to ask how you guys make the download link thing. If it's a PGD thing, then how do you upload? If it's from a blog that lets u upload, what blog is it?

    Cheers

  6. #56

    A* pathfinding example !

    [quote="IlovePascal"]I jst wanted to ask how you guys make the download ]

    you need a server to host the file.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  7. #57

    A* pathfinding example !

    Damn! Isn't there another way :cry:

  8. #58
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    A* pathfinding example !

    IlovePascal, make another topic in the Feedback forum to continue this discussion please.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #59

    A* pathfinding example !

    Hey folks,

    right now I found some times to test my pathfinding based on this sample and source.

    I just realized it is not doing what it should do.

    I have my own blocktester:

    Code:
    function TForm1.blocktester(X, Y, Fx, Fy: integer): integer;
    begin
      result:= -1; // if it isnt anything else - it is wall
      if (level[x,y]=255) then result:=round(((ABS(FX-X) + ABS(FY - Y)) * 3))
      else if (level[x,y]=0) or (level[x,y] in [51..55]) then result:= ((ABS(FX-X) + ABS(FY - Y)) * 3)*32;
    end;
    Level=0 means there is nothing, 255 means it is a road, 51..55 is grass.

    For my villagers I call it like this:

    Code:
                StartPoint := Point(round(x),round(z));
                EndPoint := Point(round(ntargetx),round(ntargetz));
                setlength(Astack, 0);
                patherror:=false;
                Astar.findpath(StartPoint, EndPoint, point(levelb-1,levelh-1),true, true, @blocktester);
                setlength(waypath,0);
                setlength(path,0);
                setlength(WayPath,length(path));
                nway:=0;
                if not patherror then begin
                  boolstand:=false;
                  for i:=0 to length(path)-1 do waypath[i]:=path[i];
                end else form1.exceptionmsg('Kein Path gefunden');
    I tried to debug it and realized each time I get an patherror!
    Levelb is the width and Levelh the height of my level (256x256).
    It starts to step and no idea what causes the patherror, any idea?

    PS: Merry XMas.

    Thanks,
    Firle *depressedonxmas*

  10. #60

    A* pathfinding example !

    Sorry, but without more info i can't really help you anything unless you tell us where the code ends up in an error.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

Page 6 of 9 FirstFirst ... 45678 ... LastLast

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
  •