ID:273428
 
What is the best way of handling a large amount (500+) of NPC's that wander around, looking to attack a player or an object (windows, doors, etc)?

Thanks,

Rekwan
Don't have them do anything unless there's a possibility of there being something of interest. The best way to handle this is to split things up into areas and don't call the AI routines until a player enters the area, and then stop it when the last player leaves an area.

Alternatively, if there are far fewer players/objects than NPCs, have the players/objects be the one searching for NPCs to activate.

Note that if you HAVE to have the NPCs wandering regardless of player presence, that's okay, so long as you aren't searching for things every step. The resource hog is going through the list, not taking random steps.
In response to Garthor
Thanks a bunch Garthor, I'm going to try going with the alternate route of having the players doing the scanning. This was my initial thought but having someone suggest it being a possible solution is very reassuring.

Thanks,
Rekwan