For my project I designed a farm scene with cows, pigs, a barn, a silo, fences, trees, and hay bales. The pigs and cows interact with "herding" characteristics, following Craig Reynolds boids rules of separation, alignment, and cohesion.
Mouse - Look around.
'w' - Move up.
'a' - Move left.
's' - Move down.
'd' - Move right.
Space Bar - Pause.
The user is allowed to move around the scene using the WASD keys and the mouse to rotate the viewing position. The user may fly around to get a better view of the pigs and the cows and the rest of the farm!
Separation: The seperation is so all the cows or pigs don't end up in the same spot. For each pig/cow, I loop through each additional pig/cow and calculate the distance. For any pig/cow that is a "neighbor", or within a certain distance, I calculate the average vector away from that neighbor. Each vector is divided by the distance, so the closer pigs/cows will move further away. This average is added to the acceleration for that movement.
Alignment: Alighment makes the herd tend to the average heading of the herd. This makes sure the herd is, in general, facing in the same direciton. The alignment is calculated by getting the average velocity of all neighboring pigs/cows. This is then added to each pig/cows acceleration.
Cohesion: Cohesion is necessary so the pigs/cows follow herd like behavior. The average position of neighboring pigs/cows is calculated and the difference between the average and the pigs/cows position is calculated and added to the acceleration.
In order to avoid the walls, the pig/cow is checked if it is headed in the direction of the wall it is near (using the dot product). If it is, then the velocity is adjusted so the pig/cow moves away from that wall to avoid a collision.
My program involves a lot of texture mapping, including spheres, cylinders, cones, cubes of various sizes, and shapes like the house. I spent a lot of time perfecting the barn and creating the texture for the barn. I designed the texture coordinates so even on the front part of the barn there is no stretching or bluriness. The fences textures are designed so they aren't the actual texture, but a blurred image of it (I did it this way because it is more realistic of a fence).
In the future, I hope to add better collision detection within the herd, and make the movements more realistic.