Heem Patel

Game programmer

AI Project Blog

Steering behaviors part 1

Posted by Heem on February 26, 2014 at 11:05 PM

Hey oh!

So this post was supposed to come about a week ago , sorry about that! But I had started looking into steering behaviors. 

What are steering behaviors , one might ask? Steering behaviours are behaviors basicaly such say "chase" , "flee" , "avoid" etc. Think about steering behaviors as decisions you make when playing any physical game. Say the game of tag. Now when the person who is "it" is near you  ,you basically "flee" away, when you are "it" you are chasing the other players thus showing the behavior of chase. Same concept applies to AI agents as well. The agents, depending on what state they are in would display different kinds of behaviors for e.g. If there is a guard nearby and he spots you, the guard will start chasing after you basically depicting the "chase"/ "seek" behavior. Similarly, an eney target might try to "flee" from you if they realize that you as a player are pursuing them. Thus is the concept of steering behavior. 

So how do they work? Most of the steering behaviors can be implemented in terms of basic vector mathematics. The seek behavior can be implemented easily as follow - 

Say your position is at P and your targets position is at Q , then the vector Q-P will be a vector that points from your position to the enemy's position. if you take a unit vector in direction of Q-P and multiply with the speed you can travel at, and assign that as your velocity vector, you will be travelling in the direction of your target. You will then be able to catch the enemy as long as their speed is less than yours. 

The flee can be implemented really easily as well, it is basically the opposite of seek, and the velocity would be in direction of -( Q-P ) vector. 

Some of the other steering behaviors that I lookied into after that are obstacle avoidance, and offset pursuit. These are a little bit more complicated. All of these behaviors can then be combined to get more complex behaviors such as group movements or flocking. 

So thats an intro about steering behaviors! keep an eye out for the next post where I'll talk about how I am planning on implementing them to show a demo. 

Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

Already a member? Sign In

0 Comments