Pathfinding Jumps

0 favourites
  • 14 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I've never experienced this before.

    I am using two pathfinding objects in my application - one which pathfinds from the computer object to the closest player object, 'tagging' squares along the way. The second one starts at the furthest tagged square and moves to the computer object, creating a 'movement list' along the way. The computer object them moves according to this movement list.

    I'm seeing weird things happen - the pathfinder object seems to ignore several solids and sometimes even jump.

    The .capx has a lot of events, but very few of the events deal with pathfinding (and most of the crucial stuff like cell size is assigned in the editor anyway). You should be able to see what I mean by running the .capx once or twice (be sure the Gameplay layout is selected before you run it!).

    BoardGame.capx

  • I've fixed the pathfinder object jumps.

    Now the third AI program seems to always skip a square even though none of the others do (and they all use the same movement function).

    <img src="http://i.imgur.com/3Lfz5cM.png" border="0" />

    If anyone can take a look, that would be great.

    I'm getting very close to turning this into a playable prototype!

  • Ashley, if I have diagonals turned off for pathfinding, why do pathfinder objects still move diagonally?

    <img src="http://i.imgur.com/SwL20Co.png" border="0" />

    <img src="http://i.imgur.com/Y8NClPn.png" border="0" />

    I'm using cell size 64. I tried 65, but it's one pixel too big, causing pathfinding to jump (teleport) past obstacles. At 64, it seems to take diagonal paths.

  • Bump. I'm still not sure why pathfinding moves diagonally when it's turned off.

  • Excal

    Must be your setup. I have a game at the moment with pathfinding. If i turn diagonals off then the thing moves up Y, stops, turns, then moves across X.

  • Excal,

    Same as plinkie, no diagonal movements. Could be specific setup, tried a few times, didn't get same/similar as what you had.

  • There's still a 'skip' that happens due to pathfinding (shown in my second post), and I'm not sure why that is.

    What do you mean by setup? I have diagonals turned off.

    The third program that moves always ends up skipping because the pathfinding object skips a square or two and teleports to the program. The program moves in the opposite order of squares as the pathfinding object.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Setup = the placement of the squares that tokens can move. They are randomized on each new game. Different board setup.

    I thought if I could get a setup close enough to yours I might witness the diagonal. But I didn't see any diagonal movement.

    Your eyes are better than mine - lol, obviously you've looked at it longer and are noticing the smaller details.

    Okay, I see what you mean about diagonal:

    Yes, pathfind does go diagonal when searching optimal path.

    I tried to see the 3rd program skipping, I couldn't see it skip 2 or so squares. I didn't see it teleport to the program? how to make it do that. Currently they just move till they are opposite my programs. Then I move into them and they disappear.

    So after a few runs I agree that diagonal is in fact on, when it clearly is set to disabled.

    Might be a bug? I don't have any real experience with pathfinding.

  • Is there any way to make the pathfinding obstacle course show up? Maybe a debugger request?

  • The pathfinding example that comes with C2 has some code to show the path etc. Is that of any use?

  • I tossed it in and modified it to the best of my ability, but what it shows me is definitely not the obstacle path.

  • I tried to see the 3rd program skipping, I couldn't see it skip 2 or so squares. I didn't see it teleport to the program? how to make it do that. Currently they just move till they are opposite my programs. Then I move into them and they disappear.

    A lot of times, the pathfinder object for the last computer object 'jumps' to the program and skips several squares. Since the computer object will only move based on how the pathfinder object moved, the computer object will 'jump' past several squares when moving.

    There are other times when pathfinding just fails to work and the computer object sits there and the game stalls because it assumes pathfinding either finds a path or fails to find a path. I don't see how pathfinding can fail to find a path and also not trigger the fail to find path.

    Maybe this isn't even a good way to approach the AI. This is what I came up with because I don't know how to mathematically determine a route from point A to point B, and I figured that's what pathfinding is good for. However, in my setup pathfinding seems to be buggy and inconsistent, and I think I'm going to need a new method for determining movement.

    I looked at an example from R0J0hound, but his version creates the board tiles when they are needed and then mathematically backtracks, whereas my game has the board tiles present at all times and therefore needs some sort of way to traverse (I'm using a pathfinding object) from point A to point B.

    Dave Hailwood, how did you construct the AI for your board game? Anyone else have ideas how to determine a path from point A to point B without using pathfinding?

  • Alright, I added in the code to show the pathfinding grid whenever a pathfinding object is active.

    Can someone please take a look? moveFinder seems to be pathfinding correctly, but spaceTracker has a very erratic pathfinding grid for some odd reason.

    BoardGame.capx

  • Bump. This is the problem I've been struggling with for a month or so now.

    The link above should be updated with the latest version.

    The pathfinding grid shows up whenever a pathfinding object appears, but the problem of diagonal pathfinding (even when diagonals are turned off) still appears.

    I'm starting to think I need a mathematical way to determine paths without using the pathfinding object. If anyone has the time to take a look at this somewhat complicated matter, that would be great.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)