Skip to content

Autonomous Agents

Concepts

Autonomous Agents generally refers to an entity that makes its own choices about how to act in its environment without any influence from a leader or global plan. Three key components to keep in mind:

  1. An autonomous agent has a limited ability to perceive its environment.
  2. An autonomous agent processes the information from its environment and calculates an action.
  3. An autonomous agent has no leader.

Complex Systems

Complex System

A system of elements, operating in parallel, with short-range relationships that as a whole exhibit emergent behavior.

Three key principles of complex systems:

  1. Simple units with short-range relationships
  2. Simple units operate in parallel
  3. System as a whole exhibits emergent phenomena

Some other features of complex systems:

  1. Non-linearity. Often called the "butterfly" effect. A small change to the initial conditions can cause a large change in the result.
  2. Competition and cooperation. In a flocking system, these are alignment, cohesion, and separation.
  3. Feedback. The output of the system is fed back to the system as input for future simulations.

Vehicles

Reynolds' steering behavior has three layers:

  1. Action Selection
  2. Steering
  3. Locomotion (left foot, right foot, left foot, right foot)

Common steering behaviors:

\hat{V_{steering}} = \lVert \vec{V_{desired}} - \vec{V_{current}} \rVert

\vec{F_{steering}} = \hat{V_{steering}} * forceMagnitude

  • Seek
  • Flee
  • Pursuit
  • Follow a path
  • Follow a flow field
  • Flock with neighbors

Arriving Behavior

Instead of having desired velocity always be the maximum velocity, make it smaller as the vehicle approaches the target.

Wandering

\vec{V_{desired}} = \lVert \vec{P_{target}} - \vec{P_{vehicle}} \rVert * maxSpeed

Wandering can be implemented by finding a target wander location, drawing a circle, and moving to a point on that circle.

Flow Fields

\hat{V_{dir}} = flowField.lookup(position.x, position.y)

\vec{V_{desired}} = \hat{V_{dir}} * maxSpeed

Path Following

(\vec{P_{path}}, \hat{dir}) = path.closestPointFor(P_{vehicle})

\vec{P_{target}} = \vec{P_{path}} + \hat{dir} * lookAheadConstant

Note: the path following algorithm as introduced in the book doesn't have a "direction". Both directions are valid for the vehicle to take.

  • This is starting to show some interesting emergent behavior when avoidance is turned on. Most vehicles tend to go in the clockwise direction (since I told them to start by going up), however, there are always some outliers. These outliers often switch back to clockwise when they wade through a crowd, due to avoidance forces.

Flocking

Reynolds uses the term "boid" (a made-up word that refers to a bird-like object) to describe the elements of a flocking system. There are 3 rules of flocking:

  1. Separation (or "avoidance"): steer to avoid colliding with neighbors.
  2. Alignment (or "copy"): steer in the same direction as neighbors.
  3. Cohesion (or "center"): steer towards the average position of local flockmates.

Some observations on flocking:

  1. Alignment makes each boid in the group steer more slowly towards the target.
  2. Cohesion generates sub-groups.

  3. TODO: Add formula for each flocking behavior?

References