Yesterday evening, as I was wiling away some hours at the computer, a thought struck me. I realized that my knowledge of NetLogo has finally reached the point at which I could build something I’ve wanted to build for a long time: a simulation of a zombie outbreak. Ever since I saw the cool simulator on this page, I’ve wanted to build my own version in NetLogo, but I’ve never been competent enough to program it. Now that I’ve got some experience under my belt, I was finally able to pull it off.
Here are the basics:
- Humans show up as blue dots. They walk at a leisurely pace, and flock together with other humans.
- Panicked humans result whenever a human sees a zombie or another panicked human. Panicked humans run faster than normal ones, change directions more often, and don’t flock. If there’s nothing threatening about, and the general panic level has died down, they turn back into normal humans.
- Zombies are green. They lack any sort of intelligence and wander around randomly. If a human gets too close to them, they may attack, resulting in infection.
- Fighting humans are humanity’s only hope to resist the zombie hordes. They show up as yellow. Fighters flock together with other fighters, and also seek out any zombies nearby. They also have a rallying effect. That is, they have a tendency to make panicking humans calm and urge calm humans to fight. Sometimes, fighters break under the strain and panic, or, if there are no immediate threats, they go back to normal.
These rules are fairly simple, but I’ve been working with StarLogo and NetLogo for long enough now to know that emergence can perform feats of magic with simple rules. And I did indeed get some fascinating behavior.
As I toyed around with the simulator, I discovered the importance of scaling. With a small map and a large population, the behavior seemed to resemble that one might find in an urban setting, and as the map size increased, the behavior seemed to be more like that of a county or a small country, with the groups of humans representing cities, or something to that effect.
The first run I did for this post was an urban one with an initial human population of 300 (THIS IS SPARTAAA!!! Sorry…couldn’t help myself.)
The humans have organized into “flocks”. For some reason, there seems to be a bias that causes them to favor moving down the map, rather than in some other direction. I’m still trying to fix that particular bug.
Now the fun part begins. I cause one human to suddenly become a zombie, and the infection starts. All the people nearby start to panic, except for a small group of renegades who become fighters and start hunting down the zombies.
As the epidemic begins to grow out of control, panic spreads throughout the “city”. Groups of fighters attempt to rally the panicking citizenry, but their efforts are for naught, as the growing zombie horde continues to inspire panic.
Groups of fighters still try valiantly to keep the infection under control, but it’s already too far gone. By this point, social organization is beginning to decay.
As the situation continues to spiral out of control, social order breaks down, and humans stop forming flocks. Groups of fighters are overwhelmed on every front.
It is the end of days (well, at least the end of the “city”). There are few humans left, and those survivors are panicked and running for their lives. Note the single fighter still trying to kill zombies. Unfortunately, this is not an actual zombie movie, and so there’s pretty much no chance that a ruggedly good-looking male protagonist is going to rally a ragtag group of comic-relief-spouting survivors and save the day.
This program is incredibly fun to play with, and I’ll put it up for download as soon as I get around to it. In the meantime, I’ll do a larger run, one that represents more of a “nationwide” zombie epidemic. But since, for some reason, this simulation is pretty CPU-intensive, it’s going to take me a while to get around to running that one.
Many thanks to Kevan Davis for the inspiration for this simulation!
And, once again, many thanks to the makers of NetLogo. I know it sounds like I’m on their payroll or something, but NetLogo really does make programming multi-agent simulations pathetically simple.
January 21, 2008 @ 4:23 pm at 4:23 pm
that is so cool, I saw the other zombie simulation and was fascinated with it for a while, but i became quickly bored with the lack of the formation of any kind of society. I’ve been praying that somebody would create something like this and it seems that day has come. Can’t wait to see the finished product, good luck with your work!
January 21, 2008 @ 8:36 pm at 8:36 pm
Thanks very much! I haven’t really been working on the simulator for the last week or so, but I’m hoping to get around to finishing the revisions and debugging sometime in the near future. Be sure to check back, because eventually I hope to make this available for download or Internet use, as I did with my heart simulation.
January 23, 2008 @ 2:42 pm at 2:42 pm
hey, nice work. the thing that fascinated me the most in the original zombie game was the effect of the grouping of the zombies, kinda like a hive, I am legend style. do the survivors actually clump together or is that just by chance on that test? and the thing that pissed me off with the original one was that it was too small and it wasn’t an application that I could put on my computer. good luck!
January 23, 2008 @ 4:05 pm at 4:05 pm
Thanks for the comment!
What I’ve observed is that, generally, the survivors clump for a while, but just before “extinction,” they tend to lose all organization and get driven madly in all directions, since, the way I programmed it, “panicked” people jiggle about randomly at high speed.
March 15, 2008 @ 1:39 pm at 1:39 pm
is it possible to get it yet. this looks really fun and i want to play it.
March 15, 2008 @ 5:40 pm at 5:40 pm
You can find it right here:
http://ccl.northwestern.edu/netlogo/models/community/Zombie_Infection_2
I think you have to have Java installed for the applet to run.
June 5, 2008 @ 1:29 pm at 1:29 pm
when is it going to be out it looks so awsome!!!!!!!!
June 5, 2008 @ 2:34 pm at 2:34 pm
It’s out now, actually. You can run it (or download it) here:
http://ccl.northwestern.edu/netlogo/models/community/Zombie_Infection_2
July 7, 2008 @ 3:59 pm at 3:59 pm
Wow, awesome.
—
When I tried it the first time with only 50 people, everyone was turned into a zombie except one normal human who remained standing in the same spot. No zombie came after it. Was that a bug?
July 8, 2008 @ 10:35 am at 10:35 am
It might have been. Being little more than a hobbyist, I didn’t do any kind of bug-hunting whatsoever, except when it came to really obvious bugs.
July 26, 2008 @ 7:40 pm at 7:40 pm
HEy I dont want to be one of those pessimists, but I love the zombie infection games, and tthis one is great, but the only thing I dont like about it, is that when people hit a wall, they come out the opposite wall, which I find takes away from the game, say if the zombies are all on one side, and the humans are on the other, they are just to easy to get to, and I find that frusterating. I am voicing my opinion, but I am probably gonna get flamed
July 26, 2008 @ 7:41 pm at 7:41 pm
I meant like the sides of the screen,not actual walls.
July 27, 2008 @ 10:25 am at 10:25 am
That’s a good point, but every time I’ve tried to incorporate walls into the simulator, they haven’t behaved properly. For some reason, the people kept getting stuck to them. That’s why I didn’t include them, and kept the boundaries wrap-around.
August 13, 2008 @ 11:11 am at 11:11 am
Wow, I tried it with 1000 people and I saw a fighter, leading I think about a dozen or more citizens, heading north west toward what I call ‘Helm’s Deep’
Wickidy cool!
August 13, 2008 @ 11:13 am at 11:13 am
Also: people exiting from the south reappear in the north. about 200 or so lead by fighters retreated to ‘helms’ and everyone is running! I like it very much! thanks for making this.
September 13, 2008 @ 5:24 pm at 5:24 pm
You should add a white “hero character” but other than that it’s good
November 26, 2008 @ 12:44 pm at 12:44 pm
its awesome.
December 2, 2008 @ 7:55 pm at 7:55 pm
I think it’s great and all, but every time a pack of humans and a couple fighters meet up with even one zombie, they all die.. Come on, they can’t defend off ONE zombie?
December 2, 2008 @ 10:24 pm at 10:24 pm
Yeah…the simulator’s always had some balance issues. In the later versions, the zombies all get killed absurdly fast. I haven’t really hit a good balance yet.
December 22, 2008 @ 11:10 pm at 11:10 pm
That sounds like a challenge for genetic algorithms… ๐
December 23, 2008 @ 9:31 am at 9:31 am
That, my friend, is an EXCELLENT idea! I think I could probably stick in some code to adjust a few key probabilities without much trouble and let the agent behavior evolve.
You may just have made my day! ๐
September 18, 2009 @ 11:22 pm at 11:22 pm
This alot of fun. But the fighters seem a bit, eh.. how do I word this… Non fighters. They are more of a leader than a fighter. But they are still pretty cool. I love it when I saw 20 panicked, 8 fighters, and 4 norms in a tiny little room. It was hilarious. But other than that realy annoying downwards migration, very impressive social dynamics. Zombies should be hard to kill, and fighters hard to kill, while panicked and norms are average.
September 29, 2009 @ 9:49 am at 9:49 am
with your downwards migration problem, did you know that like 70% of all animals have a tendancy to migrate south?
And to the one person who sometimes doesn’t get infected? He/She is the one who is immune ๐ i love a good coincidence
September 29, 2009 @ 3:10 pm at 3:10 pm
See, if I’d thought of that beforehand, I wouldn’t have had to fix anything…damn.
Yeah. That’s Richard. He cleans my gutters, so I keep him around ๐
November 8, 2009 @ 3:34 pm at 3:34 pm
[…] no. No. The rest of my science posts languish in the bottom of the bargain bin, while, by far, my Zombie Simulator-related posts are the proud runners up, having garnered 10,466 […]
November 10, 2012 @ 6:45 pm at 6:45 pm
[…] Infection 2, another model calledย “Zombie Infection Simulator”ย is available from here. The main difference is that in this case, human beings tend to flock together with other humans, […]
May 28, 2013 @ 4:39 pm at 4:39 pm
[…] Zombie Infection 2, another model called “Zombie Infection Simulator” is available from here. The main difference is that in this case, human beings tend to flock together with other humans, […]