Bunny Population Simulator

By Emily Woo


This is a bunny population simulator. This application starts with 2 initial bunnies. Over timed intervals, the current population will double. The maximum number of bunnies is 32. Once the population hits 32, the bunnies will all keel over from overpopulation. To prevent overpopulation, the user can click 'k' to kill off bunnies. Killing off all the bunnies will result in a population of 0 that can no longer multiply.

The user can navigate the world using wasd keys to move, and mouse to rotate.

Key presses:

Graphics Technologies

The graphics technologies this project used and expanded on were collision detection, texturing, phong lighting, random movement animation, game state tracking, and procedural generation and random placement of objects.

The bunnies are procedurally generated, randomly placed in the scene, jump up and down, and move in random directions. For collision detection with the wall, I checked if the bunnies were within a certain distance from the center. For collision detection with other bunnies, I used bounding spheres, and when any two bunnies' bounding spheres' touched (when the distance between their centers were less than or equal to the sphere's radius) the bunnies would turn around. You can see this with the 2 gray bunnies in the next 2 pictures.

Bunnies before colliding.

Bunnies changing direction after colliding.

The bunnies are colored using the phong lighting. The grass is textured with repeated grass tiles. The sky is a sphere textured with clouds.

This application also kept track of the state of the game/population. If the user does not do population control, the bunnies continue to multiply until they overpopulate.


Lessons Learned

One lesson I learned while working on this application was that random movement is very math-based and prone to bugs for implementation. I also learned that randomizing the direction objects move in can result in objects circling each other as they try to find directions where there isn't a collision. I learned that the easiest way to avoid this was to just have the bunnies turn around at 90 or 180 degrees.

I also learned that having collision detection looks nice, but can slow down an application by a lot because it causes you to look through arrays of data containing locations of every other object.

Outside Resources

Most of this application was built off of material given from this class, or self derived (like the random movement calculations). I did look up and find a good informational source for collision detection.

Collision detection: http://nehe.gamedev.net/tutorial/collision_detection/17005/