Chicken Coup

University Group Project (Year 4)
Windows
Unity
C#

View project on GitHub: 

GitHub Repository

Chicken Coup is a third-person stealth game where the player plays as a chicken trying to escape a farm. The core gameplay mechanics are various ways of interacting with items to solve a puzzle and evade the farmer. The game's AI farmer wonders the level in search of the player, attempting to catch them whenever they're spotted.

 

My main responsibility was programming the AI, for which I held the sole responsibility of creating.

Utility AI

The AI uses a utility-based approach when selecting an action to perform. This means it has several motives to fulfill, with the most valued motive being addressed first. It then repeatedly executes the most optimal action that fulfills the motive, until the most valued motive changes.

Actions

The farmer features several actions: wonder; chase; catch; search for the player; stunned.

 

Naturally, the farmer wonders around the environment, occasionally visiting points of interest. Once the player has been spotted, the farmer chases the player until they're caught and contains them. In the case where the player alerts the farmer by creating a sound, the farmer will search the location of the sound and engage the player as mentioned before.

Sensors

The AI uses two types of sensors to gather data about its surrounding environment.

 

The visual sensor is a spherical trigger collider with view distance and field of view constraints to simulate a vision cone. An object's speed, distance to the sensor, and placement along the sensor's view horizon will affect its chance of being detected by the AI.

 

The second sensor is an audio sensor, it too is a spherical trigger collider. It traces individual paths to nearby sounds and checks the path distance against the farmer's hearing range to know if the sound should be heard by the farmer.

Obstacle Avoidance

The AI can sense nearby obstacles through trigger colliders. These allow it to obtain a direction towards the most open space that best aligns with its movement direction. This direction is what helps it steer itself away from obstacles such as walls and tables