Pathfinding Jumps

Get help using Construct 2

Post » Fri Sep 20, 2013 8:56 am

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
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Fri Sep 20, 2013 11:58 am

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).



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

I'm getting very close to turning this into a playable prototype!Excal2013-09-20 13:27:38
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sat Sep 21, 2013 12:39 am

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





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.Excal2013-09-21 00:45:09
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sun Sep 22, 2013 9:01 am

Bump. I'm still not sure why pathfinding moves diagonally when it's turned off.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sun Sep 22, 2013 9:03 am

@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.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sun Sep 22, 2013 10:46 am

@Excal,

Same as plinkie, no diagonal movements. Could be specific setup, tried a few times, didn't get same/similar as what you had.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Sun Sep 22, 2013 5:13 pm

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.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sun Sep 22, 2013 6:07 pm

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.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Tue Sep 24, 2013 10:29 am

Is there any way to make the pathfinding obstacle course show up? Maybe a debugger request?
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Tue Sep 24, 2013 10:57 am

The pathfinding example that comes with C2 has some code to show the path etc. Is that of any use?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,388
Reputation: 58,458

Next

Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, maxwell88, Rable, TELLES0808 and 4 guests