Pathfinding unpredicatable

Discussion and feedback on Construct 2

Post » Sat Jul 26, 2014 7:56 am

Please look at the attached CAPX file to see what I mean. Currently the enemy tank is set up to move towards player 1 (controlled by arrow keys) when player one is in line of site. I have two issues:
1) The tank often moves through the solid walls instead of going around
2) Sometimes only one enemy tank seems to discover player 1

Because the process is temperamental you may need to refresh the screen a couple of times until you see it happen.
You do not have the required permissions to view the files attached to this post.
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Sat Jul 26, 2014 10:05 am

I haven't looked at you're capx yet, but make sure that solid walls have solid behavior. and for tanks attacking you got to make them to be a group trough variable and then with events make that group move together if one of them has player in sight.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Post » Sat Jul 26, 2014 7:57 pm

Also I found that for stability it's best to re-build your obstacle scene on start of layout.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Sun Jul 27, 2014 11:30 pm

Hi, the walls have solid behaviours enabled but the enemy tanks still go through them.

I have re-uploaded the CAPX file as the original had a bug w.r.t. movements.
Tank2.capx
You do not have the required permissions to view the files attached to this post.
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Mon Jul 28, 2014 12:01 am

You are calling Has line of site & Find path every tick - that won't work. It takes more than a tick for the find to kick in. Add "Every 1 second" to "Has LOS" and you'll see it works much better.
ImageImageImage
B
71
S
22
G
248
Posts: 3,758
Reputation: 138,067

Post » Mon Jul 28, 2014 12:12 am

Thanks for that but my real problem is that the red tanks sometimes drive through the walls. Any ideas as to why that happens?
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Mon Jul 28, 2014 12:19 am

Does it do it after my suggestion?
ImageImageImage
B
71
S
22
G
248
Posts: 3,758
Reputation: 138,067

Post » Mon Jul 28, 2014 1:45 am

Ok.. I understand... yeah that fixed it. Thanks
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Mon Jul 28, 2014 1:48 am

I answered too quickly.. It still goes through the walls.. will up load updated CAPX now

TankWars3.capx


Just to note, the red tanks respawn when they land in the middle of a wall - this is a simply way to make sure that they respawn off the the walls.

However when they drive around they go through the walls and are therefore respawned.
You do not have the required permissions to view the files attached to this post.
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Mon Jul 28, 2014 2:38 am

I think this has to due with your cell size. Your walls/blocks are multiples of 44(ish) but your pathfinding cells are 30+6, so 40. I would suggest sizing everything appropriately, turning on the grid, aligning with the grid, so that everything is lined up with the grid. Reread the documentation on the cell mechanism. I did a quick experiment and it did seem to improve (I did see the overlaps you were seeing prior to these changes.)
ImageImageImage
B
71
S
22
G
248
Posts: 3,758
Reputation: 138,067


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests