Steering behaviors are small rules that turn a goal (“go there”, “run away”, “stay with the group”) into smooth, believable movement. Instead of snapping a character straight to a target, each rule pushes it a little every frame, so it curves, slows down, dodges and swarms like something alive. The idea comes from Craig Reynolds, and a new open-source library called Steerkit packs it into a few kilobytes of JavaScript for browser games.
If you play casual games, you have seen steering everywhere: a school of fish that splits around a shark, a pet that trots after you and stops at your feet, zombies that crowd a door without stacking on one pixel. If you make web games, this guide shows how those moves are built and how to try them in an afternoon.
Quick facts
| What | Steering behaviors: rules that move “autonomous characters” naturally |
| Origin | Craig Reynolds — Flocks, Herds, and Schools (SIGGRAPH 1987) and Steering Behaviors For Autonomous Characters (GDC 1999) |
| Library in the news | Steerkit, by Thibaut Lefrançois |
| Version | 0.4.0 on npm (October 2026) |
| Size | About 4.1 kB for everything (minified + brotli); seek alone is 170 B |
| Works with | Plain JavaScript/TypeScript objects, Three.js, or your own engine’s vectors |
| Price / licence | Free, MIT licence |
| Try it | Interactive demos for every behavior |

What are steering behaviors?
Reynolds splits a moving character into three layers:
- Action selection — where to go. This is your game logic: “chase the player”, “return to the nest”.
- Steering — how to get there: speed up, turn, brake, avoid that rock.
- Locomotion — how it looks: the walk cycle, the flapping wings, the wobble of a slime.
Steering behaviors live in the middle layer. The character is treated as a simple point with a position, a velocity, a top speed (maxSpeed) and a limit on how hard it can turn or accelerate (maxForce). A low maxForce turns like a ship; a high one turns like a fly.
The core trick fits in one sentence: the steering force is the velocity the character wants, minus the velocity it already has. Every frame you compute that difference, cap it, and add it to the velocity. Because the change is gradual, the path curves instead of jumping.
The basic behaviors, one by one
Seek and flee
Seek points the “wanted velocity” straight at a target at full speed. Flee points it the other way. Seek alone has a famous flaw: the character overshoots the target and circles back, because nothing tells it to slow down.
Arrive
Arrive fixes that. Inside a slowingDistance around the target, the wanted speed drops in proportion to the distance left, so the character glides to a stop exactly on the spot. It is the behavior behind a companion that stops beside you instead of orbiting you.

Wander
Wander is a random walk that looks natural. The character seeks a point on a circle in front of it, and that point drifts a little each frame, so the heading changes in smooth curves rather than nervous jitters. Great for idle animals, ambient fireflies or a slime patrolling a room.
Pursue and evade
Pursue seeks where a moving target will be, not where it is now — the difference between a dumb chaser and a smart one. Evade does the same in reverse.
Flocking: three rules that make a swarm
Reynolds’ 1987 “boids” model creates flocks, herds and schools from three local rules, each looking only at nearby neighbors:
- Separation — don’t crowd your neighbors.
- Alignment — head the same way as your neighbors.
- Cohesion — move toward the middle of your neighbors.
Add the three forces together and a group of dots suddenly behaves like birds or fish, with no leader and no script.

The hard part is speed: if every boid checks every other boid, the work grows with the square of the crowd. Steerkit’s documentation reports that for 1,000 boids (Node 26 on an M1 Pro) a frame took about 12 ms when each one scanned the whole crowd, but about 0.7 ms with its built-in spatial grid, which only looks at nearby cells.
Moving through a world
Real levels have walls, rocks and roads. Steering has answers for those too:
| Behavior | What it does | Typical game use |
|---|---|---|
| Obstacle avoidance | Looks ahead in a corridor and turns to clear the nearest obstacle | Enemies weaving through pillars |
| Collision avoidance | Predicts when two movers would meet and steps aside | Crowds of shoppers, traffic |
Containment (stayWithin) |
Turns back before hitting the walls of a box | Fish in a tank, units in an arena |
| Path following | Stays within a band around a route | Racing AI, tower-defense creeps |
| Flow field | Goes the way a grid of directions points | Wind, river currents, huge crowds |
| Leader following / offset pursuit | Keeps a spot behind or beside a leader | Squads, V-formations, pets |


