
STATE MACHINE
The entire project had a modular approach with a heavy use of Scriptable Objects. Therefore, the State itself, the Condition that had to be true to enter the state, as well as the Actions that were performed while in this State were set up as Scriptable Objects.

The Fleeing State, for example, would consist of the following Actions:​
​
-
Set Movement Speed to 'Fast'
-
Set Herd Cohesion to 'Close'
-
Move away from Target 'Player'
DEER SENSES
While each deer has their individual senses, the Suspicion is shared among the herd.
To re-create the wide visual field of ca. 310 degrees, the deer has one field of view for each eye. The fields are slightly rotated to overlap and simulate binocular vision.
If the player is detected in the binocular vision field, the herd suspicion will increase twice as fast. Additionally, the suspicion increase is tied to
player proximity.




Any time a deer senses the player by either Hearing or Sight, the suspicion meter will increase. The value of the suspicion meter determines the herd’s caution states.
NEED SYSTEM
Each deer has a rudimentary need system with the stats Food, Water, and Stamina. The value of each state drains over time and once it moves below a specific threshold, the deer will enter a state that seeks to refill the stat (Hungry, Thirsty, and Tired respectively). While in the state, the deer will seek out the closest place where the stat can be refilled and enter a refill state once it arrives.

Each stat has its unique drain- and recovery rate, as well as benchmarks for what counts as a high or low value. This way, the deer in the herd can have more individualized behavior.

HERD COHESION
There are two types of distance that are being tracked: distance to the Herd Center (an object that would be attached to and move with the herd leader), and Deer-to-Deer distance. Both types of distance would have a min/max value range.

All deer are within the allowed range

Doe has exceeded the max range
The distance measuring was mainly used as an automated way to keep the herd together. As a condition in the state machine, it would trigger a ‘Return’ state that would maneuver the deer back into range once it had moved away too far from the herd.


