Autonomous Agents

Aquarium Flocking

This was a series of projects for a course titled Interactive Media Development. The first assignment was to create a simulation of autonomous agents with flocking and path following behaviors. I used Unity's terrain tool and assets from Unity's asset store to build the environment. The fish in the scene implement flocking in three dimensions. They all seek the same random point in the scene, and when one of them reaches that point, they seek a newly generated point in the scene. The fish utilize separation, allignment, and cohesion to stay together as a dynamic flock without colliding with each other. They also use obstacle avoidance to avoid colliding with the rocks in the scene.

Download the build!

There is also a turtle in the scene that implements path following. It follows a looping path of preset coordinates marked by pink rocks in the scene

turtle camera

The player cycle through cameras that show an overhead of the scene, a camera that follows the average position of the flock, a camera that follows that turtle, as well as a camera that follows the front of the flock with a smooth camera script.

average camera

The player can toggle debug lines that show the average position of the flock, as well as their average direction. There are also debug lines for the turtle as well as the path the turtle follows.

top down camera full view camera

Humans vs Zombies

The second project was to create a simulation of autonomous agents with steering behaviors. The scene contains humans that use wandering behavior, and when in range of a zombie switches to evade the zombie until out of range. The zombies in the scene pursue the the closest zombie and turns that human into another zombie if it catches it. If there are no humans, the zombies will wander around the scene. All of the agents in the scene avoid obstacles, which are the trees in the scene. The project was made in Unity, and all the scripts were written in C#.

Download the build!

The player can spawn in new zombies or humans at a random position on the map by pressing 'z' or 'h'. The player can also cycle through the available camera views by pressing 'c', and toggle the debug lines with 'd'.

zombie follow camera

Both the humans and zombies implement separation, so that they don't intersect each other. I also used weights and conditionals to modify the movement speeds to balance the behaviors in the scene. In addition to writing all of the gameplay scripts, I imported assets from the Unity asset store to improve the overall look.

3/4 camera

Part of the assignment was to include debug lines, which display the forward and right vectors of each agent, as well as their future position. There is also a line pointing from each zombie to it's closest target.

top down camera