Guide

Game steering behaviors explained

Your enemy reaches the end of an A* path and snaps to face the player like a cardboard cutout on a rail. The flock of birds moves in perfect lockstep. A companion NPC walks through a crate because the navmesh said the route was clear. These are steering failures — not pathfinding failures. Steering behaviors are the local movement layer that sits underneath global navigation: small, reusable forces that push an agent toward goals, away from threats, and around obstacles in real time. Craig Reynolds formalized the family in the 1980s; three decades later they remain the default way to make crowds, wildlife, and chase AI feel organic. This guide covers the core behaviors, how to blend them, where they pair with navmesh pathfinding, and the production pitfalls that turn smooth motion into jittery chaos.

What steering behaviors are

A steering behavior takes the agent's current position, velocity, and orientation plus environmental context, and returns a desired steering force — a vector you integrate into acceleration each frame. Unlike discrete path nodes, steering is continuous: the output changes every tick as targets move, neighbors shift, and obstacles appear.

The classic pipeline (Reynolds, 1999) is:

  1. Perceive — gather target position, nearby agents, obstacle rays.
  2. Calculate — compute desired velocity from the behavior (e.g., toward target).
  3. Steer — subtract current velocity to get steering force.
  4. Truncate — clamp force to max acceleration so turns feel physical.
  5. Integrate — apply to velocity, then position; optionally rotate facing toward velocity.

Steering answers how to move locally. Global planners like A* answer where to go across the level. Production AI almost always uses both: pathfinding picks waypoints; steering walks between them and handles reactive dodging.

Core locomotion behaviors

These single-target behaviors form the vocabulary every game AI programmer should know.

Seek

Seek accelerates directly toward a target point at maximum speed. Simple and fast, but agents overshoot and oscillate near the goal because there is no braking phase. Use seek for distant targets where arrival behavior is not yet relevant, or as one weighted input among several.

Flee

Flee is seek inverted: accelerate away from a threat at max speed. Effective for panic states in FSM-driven enemies. Combine with a flee radius so the agent stops running once safe — otherwise it races to the map edge.

Arrive

Arrive fixes seek's overshoot. Inside a slowing radius around the target, desired speed scales down linearly or quadratically with distance. Outside the radius, run at full cruise speed. Arrive is what makes an NPC stop naturally on a quest marker instead of ping-ponging across it. Tune the slowing radius relative to max speed — too small feels robotic; too large makes characters crawl for the last twenty meters.

Wander

Wander adds semi-random displacement to a forward vector — typically by jittering a circle offset ahead of the agent. The result is organic idle patrol without hand-authored paths. Increase jitter for nervous critters; decrease for calm background NPCs. Wander alone does not avoid walls; pair it with obstacle avoidance or confine it to navmesh corridors.

Pursuit and evade

Pursuit predicts where a moving target will be based on its velocity and steers toward that intercept point. Essential for dogfight AI and missile homing. Evade predicts and flees the intercept. Prediction horizon is a tunable feel knob: short horizons react late; long horizons anticipate cuts and strafes.

Reynolds flocking: separation, alignment, cohesion

Three behaviors together produce believable group motion — schools of fish, mobs of zombies, traffic flow:

  • Separation — steer away from neighbors within a personal space radius. Prevents stacking and clipping.
  • Alignment — match the average heading of nearby neighbors. Creates shared direction.
  • Cohesion — steer toward the centroid of the local group. Keeps the flock together.

Each behavior scans neighbors within a perception radius (often spatially hashed for performance — see collision broad-phase patterns). Weights control character: high separation yields dispersed swarms; high cohesion yields tight blobs. Classic boid demos use roughly 1.5 : 1.0 : 1.0 (separation : alignment : cohesion), but your game will need its own tuning pass.

Flocking is O(n²) if every agent checks every other agent. For more than a few dozen boids, partition space with a uniform grid or quadtree and query only nearby cells. Update flocking at 10–20 Hz with interpolation between ticks if CPU is tight — crowds rarely need per-frame neighbor scans.

Obstacle avoidance

Navmeshes encode static walkability but not dynamic props, other agents, or thin obstacles between waypoints. Obstacle avoidance casts feelers — rays or swept circles — in the velocity direction and maybe ±30°. If a feeler hits geometry, compute a lateral steering force proportional to proximity. Multiple feelers let agents pick left vs right gaps.

Common failure: avoidance force fights the path-following force, causing vibration along walls. Fix with a priority or weight ramp — when a feeler hits, temporarily boost avoidance weight and damp path following until clearance returns. Another fix: widen navmesh agent radius at bake time so global paths leave margin; use local avoidance only for surprises.

For fast projectiles and vehicles, use velocity obstacles (VO) or reciprocal velocity obstacles (RVO) — more expensive but handles head-on encounters between many movers. Browser games with <30 agents rarely need full RVO; 3–5 feelers plus separation usually suffice.

Blending behaviors with weights

