Sunday 23 January 2011

Pathfinding


I've begun the task of making the zombies a little smarter by implementing a pathfinding algorithm. This will allow the little blighters to find a way to the get to the players, so long as such a path exists.

I have implemented the popular A* algorithm using the MSDN code sample for Minotaur Pathfinder. With a few tweaks, I've got a basic version up and running that works with the map data in 8bit Zombies. Pretty sweet.

As you can see from the screenshot, this enables our zombies to work out a route to the player.

There are a few things to do though yet. At the moment, the zombies can still end up getting stuck on the corners of buildings when they see the player, and get stuck on one another for some stupid reason that needs debugging. The other problem is that it's too slow. Or at least, when lots of zombies are doing route calculations simultaneously, the game stutters badly. So, some optimisations are required.

No comments:

Post a Comment