Jordan and Tom's Flocking Project - Zombie Flockalypse




Click here to load the demo
You may also view the source code here
Note that the demo does require Java. We've fought long and hard with processing.js and decided to bail after user input disappeared.

Zombie Flockalypse is a single player top down shooter, where your objective is to rescue at least 50 humans in 2 minutes.
The zombies and humans are controlled by flocking systems to determine their movement.

Player Controls:

Game logic:


The zombies and players are controlled by flocking AIs which blend weighted "force vectors" into the velocity they use on their next frame update. Zombies are forced to have a slightly slower max velocity than humans and both are slower than the player's max speed. Because we're blending a lot of vectors with weights, it's sometimes possible for a zombie to "jump the wall" and get into the safe room, effectively ruining everyone's day.
All of the available behaviors that we've coded and added should be visible in game. The grouping AI for humans has been tuned very low to prevent them from forming death packs when zombies get too close.
In blending the behaviors, we often came across instances where something would mess up hard. For instance, the humans would group up too much and cohesion/grouping vectors would negate their fleeing vectors and the poor guys looked like they were panicing before getting munched by zombies. It looks sort of cool, but they jittered around too much and it took away from the possiblity of actually winning the game. Also, if the group distance is too large, the humans would tend to sit and spin in a circle with each other until they were eaten.
The wall avoidance behavior was also tricky. It was tweaked so it was stronger the close you were to the wall. We ran into issues where zombies would run so hard during a chase that they'd manage to break the wall avoidance and "jump the wall". As both players and boids are limited to the edges of the level, this really only comes up in the safe room. Suffice it to say, the zombie needs to be chasing a human really hard to break into it. It's still possible as we're not doing collision math on walls, we're just giving a "push" vector away from a wall the closer they get.
As we're blending behaviors, the limits we set aren't exactly "hard" limits. Cohesion should keep zombies and players about 25 pixels away from each other.
Predator and prey also works on a limited level. Both are at 100 pixels. Zombies won't chase and Humans won't run when they aren't in each other's range.
Finally, humans will only follow players if the player is within 75 pixels.


Flocking AIs for Zombies: Flocking AIs for Humans: Performance:
Performance doesn't seem to be much of a problem with zombies + humans = 100 boids on any modern CPU. It slightly chops on my 5 year old home computer, but that could just be fun with 64-bit java (Tom). Above those numbers, the game can run, but it become unplayable. Zombies will win and the player can't keep up.
Tom thinks there might be something useful in gridding the level to queue up boids that are local as none of the behaviors are global. Right now, each boid update is comparing itself to every other boid for checks, making the update process n^2. Gridding might help, but maintaining a grid with 100 boids on it will probably counterbalance any gain. Right now, we just "if away" anything out of range as we check each boid against the updating boid.