All content © 2022 DigiPen (USA) Corporation, all rights reserved.

Solo Project (CS199) - Nature Simulation

Technical Design
1/21-4/21
Behavior Tree Design/Implementation - Unity

The biggest challenge to this project was my inexperience. I had never worked on AI before, especially behavior trees. I researched into how they functioned and were typically constructed before working on my implementation.

My project initially started out much larger than it ended up being, with more complex behaviors prospected. I quickly cut content to scope down and ensure that my finished product was manageable and within my own realm of realistic output.

The cow AI did have one point of complex implementation, however, which was the matriarch. To emulate a true herd of cattle, I implemented a matriarch that served as a master AI that would direct the others to migrate if there was no more grass present near the herd. This emphasized the flexibility of behavior trees, as it would require the AI to pause what they were doing and immediately change behaviors to another set of behaviors. This is also exemplified in the way they flee from the wolves. Cows can flee at any time, with the only limiting factor being the efficiency of the engine's update.

I learned a lot about behavior trees throughout this project, especially how they interact with each other. This flexibility and base-level implementation here became the implementation that I used with the AI in one of my other projects, Bounty.

Code samples below.

Additional Documents - Code Samples
Cow AI
Cow Interface
Move Task
Find Random Location Task
Find Grass Task
Migrate Task
Eat Grass Task
Lay Down Task