Implementing steering behaviors

The strategies that we will cover here have been taken from Craig Reynolds's paper Steering Behaviors for Autonomous Characters, written in 1999. It has become a well-known reference for implementing autonomous motion in an easy manner for non-playable characters.

You can check out the online version at http://www.red3d.com/cwr/steer/gdc99/. In this section, you will learn how to implement the following kinds of behavior:

  • Seek and flee
  • Arrival
  • Pursuit and evade
  • Wander
  • Obstacle avoidance

Seek and flee

The seek behavior moves the character towards a specific position in the space. This behavior is based on the combination of two forces: the character's velocity and the steering force. This force is calculated as the difference ...

Get Python Game Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.