Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
August 5, 2021
arrowPress Releases
If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Introduction to Steering Behaviours

by Juan Belon Perez on 07/24/14 05:30:00 pm   Featured Blogs

3 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.



AI's just wanna be AI's?

In a land full of chars walking placidly, hunting you or just guarding a door while patrolling, there is this question in the air: "What is this entity thinking ?".

"What is this entity thinking?"

I was always fascinated with this kind of question, and I loved how some AAA games AI's were able to avoid obstacles, find and reach your position while dodging bullets without any trouble. So I began to learn everything about complex AI's: movement, behaviours, training, etc. My AI's must want to be more than a simple zombie bumping into or hitting walls!

- That is what I thought -

Wait, what is an Artificial Intelligence Behaviour based on Steerings?


It is the way an entity decides how to move in the space, how to interact with you and other game elements. In short; how to live in your world! The first conceptual picture of this that appears in my mind is the Non Player Characters from the Sims. They sure have a really complex behaviour tree. If you want to know more about this, check "Behavior trees for AI: How they work".

Sometimes a char AI can't be plugged and start working, you need to train it, and you have software like ORTS to do such things, this is used to create a balance between player skill and the game entities, for example for strategy or tower defense games. You also can use genetic programming to evolve AI's to what you really want like this genetics cars based in Box2DCar.

Why Steering Behaviours?

All this stuff is great, but for my animal-herding game I needed something different. The first prototype I made last year only used a simple approximation behaviour: each lamb has a target node, they follow it using a simple force vector while they are waiting for the dog to scare them, and once scared they just change the target. As you can see in the video, they are not seeing each other, they dont act like a flock as I wanted. The research was just about to begin with this when the world opened in front of me and suddenly I found the exact thing I needed.

"Autonomous characters are a type of autonomous agent intended for use in computer animation and interactive media such as games and virtual reality. These agents represent a character in a story or game and have some ability to improvise their actions. This stands in contrast both to a character in an animated film, whose actions are scripted in advance, and to an "avatar" in a game or virtual reality, whose actions are directed in real time by a human player or participant. In games, autonomous characters are sometimes called non-player characters.

An autonomous character must combine aspects of an autonomous robot with some skills of a human actor in improvisational theater. These characters are usually not real robots, and are certainly not human actors, but share some properties of each."

Steering Behaviours by Craig W. Reynolds, this is the real thing,and it can manage flocks! (well, it can manage whatever you want, even just a simple entity with different behaviours)

You can use Steering Behaviours for:

Steering behaviours can be very cheap for cpu usage, so you can integrate it without worries in mobile games.
I implemented my first version of Steering Behaviours for moving enemies

In the game The Legend Of Kuzu, this was only a flocking with avoiding collisions and simple seeking.

A Basic Example

This is a steering behaviour from a global vision/view

Based on OpenSteer framework.

Each behaviour is represented as a force vector. Giving more importance to one or another by making the vector scale bigger, makes the entity move in the direction of this force-behaviour. For example, set the player as a seeker so you can have the entity char follow a position and then add an entity that is a sheep that will evade wolves entities. Now set an evade force for the sheep and a pursue force for the wolves, you may want to add a wander force to make the sheep follow a location, then you will have a diagram like this:

you can download this sample from the ShiVa wiki page: ShiVa Steering.
Why did I choose ShiVa engine? - you can code in Lua and export the game in C++, it is so efficient that I can run complex behaviours with more than 15 entities in an low-spec device with a good framerate.

This is the example running:

How it works?

Well, in this example, we are updating the target location for the player entity, which is a seeker, with each mouse event. Therefore, the most important force for this entity is the seek function. We use the physics engine and a sphere collider as the dynamics base.

The fleeing entities watch for a place away from pursuers using rays. So the function evade is the most important (greater vector scale magnitude) for these (also they are not using seek but wander). The pursuers, are trying to reach the targets entities.

A more elaborated example with chars, animations, sfx and some art:


First you get the translation of the entity, then compute vectors and directions to get the next force vector. Check if distance is greater than radius, normalize and scale the vectors and set the new velocity in the scale limit for each entity.

Once you sum all the forces and set the new speed, the character will follow the according behaviour of movement.

If you want to know more check :

Have fun with steering behaviours.

Special thanks to Eric Barth for his help with translation and edition.

Related Jobs

Sucker Punch Productions
Sucker Punch Productions — Bellevue, Washington, United States

AI Systems Designer
Xbox Graphics
Xbox Graphics — Redmond, Washington, United States

Senior Software Engineer: GPU Compilers
Xbox Graphics
Xbox Graphics — Redmond, Washington, United States

Senior Software Engineer: Performance Tooling
Mountaintop Studios
Mountaintop Studios — San Francisco, California, United States

Data Engineer

Loading Comments

loader image