Thursday, May 29, 2014

Zombie Apocalypse

For my group, our main project was a zombie apocalypse simulation. We built it throughout the entire quarter. This was the one I liked the most of our two projects (the other one was a survey, but I was more involved in creating this one). I liked it better than doing the survey because it was a lot more fun. Even though we really didn't know what we were doing at first, it began to make sense and we eventually only needed Mr. Pethan when there were glitches or bugs that we could not figure out, or just to make cool and complicated stuff. These are a few pictures of our final project.

The first picture is of the simulation as it appears when you are running it. The green dots are zombies, yellow dots are humans, and the yellow twinkies are food. Most of what we spent our time on was trying to get all these dots to interact with each other. Eventually, we made it so that humans would move randomly, unless there was food nearby, in which case they would move towards the food. They would always move towards food unless there was a zombie within their view, in which case they would move in the opposite direction of the zombie. Zombies just try to chase and eat humans.

This next picture is of the code. This is one small section, and it is the part where we programmed the human dots to evade the zombie dots. We did this by making the humans run through code that would analyze where zombies were around them. after that, they would pick which way was best to move based on where the zombies were, which is in the opposite direction.

This last picture is of another peice of code. This one is where we programmed what would happen if a human and a zombie landed on the same square, and how long zombies and humans would live without eating. To do this, we made it so that if a zombie and a human landed on the same square, the human would have a chance of turning into a zombie. To make them die off, we had to use the timestep and reset it everytime a human landed on a square with food. Zombies we just gave a certain time until they died off.

Most of the things in the game can all be changed very easily because we put buttons directly into the simulation when it was run, so you don't have to go back and forth between chrome and the code. You can just easily change many things like number of humans and zombies and how many food sources there are.

No comments:

Post a Comment