Obstacle Avoidance for Flocking NPCs?

I’m currently making a Zombie AI system but I’m unsure of how to properly implement obstacle avoidance for a flock (or even just a single) NPC. I plan to use these three so called “rules” of flocking,

Alignment,
image

Cohesion,
image

Separation,
image

Which will position each zombie relative to their neighbors.

But I have no idea how to enable these hordes to chase after a player while simultaneously following these rules and avoiding obstacles. I’ve seen some things about using a “leader” system where all other NPCs will follow them, but I just feel like that’s not a viable option.

Help is appreciated.

3 Likes