Overview
This project is a simulation of a herd of horses. I used a simple "flocking algorithm" to generate the movement of the horses. There is a "lead mare" that all the herd follows. Her behavior can be changed using keyboard toggles. In the grazing mode the horses stay grouped together with little movement. In the travel mode the horses move at a medium speed. In the running/danger mode the horses are travelling much more rapidly. The speeds are set to a value that worked well on my home machine, but is much too quick on the lab machines - I did not have time to fix this for the lab machines. The horses almost face the direction they are travelling, but due to an unknown bug they dont always make it all the way to that rotation.
Within the herd there is collision detection, velocity matching, boundry containment, moving to the center, and lead horse following. The lead horse maintains control of the herd by adjusting their maximum speed, as well as having a more heavily weighted value for its position and velocity.
Controls
Allows the user to look around the world.
- 'q' - quit
- 'm' - toggles the horses to move
- 'a' - strafe left
- 'd' - strafe right
- 'w' - move forward
- 's' - move backward
- 'r' - "run"/danger mode
- 't' - "traveling" middle speed mode
- 'g' - "grazing mode
- 'c' - toggles camera to/from horse view
- 'v' - shows vectors for the horses (becomes visible when moving)
Screenshots
Top view of the horses traveling in a herd
View of horses traveling in a herd with the vectors on
Horses in "grazing mode"
View from the horse camera
View from the horse camera looking back at the herd following with vectors on
Up close view of horses with vectors on
Resources
by Craig Reynolds
Information on steering behaivor in boid models, collision detection.
by Craig Reynolds on the boids and how to use them as individual models.
Detailed explanation of Reynolds' boids algorithm