flood-fill and path-finding

Get help using Construct 2

Post » Mon Apr 11, 2016 8:45 pm

Ok, i tried out that "Goal-Based" path-finding, mentioned earlyer.

https://
drive.google.com/open?id=0B1SSuCVV8v74QndqaUFQT2I3R0k

Aynyone know how to manage the movements better ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Apr 11, 2016 9:35 pm

@99Instances2Go
I can't read your variables, but if you stored the direction to move for each grid in the flood fill step then it's just a matter of moving the enemies in the same direction as the grid they are on.
B
94
S
33
G
114
Posts: 5,358
Reputation: 73,777

Post » Mon Apr 11, 2016 10:13 pm

That is what they do, they just overshoot, and when they move in a dense pack, they tend to get stuck. I choosed for fysics to get them moving by force aligning to the grid.

Only one gets alignd / tick.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Apr 28, 2016 10:09 am

Updated my sample (first page) with better optimization.

Also made interactive version from R0J0 example: pathfind_drag.capx

Image
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Fri May 06, 2016 11:29 am

Add path direction visualization. Finally corner detection tackled!

Image
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Sat Apr 22, 2017 12:32 am

forgive me for necro-ing the post @alextro and/or @r0j0hound but I'd love to see your implementation with an array.

I'm trying to fill this array full of "P"s with a flood fill, and am failing miserably. "For each XY element" does just one row and one column (and their neighbors).

Image

I don't know why it's not traversing the whole array. Are you perhaps spawning miners for each new number that occurs? So that there's a lot of miners simultaneously going around the array and changing things?

thank you
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sat Apr 22, 2017 12:51 am

@christina

Could you share a .capx with that? I think I know what's going on but I'd like to take a look and make sure..
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Sat Apr 22, 2017 12:57 am

of course! http://puu.sh/vs3lw/219ba0875d.capx (check the "pathfinder" function at the bottom)

I think I know what's going on too, I'm telling it to follow the largest number instead of branching out. But I'm not sure how to fix.
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sat Apr 22, 2017 1:58 am

@christina
https://www.dropbox.com/s/n4f2okl6kp07c ... .capx?dl=0
Here's that capx. I can't open capx at the moment so I can't say what's amiss. I'm pretty sure I didn't use for each xy though.
B
94
S
33
G
114
Posts: 5,358
Reputation: 73,777

Post » Sun Apr 23, 2017 3:43 pm

christina wrote:of course! http://puu.sh/vs3lw/219ba0875d.capx (check the "pathfinder" function at the bottom)

I think I know what's going on too, I'm telling it to follow the largest number instead of branching out. But I'm not sure how to fix.


This is quite confusing! I can't understand why you're using that "pathfinder" array to store the CurX and CurY just to use them again instead of referencing them directly...

If you simplify it by removing the pathfinder array from the events it looks like this and gives out the same output:
Image

And it actually helps understand better whats going on I think..
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: jezjones24, newt, R0J0hound and 22 guests