How do I solve this pathfinding bug?

0 favourites
  • 8 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I'm facing a very weird bug and I need new insights on this because I ran out of ideas.

    The pathfinding behaviour is not working as intended. The first object works, the others work as soon as they get spawned but then stops when I call the 'find path to' action again. If I destroy the first object that is working, another object starts to working therefore the pathfinding starts to working for this object and the rest keep still(find path and move along path doest not work for them).

    What I've tried.

    I disabled ALL events and It didn't change a thing. Bellow you can see the only events remainded

    I also noted other thing. If I start the game from the first layout, which is my 'Object_Loader' layout, the pathfinding bug continues. However, If I start the game from the 'gameplay' layout, which has no instance of any object, then it works.

    It rises then another question. Why am I being able to create these objects If they never did get loaded in the first place? And why starting from a layout or from another interfers in the pathfinding behaviour like this, even after disabling all events?

  • Other thing I noted is that, If I also regenerate the obstacle map everytime, they start to work normally. I mean, does it make any sense to you?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I also forgot to mention this too. When I restart the layout, the pathfinding starts to work normally too

  • I think you need a for each object_enemies in your on path found statement. I have never really understood when you need a for each statement and when you don't but this may solve your problem.

    In general if something doesn't work I try a for each statement here and there in my code and a few wait 0 statements.

  • winkr7 When the same trigger occurs multiple times at them same tick, internally, c3 already does something similar. However, I tried that too. What is more intriguing is what is needed to be done to make it work, as I mentioned above. Really weird.

  • I created a smaller version of my project for anyone willing to test it.

    drive.google.com/file/d/19GxxBAgWZvBZex0VAWlLumFZ8mNYhJkX/view

    Try starting the game from the "Object_Loader" layout then spawn the several enemies by clicking on screen. You'll see that just one keeps going. Now close it and change the loader layout to "Object_Loader2" and initialize the game from this layout. Run the same test. You'll see that all enemies act accordinly.

    I really think this is a c3 bug Ashley

  • This is the right link drive.google.com/file/d/1j8EUGoxfvNycx3pk7vddcNy90zcW66LP/view

    Sorry but I can't edit my own post

  • This is the right link drive.google.com/file/d/1j8EUGoxfvNycx3pk7vddcNy90zcW66LP/view

    Sorry but I can't edit my own post

    Anyone? =/

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)