How do I make enemies pathfind around each other

Get help using Construct 2

Post » Fri May 01, 2015 6:30 am

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
B
9
S
3
Posts: 52
Reputation: 729

Post » Fri May 01, 2015 6:53 am

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.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,450

Post » Fri May 01, 2015 7:56 am

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 :D I'll try doing what you said.
B
9
S
3
Posts: 52
Reputation: 729

Post » Fri May 01, 2015 10:46 am

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.
ImageImage
B
44
S
14
G
10
Posts: 166
Reputation: 7,779

Post » Fri May 01, 2015 7:10 pm

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
B
9
S
3
Posts: 52
Reputation: 729

Post » Sat May 02, 2015 5:13 am

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

Thanks
B
9
S
3
Posts: 52
Reputation: 729

Post » Sat May 02, 2015 4:09 pm

Maako wrote: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 :
- Flocking : http://www.red3d.com/cwr/boids/
- Simple pursue & evade : http://www.red3d.com/cwr/steer/PursueEvade.html

Here are some good tutorials on steering behaviors : http://gamedevelopment.tutsplus.com/ser ... edev-12732
ImageImage
B
44
S
14
G
10
Posts: 166
Reputation: 7,779

Post » Sat May 02, 2015 8:51 pm

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

Thanks again
B
9
S
3
Posts: 52
Reputation: 729



Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests