PathFinding behaviors issue

Discussion and feedback on Construct 2

Post » Mon Feb 18, 2013 6:16 pm

Hi there,

I have several questions about this behavior. I would like to make it work on a grid and only with horizontal and vertical movements. But it seems that is not possible ?

Also, my grid is 22x22, when I have wall like this :

111111111
100000001
100000001
111101111

The number "1" represents walls and "0" holes, that are 22x22 each. This is a closed square but on the bottom , as you can see, there is a hole that is 22x22 too. If I put a sprite in the "square", it is not be able to find a way to get out of there.

I try to use the "border cell" function with -1. That works, but my sprite move on the borders of the walls :( and not with horizontal or vertical movement (it has diagonal movement too).

Normaly it should be find the hole and go down but....no.

Is there something that I missed ?

Thank you in advance :)                 CrystalNoir2013-02-18 18:23:54
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Mon Feb 18, 2013 8:14 pm

The next build has an option to turn diagonals off!
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Feb 20, 2013 8:25 am

That's cool :) Do you think, with this new feature, my "path finding" problem should be resolved ?

As you can see in my sample above, at the same as there is a holes 22x22, the sripte doesn't find the way to go. The fact is that when I turn the border option on with -1 the sprite finds the way but it doesn't respect obstacles (it "walks" on the border of obstacles, instead of walk throught the holes).
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Wed Feb 20, 2013 2:01 pm

Can you share a .capx? Setting a border of -1 shouldn't do that.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Feb 21, 2013 10:53 am

Sure,

http://db.tt/Ilbm6M7p

Look at this sample : it's worse :)

In this sample, I have walls that have 22x22 and two sprites with the same dimensions.

The red sprite is not be able to find a way to go to the blue sprite, at the same as I put -1 in the border property.

It's "only work" if I change the hot point to top left for each element (walls and sprite), and it "works" but it's weird, because the sprite runs on the border of walls instead of take a "linear" path.

The aim of this sample is to make a maze style, with "cell by cell" movement (like a pacman). The holes in this game have the same dimension that a sprite (22x22), the sprite should be able to pass throught theses holes, but it seems that the behavior is not be able to find a path.
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Thu Feb 21, 2013 9:20 pm

Re Hi,

I tried with the last beta version (120) and the problem is the same :(
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Mon Mar 04, 2013 8:40 am

Hello

Ashley do you have some news about this ? have tested the capx ?

Thank you.
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Mon Mar 04, 2013 1:31 pm

It's just because the origins are in the centers of the object. That means every tile overlaps 4 cells in the pathfinding grid, blocking off all the paths. Putting the origin in the top-left aligns the cells with the pathfinding grid so it works.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Tue Mar 05, 2013 10:32 pm

waow, it's weird because I put them in center because at the top left, nothing works...at the same I had a value of -1. Have you got an exemple that works, like a capx may be I will make something wrong (other than the origin) ?
B
11
S
2
G
2
Posts: 53
Reputation: 2,244

Post » Tue Mar 05, 2013 10:39 pm

[QUOTE=CrystalNoir] waow, it's weird because I put them in center because at the top left, nothing works...at the same I had a value of -1. Have you got an exemple that works, like a capx may be I will make something wrong (other than the origin) ?[/QUOTE]

That sample file of the sample standard install folder (what come with C2 when you install it) may help?
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests