AI update…
Posted in AI, Characters, Zombox on December 27th, 2013 by Tyson IbeleSo now that the old navgrid pathfinding system has been replaced by the new navmesh system, I’ve gone in and re-written all of the AI code for npcs and zombies.
The old code was messy and relied on too many navgrid functions to simply adapt to the new system, so I started fresh. I’ve now unified all AI-related aspects of the zombies and NPCs (rather than have separate AI code for each), and optimized things like the flocking system and Line-of-Sight checking (using kd-trees and BVH trees, respectively). This allows the game to run faster with more zombies on screen at once.
While the iOS version of the game will typically have around 50 zombies visible at a time max, I benchmarked the new code with 650 zombies at once and it still runs at +30fps. Keep in mind the old code could handle around 200-250 before getting too laggy. So it’s quite an improvement!
Here’s an animated gif showing part of a group of 500 zombies crowing around the player/environment, using the new AI system (keep in mind for illustration purposes, their attacks have been disabled):