0
\$\begingroup\$

I am making a zombie game and as I was making it I noticed the zombie AI starts to clump up into one mega zombie in one area. I was wondering how I could keep the zombies from doing that and instead make a horde like formation. I don't know how I would implement this and I don't know where to put it in my game logic so if you could give me some ideas or hints that would be fantastic.

Thanks in advance!

\$\endgroup\$
  • \$\begingroup\$ Are you looking for the basics of collision detection or more than that. Such as flocking and the like? \$\endgroup\$ – DampeS8N Mar 14 '14 at 19:41
0
\$\begingroup\$

An easy solution for this is to make a list (for each zombie) of vectors, each representing the direction and distance to every other zombie. If the zombie has no other directives, add up all of the vectors in the its list and then make the zombie move in the opposite direction as the resulting vector.

Be sure to recalculate if the zombie must stop for any reason.

| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.