0 Favourites

How do I make enemies pathfind around each other

  • Title pretty much says it all. I'm trying to make copies of the same object pathfind around each other.

    Anybody know how to do this?

    Thanks

  • give it solid behaviour, and make sure you have set solids in pathfinding.

    because your objects move - you will have to regenerate their obstacle map constantly. i recommend setting

    each 0.2 sec regenerate obstacle map - so that your objects get updated positions of their obstacles (they are obstacles to each other), and then call find path again to the point they have to go and move along.

  • Oh, that's strange, last time I tried setting them as solids it stopped working, but this time it works. I guess I did something different last time.

    Oh well, lol. Thanks for the response I'll try doing what you said.

  • I think it is a bad idea (performance wise) to treat moving entities as obstacles and regenerate the obstacle map accordingly.

    It is better to use steering behaviors in this case, the enemies will simply avoid each other while following a path around solid (non-moving) obstacles.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hey, Zed, thanks for the response. I'm not sure what you mean by steering behavior. I can't find it in the behavior list and couldn't find it in a google search either, it just brought up the car behavior. Does it have something to do with that?

    Thanks again

  • Anybody else know what Zed may have been referring to with the steering behaviours? I still can't find any reference to it.

    Thanks

  • Hey, Zed, thanks for the response. I'm not sure what you mean by steering behavior. I can't find it in the behavior list and couldn't find it in a google search either, it just brought up the car behavior. Does it have something to do with that?

    Thanks again

    I'm referring to steering behaviors for autonomous agents as explained in Craig Raynold's book :

    Technically there is no behavior in Construct 2 called "Steering" or anything. I'm using the word "behavior" in the general sense.

    A character's movement is composed of many factors called "steering behaviors" according to the book. Path following is only one of them. But because it involves time-consuming pathfinding, I think it is better to leave it for static obstacles. For moving entities like enemies, it is better to use simpler steering behaviors like flee, pursue, or flocking.

    Here are some example, I highly recommend reading the book :

    • Flocking :
    • Simple pursue & evade :

    Here are some good tutorials on steering behaviors :

  • Hey thanks a lot for the info. I'll definitely look into this stuff. Hopefully it's not too over my head

    Thanks again

  • try this link

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