Avoid
Leader
Flocking
Alignment
Seek
Flee
Arrival
Departure
Wander
Separation
Cohesion
This project implements autonomous agent steering behaviors for character animation, commonly used in games and crowd
simulations. It's based on Craig Reynolds' influential 1999 paper "Steering Behaviors for Autonomous Characters" — the
same foundational work behind the flocking behaviors seen in many games and films.
The system enables virtual characters to navigate environments in a lifelike, reactive way without scripted paths.
Each agent operates as a simple 2D vehicle that can accelerate, turn, and respond to its surroundings in real time. A
feedback control system smoothly adjusts each agent's speed and heading to match its behavioral goals.
The project includes 11 steering behaviors split into two categories:
Individual behaviors control single agents:
- Seek: Move directly toward a target
- Flee: Move directly away from a target
- Arrival: Approach a target and smoothly decelerate to a stop
- Departure: Push away from a position with stronger repulsion when closer
- Wander: Generate natural-looking random meandering motion
- Obstacle Avoidance: Detect and steer around obstacles in the agent's path
Group behaviors create emergent crowd dynamics:
- Separation: Prevent agents from crowding together
- Cohesion: Pull agents toward the center of their local group
- Alignment: Match velocity with nearby neighbors
- Flocking: Combine separation, cohesion, and alignment to produce classic "boids" behavior
- Leader Following: Create formations where agents follow behind a designated leader
The system uses a sense-control-act loop — a classic reactive control pattern. Each frame, agents sense their
environment (target position, nearby obstacles, neighboring agents), compute a desired velocity based on their active
behavior, then apply forces to move toward that goal. This creates smooth, responsive motion that adapts to changing
conditions.
Built in C++ with OpenGL visualization. The standalone viewer allows real-time behavior testing with adjustable
parameters and debug visualization showing current vs. desired velocities.
Tools Used
C++, OpenGL, CMake, Eigen (linear algebra), ImGui