Steering Behaviors, Self-Authored C++ Game Engine


Project Description

Implemented steering behaviors in personal engine including Seek/Flee, Arrive, Path Follow, Wander, and Pursue/Evade.

Project Highlights

  • Seek/Flee calculates a vector to the target and accelerates in that direction (the negative of that direction in the case of Flee).
  • Arrive, which is essentially a variant of Seek, has a radius around the target within which it throttles its velocity (proportional to the distance to the target) so that it comes to a nice smooth stop instead of overshooting like Seek does.
  • Path Follow picks targets along a path and calculates a vector to the current target along the path and accelerates in that direction. Once the agent is within a certain radius of the target point the next point along the path is set as the current target for the behavior.
  • Wander has a circle centered a certain distance out along the forward vector of the agent. The agent picks a random point along the outer edge of this circle to accelerate toward to produce a meandering behavior.
  • Pursue/Evade is similar to Seek/Flee but instead of calculating a vector to the target to accelerate to it calculates a vector to a predicted position of the target after a certain amount of time to move toward (move away from in the case of Evade). This results in a more aggressive seeking behavior than Seek itself.

Code Snippets