One reminder from the library’s own notes: avoidance is a short-range reflex, not a full pathfinding system. For mazes and long routes you still need something like A* to choose waypoints, then steering to move between them smoothly.
Steerkit: steering behaviors in 4 kB of JavaScript
Steerkit is a new open-source library by developer Thibaut Lefrançois that implements Reynolds’ model as small, typed functions. What makes it friendly for web games:
- Engine-agnostic. Any object with
x,y,zcounts as a vector — plain objects,THREE.Vector3, or your engine’s own type. For 2D canvas games you keepzat 0 and passplane: "xy". - No garbage per frame. Every behavior writes into a vector you pass in, so hundreds of agents don’t feed the garbage collector.
- Tiny and tree-shakable. About 4.1 kB for everything; import only
seekand it is 170 bytes. - Optional Three.js adapter (
steerkit/three, about 2.6 kB extra, Three.js 0.152 or later) that turns models to face their direction, draws a whole crowd in one instanced draw call and shows the forces as debug arrows. - Interactive demos for every behavior, with the forces drawn and sliders for each parameter — plus a “Copy prompt” button and an
llms.txtfile for people who code with an AI assistant.
Getting started takes one command, npm install steerkit (it ships as an ES module with TypeScript types). Each frame you compute a few behaviors for an agent, combine them and call step(agent, force, dt) once.
Combining forces: blend or prioritize
Real characters want several things at once. Steerkit offers two ways to mix them:
blendadds forces by weight. Simple, but two opposite forces can cancel out, leaving a character stuck between its target and a threat.prioritizespends a force budget in order: the most urgent behavior (say, avoiding a wall) takes what it needs first, and the rest share what is left.
For big crowds the README recommends the allocation-free zero and add forms: it measured blend leaving about 190 KiB of garbage per frame with 1,000 agents, versus about 1 KiB with zero/add.

How it compares
The README itself points to Yuka, a complete game-AI framework with state machines, navigation, perception and 14 steering behaviors. If you want that whole toolbox, Yuka is the bigger option; Steerkit does only steering, on the objects you already have.
Tips before you add steering to your game
- Start with one agent and one behavior. Make it overshoot, then make it too slow — the extremes teach you what each number does.
- Draw the forces. Debug arrows for velocity, wanted velocity and steering force reveal most “why did it turn there?” bugs.
- Clamp the frame time. After a player switches tabs, one frame can last seconds; Steerkit suggests
Math.min(dt, 1 / 20)so characters don’t teleport. - Put avoidance first. Give walls and obstacles priority or weight, or a target behind a rock will cancel the dodge.
- Use a spatial grid past a few dozen agents for flocking and crowd avoidance.
- Smooth speed changes. When a speed boost ends, Steerkit’s
overspeedDampinglets the extra speed fade over time instead of stopping dead in one frame. - Keep decisions outside steering. Choosing which door the guard runs to is game logic; steering only makes the run look good.

The Aquarium demo shows everything working together: a school of fish flocking on a spatial grid, avoiding rocks, staying inside the glass, and scattering when the shark hunts — then regrouping.
Further reading
- Craig Reynolds, Steering Behaviors For Autonomous Characters (GDC 1999)
- Craig Reynolds, Boids: Flocks, Herds, and Schools (SIGGRAPH 1987)
- Daniel Shiffman, The Nature of Code — Autonomous Agents
- Steerkit on GitHub and its live demos
FAQ
What are steering behaviors in games?
They are simple movement rules — seek, flee, arrive, wander, flocking and more — that turn a goal into a small force each frame, so characters move smoothly and look alive instead of snapping between points.
Who invented steering behaviors?
Craig Reynolds. He described flocking “boids” at SIGGRAPH 1987 and the wider set of steering behaviors in his GDC 1999 paper Steering Behaviors For Autonomous Characters.
What is the difference between seek and arrive?
Seek always heads for the target at full speed, so it overshoots and circles. Arrive slows down within a set distance and stops right on the target.
Is Steerkit free, and does it need Three.js?
Yes, it is free under the MIT licence. Three.js is optional: the core works with any objects that have x, y, z, including 2D canvas games.
Are steering behaviors the same as pathfinding?
No. Pathfinding (like A*) decides the route through a level; steering decides how a character moves along it, turning, slowing and avoiding nearby obstacles. Most games use both.




