How do I make enemies pathfind around each other

0 favourites
  • 9 posts
From the Asset Store
Finding the shortest path through the cells based on the A-star algorithm
  • 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.

  • Try Construct 3

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

    Try 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 : http://www.red3d.com/cwr/steer/

    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 :

    Here are some good tutorials on steering behaviors : http://gamedevelopment.tutsplus.com/ser ... edev-12732

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

    Thanks again

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