Sheep AI, Tools, 3C, Optimization
Platform: Nintendo Switch, PC
Engine & Tools: Unity, Jira, Perforce, Wwise
Duration: 8 months
Team size: 16
My work involved:
-Full sheep AI (flock system & specific sheep behavior)
-InputSystem & Wwise integration on Nintendo Switch
-Gameplay features
-Characters abilities & controls
-Rumble feedback
-UI systems & integration
-Mecanim integration
-CPU & GPU Profiling and Optimization
(Use of Unity Jobs, SkinnedMesh animations baking, draw calls reduction techniques (mesh merging & batching), subpixels & overdraw reduction, Nintendo Switch GPU knowledge, lighting knowledge, and more)
-InputSystem & Wwise integration on Nintendo Switch
-Gameplay features
-Characters abilities & controls
-Rumble feedback
-UI systems & integration
-Mecanim integration
-CPU & GPU Profiling and Optimization
(Use of Unity Jobs, SkinnedMesh animations baking, draw calls reduction techniques (mesh merging & batching), subpixels & overdraw reduction, Nintendo Switch GPU knowledge, lighting knowledge, and more)
In-Game Images





Designing engaging AI behavior
This system relies on separate “behaviors”, each with its own effects that are applied to individual sheep.
All behaviors inherit one of these two bases:
- BaseFlock, for any behavior that depends on the neighboring sheep.
- DisturbanceFlock, for any behavior that depends on the neighboring disturbances.
Disturbances are defined as any object that, while not being part of the flock, can still impact it. This could be, for example, a dog that may make the neighboring sheep try to escape, or a flower that may lure them in.
Two BaseFlock behaviors are used:
- Avoidance, which prevents sheep from getting too close to one another,
- Cohesion, which pulls sheep towards the center of mass of their current flock.
- Alignment, which helps keep the flock "tight" and going in the same direction.
...and two DisturbanceFlock behaviors:
- Escape, which makes sheep flee from the given disturbances,
- Pursue, which makes them run towards the given disturbances.
All behaviors inherit one of these two bases:
- BaseFlock, for any behavior that depends on the neighboring sheep.
- DisturbanceFlock, for any behavior that depends on the neighboring disturbances.
Disturbances are defined as any object that, while not being part of the flock, can still impact it. This could be, for example, a dog that may make the neighboring sheep try to escape, or a flower that may lure them in.
Two BaseFlock behaviors are used:
- Avoidance, which prevents sheep from getting too close to one another,
- Cohesion, which pulls sheep towards the center of mass of their current flock.
- Alignment, which helps keep the flock "tight" and going in the same direction.
...and two DisturbanceFlock behaviors:
- Escape, which makes sheep flee from the given disturbances,
- Pursue, which makes them run towards the given disturbances.


The CompositeBehavior is the only behavior that can be applied to a sheep. It allows using other behaviors as building blocks for creating a complex flock that reacts appropriately to different situations.
This is also where "behavior weights" can be fine-tuned.
These are multipliers that adapt themselves to the sheep environment: a necessity for achieving a gamified flock that reacts correctly to our possible scenarios.
These are multipliers that adapt themselves to the sheep environment: a necessity for achieving a gamified flock that reacts correctly to our possible scenarios.
In the attached example, the base weight for Cohesion is low: this will translate to sheep putting some space between each other when no disturbances are near (achieving a “grazing” effect).
When a predator is near, the weight will lerp from 0,1 to 2, based on an inner and outer radius. This will make the flock stay tight while fleeing from the dog, for example.
Lastly, weights also adapt to applied "bursts": If the dog barks, the sheep will stay near each other while running, until the burst has faded.
When a predator is near, the weight will lerp from 0,1 to 2, based on an inner and outer radius. This will make the flock stay tight while fleeing from the dog, for example.
Lastly, weights also adapt to applied "bursts": If the dog barks, the sheep will stay near each other while running, until the burst has faded.



The FlockAgent is the MonoBehaviour component that controls each sheep. It calculates the context (flock and disturbances) and applies movement based on the Composite’s computations.
It is in this script that individual behavior is implemented via subclasses.

Finally, the GlobalFlockInfo allows for tweaking any value that is not directly related to the behavior, like various radiuses, settings for avoiding navmesh edges, and ones linked to burst impacts.
The attached diagram summarizes the overall structure.


For more information: Technical Design Document
More about the game
Welcome to Sheepfold, a cooperative adventure where you and your partner navigate the Pyrénées (French mountains), herding sheep through stunning landscapes.
Forge an unbreakable bond as you play the roles of a quick-thinking Shepherd and their swift Dog, combining abilities to overcome obstacles and guide your flock. Work together, anticipate challenges, and revel in the thrill of discovery as you travel across a vibrant environment full of life and iconic landmarks.