Skip to content

Steering and flocking

A pure-C# steering and flocking sim, rendered from raw pixels

This is a steering and flocking simulation written in plain C# on the .NET base library alone, from the GameDevelopment.Steering leaf - autonomous agents combining separation, alignment and cohesion, plus obstacle avoidance, seeking, and force/speed clamping. Each frame steps every agent and integrates its motion; the whole animation is rendered to a GIF from raw pixels with zero dependencies.

46
agents
90
GIF frames
3
flock rules
0
GPU / NuGet
An animated flock of triangular agents wheeling together across the frame, sidestepping two circular obstacles
Emergent flocking
The flock in motion

90 frames; each agent blends separation, alignment, cohesion, a gentle pull to centre, and obstacle avoidance around the two circular obstacles, then integrates under a max-force / max-speed clamp.

A single frame of the flock, each agent a small triangle pointing along its velocity and hue-coded by heading, with a short motion streak behind it
One frame
Heading colours

Each agent is drawn as a triangle pointing along its velocity, hue-coded by heading, with a short motion streak.

How the steering works

Separation steers away from crowding neighbours, alignment matches their average heading, cohesion pulls toward their centroid; obstacle avoidance projects a look-ahead and sidesteps; every steering force is truncated to a maximum and integrated with a speed cap - all analytic vector math in plain C# on the base library, fully deterministic.