Best way to effiently make mass NPCs in an open area?

I want to create an open environment (Zombie style game) where you walk around a large area. And there is zombies everywhere, and only when you get close to them do they attack otherwise they just play some idle walking animations.

What’s the best way to go about this? Should I have a script constantly running on my player that checks distance between x zombie/npc and if they come within range turn on pathfinding for the NPC? And turn off if out of range?

What’s the best solution to this? Thanks.

1 Like

Anyone have any input on this?

Instead of looping through all of the different zombies, setup different regions / zones that you can use to detect where the player is at and only loop through zombies in that zone instead of iterating through all of them.

1 Like