At the moment zeds don’t pathfind, just walk in straight lines and stumble around.
Is it more because performance or because they’re just supposed to be painfully dumb? Or maybe is it there to force them to rely on smell?
If just the performance, if I found a fast solution, would it get in?
For example, instead of making all zeds path to the target, do it all in reverse: path from all the targets to all the zeds. This way 300 zeds chasing 1 player would path just once (and just re-trace the paths 300 times, which wouldn’t be that much slower than pathing 300 straight lines).
Old pathfinding code was very naive - before I got to it, it not only used a vector for the open set (=linear time cost for every single iteration), but also did up to 7 times as many checks for furniture, terrain cost and vehicles as needed.
Now it uses a heap-based priority queue for open set (=logarithmic time per iteration) and doesn’t duplicate ter/furn/veh checks.
Even with many targets to find, the time of each “multi-pathfind” would be rather low. You can test current pathfinding by spawning ~20 NPCs, having them follow you and teleporting away. This reverse-pathfinding would, in most cases, be faster than 20 NPCs pathing to the other end of the map.
Having zombies pathfind to visible targets would stop them from getting clogged up in the cars and turning them into mosh-pits. For some added dumbness, zombies might disregard (fully or partially) pathing around passable-but-slow terrain (rubble, small furniture).
Some very cool behaviors can be created with simple manipulation of pathfinding. For example, swarming around when close to the target (achieved by manipulating the results around the target), avoiding light, avoiding open spaces, avoiding being seen by the player, forming a tight horde or loose pack etc.
So, are zombies supposed to be brainless or were they brainless because technical limitations?