Real agents run multiple behaviors each frame. A guard might combine:

  • Path following (high weight) — steer toward next navmesh waypoint.
  • Separation (medium) — don't stack with allies.
  • Obstacle avoidance (spike on hit) — dodge a rolling barrel.
  • Alignment (low) — loosely match squad heading.

Two blending strategies dominate:

  • Weighted truncated sum — multiply each behavior's force by a weight, add, clamp total magnitude. Simple; can cancel opposing forces oddly.
  • Priority / arbitrate — run behaviors in order; higher-priority forces saturate acceleration budget first. Better for "avoidance overrides wander."

Utility AI can pick which behavior sets are active (patrol vs combat vs flee) while steering handles execution. Behavior trees often expose a "MoveTo" leaf that delegates to a steering controller — the BT decides when to move; steering decides how.

Pairing steering with pathfinding

The standard two-layer stack:

  1. Global planner — A* or navmesh string-pulling produces a polyline of waypoints from start to goal.
  2. Waypoint advance — when within arrive radius of waypoint n, target waypoint n+1.
  3. Local steering — arrive behavior toward current waypoint plus separation and obstacle avoidance.
  4. Replan trigger — if stuck (velocity near zero for >T seconds) or goal moved, request a new path.

Path following itself is a steering behavior: desired velocity points along the path segment, sometimes with lookahead — steer toward a point further down the polyline so turns are smooth rather than corner-cutting. String pulling on navmesh corridors reduces zigzag compared to raw grid centroids.

For open-world games, use hierarchical steering: coarse path on a low-res graph, fine steering on a local navmesh tile loaded around the player. Replan asynchronously so path spikes do not hitch the main thread.

Physics integration and feel

Steering forces integrate cleanly with both kinematic and dynamic bodies:

  • Kinematic — steering directly sets velocity each frame; fast, arcade-friendly, no collision response surprises. Common in RTS and twin-stick hordes.
  • Dynamic — apply steering as force/torque; physics engine resolves collisions. Better for vehicles; harder to tune precise arrival.

Rotation deserves separate treatment. Face velocity — instant snap — looks cheap on humanoids. Angular arrive — rotate toward movement direction with max turn rate — sells weight. For strafing shooters, decouple facing (aim at player) from velocity (strafe vector) so steering handles translation only.

Add subtle noise or lag to steering output for "alive" background characters. A low-pass filter on desired velocity removes twitch without killing reactivity — one of the cheapest juice wins in crowd scenes.

Multiplayer and determinism

In authoritative-server multiplayer, steering runs on the server for NPCs; clients interpolate replicated positions. Do not run independent local steering on client and server — divergence accumulates. For player characters, client-side prediction may apply steering locally with server correction.

Fixed timestep matters: integrate steering at the same rate as physics (often 50–60 Hz) even if AI perception runs slower. Use the same RNG seed for wander jitter if replay or lockstep matters.

Performance budget

  • Spatial partitions — grid hash for neighbor queries; rebuild or incrementally update each frame.
  • LOD for AI — distant crowds use cohesion-only or baked spline paths; full steering within 30 m of camera.
  • Staggered updates — process 1/N agents per frame for flocking; interpolate positions between.
  • Ray budget — cap obstacle feelers per agent; share ray results in tight quarters.
  • Profile — steering should be sub-millisecond per agent on target hardware; if not, cut perception radius first.

Common mistakes

  • Steering without global plan — pure seek across the map walks into rivers and through walls.
  • Equal weights — separation and cohesion at 1.0 fight forever; agents orbit without progressing.
  • No arrive radius — characters vibrate on quest markers.
  • Per-frame pathfinding — replanning every tick instead of steering between waypoints burns CPU.
  • Ignoring max turn rate — tanks spin instantly; breaks immersion and breaks physics.
  • O(n²) neighbor loops — fine for ten agents, melts at five hundred.

Production checklist

  • Define max speed, max acceleration, and max turn rate per agent archetype.
  • Implement seek, flee, arrive, and obstacle avoidance before flocking.
  • Wire pathfinding waypoints to arrive behavior with tuned slowing radius.
  • Spatial-hash neighbor queries for separation/alignment/cohesion.
  • Blend with explicit weights; document combat vs patrol profiles.
  • Add stuck detection and async replan after timeout.
  • Debug-draw feelers, velocity vectors, and force contributions in dev builds.
  • Stress-test 200+ agents; stagger flocking updates if needed.
  • Verify multiplayer: server-only steering for NPCs, client interpolation only.
  • Playtest corners, doorways, and dynamic obstacle spawns — classic failure zones.

Key takeaways

  • Steering behaviors handle local, continuous movement; pathfinding handles global routes.
  • Arrive and obstacle avoidance prevent the two most visible AI motion bugs: overshoot and wall clipping.
  • Separation, alignment, cohesion produce crowd flow — but require spatial partitioning at scale.
  • Blend behaviors with weights or priorities; utility AI and BTs decide which sets are active.
  • Tune max turn rate and slowing radius for feel as much as correctness.
  • Profile neighbor queries and raycasts — steering is cheap until it is not.

Related reading