Pathfinding Bug? Not Seeing Obstacles

Get help using Construct 2

Post » Mon Aug 01, 2016 6:28 pm

I have been fighting with Pathfinding and it has been totally keeping me from progressing in this game, its extremely furstrating.

Here is the code.
Image

It was working just fine, no problems. Then I add something totally unrelated to pathfinding and now when I test the game the Enemy just walks right through the rock1, when before they would walk around it as expected. The only thing I added after the pathfinding was working is the code at the bottom that is disabled which should not have any affect on pathfinding I don't think.

The last version of the game did the same thing and the only way I could get it working again was to delete all of the obstacle objects, delete pathfinding, re-add objects, and re-add pathfinding. I don't want to get 90% through the game and run into this problem again where pathfinding just decides to stop working and I have to start over again. Any ideas? Could it be that I am using a beta branch of Construct 2 (Release 231) ?
Last edited by jmiller4180 on Mon Aug 01, 2016 7:00 pm, edited 1 time in total.
B
9
S
3
Posts: 50
Reputation: 804

Post » Mon Aug 01, 2016 6:57 pm

Just started over and recreated it in Stable release and can verify its doing the same thing. Double checked to make sure obstacles were set to custom, rock1 does not have a solid behaviour, and collisions are enabled on the rock1.
B
9
S
3
Posts: 50
Reputation: 804

Post » Mon Aug 01, 2016 7:56 pm

Allow me to make a wild guess, all in the mind of: Could it be the case that .....

So ... could it be that you started with solid rocks and the pathfinder on default obstacles: solid. Then you changed to custom obstacles. Added them in the 'on start of layout', and it worked.

Well somewhere (on a dark place where i can not bring my dull brain) there is a obstacle map. And there is only one. Meaning, it is not private/instance or object. This map is catched, for performance. So when you (in the could it be that case still) changed to custom obstacles, this map was still catched by the browser. But that did not rest that long.

Your current (the one shown above) events can not work at all. Because you forgot to use the action sprite > pathfinding > Regenerate obstacle map directly after adding the obstacles.

Dont forget: if you move a rock. You should use 'Regenerate region around object'. And find new paths.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Aug 01, 2016 7:58 pm

I think I figured out how to make it work although I am not positive if this is how its supposed to work

I got it working by adding the add obstacle to the on-create event for the Enemy family.

Enemy, On Created ----> Add Pathfinding Obstacle rock1
B
9
S
3
Posts: 50
Reputation: 804


Return to How do I....?

Who is online

Users browsing this forum: marcinkowski and 13 guests