You came back. Awesome. That means that you get to learn about:
Agent Movement/Steering
Ain't it cool? It's a nice, clean way of introducing the topic. I'll probably use it every time I introduce something new. Keep me accountable.
When I say, "Agent Movement/Steering," I am referring to the behavior that gives AI's the ability to move around. This movement can then refer to several different types or dimensions of movement that are defined by the axes involved. For example, a platformer needs to add movement in the left, right, up, and down directions, as well as account for gravity towards the bottom of the screen. This is different from, say, how a first person shooter handles movement. In an FPS, the player can move left, right, forward, backward, up, and down. Platformer agents move differently because the affected axes are different. When coding AI for a specific set of axes of movement, you need to understand these axes when deciding how to move the agent around the world.
In the Gamedevtuts+ tutorial on
Understanding Steering Behaviors, the manipulated axes are the left, right, forward, and backward axes. In other words, the steering techniques apply to the top-down perspective. This is similar to many classic game perspectives like in Asteroids, as well as in new games like, uh,
Dot Wars. Because there are two axes to manipulate, you can easily define movement in this space with a two dimensional vector that represents an agent's velocity.
So why steer an agent instead of, say, make explicit changes in direction? What does it mean to steer?
An agent that steers looks more fluid than an agent that moves around the screen discretely. Its movements are decided with a two (or three, it's whatever) dimensional velocity. This closer mimics real physics than discrete "Go up. Now STOP!" movement. This is why it is a good idea to understand steering behavior for use with AI's; it's often nice to make your agents move as naturally as possible.
The series
Understanding Steering Behaviors explains basic steering behavior pretty well. You should go check it out. I'll wait.
If you decided that you were going to go ahead and read the series later, I'll give you a quick rundown here. Basic steering patterns can be combined together to create more complex patterns.
Basics:
- Seek: Go towards a point in a realistic way
- Flee: Go away from a point in a realistic way
These two movements are pretty self explanatory. Seek moves towards a point, where flee moves away from a point. However, instead of simply moving discretely towards/away from a point, an agent that seeks or flees manipulates its velocity smoothly. This creates a curved movement path, instead of a jagged movement path, which looks much better to a player.
These two basic movements can be augmented to give some new behavior. In fact, really every complex movement behavior is based on added to these two movements:
Augmented:
- Wander: Move aimlessly in a realistic way
- Evade: Avoid a target in a realistic way
- Pursue: Chase a target in a realistic way
Just read about these. They're awesome.
These basic and augmented movements can then be combined in a "
Movement Manager." The
movement manager allows for you to apply several different steering behaviors at once to create complex, compound movements.
Compound Movements:
- Collision Avoidance: Slide around obstacles while moving in other ways.
- Path Following: Define a path for agents
- Leader Following: Create subordinate, minion-like agents
Over the next few weeks, I'll go into more depth about each Gamedevtuts+ tutorial. Go ahead and acquaint yourself with the first one about
basic seeking so that my analysis makes more sense. I really like the series because it does a good job of compartmentalizing agent movement, so maybe you can like it, too!
It's really super cool, I promise.