how to stop enemies from moving to one point when lots of them are chasing one object

Started by
10 comments, last by alh420 10 years, 5 months ago

Here is another nice page about steering behaviours: http://www.red3d.com/cwr/steer/

A nice thing with those, is that you can make your game avoid the need for proper collision detection, instead it makes sure the entities stay far enough away from eachother that collision doesn't happen.

One could argue that is some kind of collision handling too, and indeed it is similar, but it is a lot more simple to implement and get right.

You never need to detect actual collisions, all you need is a simple distance check

This is so helpful.

Thank u :D

Advertisement

Indeed collision makes the most sense.

Personally, I was faced with this issue no more than 2 weeks ago.

Instead of a strict collision system, I've created a similar behavior to collision, but instead, created what I would call "avoidance".

Whenever a collision would be imminent (distance between the active object and the collided object), the active object would change its course to "avoid" it (aka, pitch/pan its rotation/angle away from).

The upside is that I don't really handle collisions, which means that in some cases, two objects may be on top of one another, in such a way that movement, as a whole, is not impeded. But as a general rule, they'll try to create encirclement (find legal positions around their target).

Overall, it works well, and doesn't consume much process, which was the intent.


Indeed collision makes the most sense.
Personally, I was faced with this issue no more than 2 weeks ago.
Instead of a strict collision system, I've created a similar behavior to collision, but instead, created what I would call "avoidance".
Whenever a collision would be imminent (distance between the active object and the collided object), the active object would change its course to "avoid" it (aka, pitch/pan its rotation/angle away from).

This is pretty much how the steering behaviours work, linked to by me and haegarr. (More accurately, the "avoidance" steering)

They are pretty easy to implement, and can be combined to create quite complex behaviours, apart from just avoidance (like queueing, flocking and path following).

I highly recommend checking through the java visualizations of them.

This topic is closed to new replies.

Advertisement