7 AI steering behaviors

Community Forums/Showcase/7 AI steering behaviors

Drak(Posted 2012) [#1]
I coded this about 2 years ago for my own learning purposes. Just thought I would share it with everyone. Here's the *short* worklog on it:

In this simulation I will attempt success of 7 specific steering commands
;------------------------------------------------------------------------
1.seek
2.flee
3.arrive
4.wander
5.cohesion
6.alignment
7.seperation

;------------------------------------------------------------------------
These will all be functions that will return the required vector (degree)
and velocity to the movement and acceleration functions.

1. SEEK
Seek will calculate the needed velocity and vector needed to
arrive at the target destination.

2. FLEE
Opposite of seek, flee will calculate the vector and velocity
needed to move away from the target

3. ARRIVE
Arrive will smoothly decelerate to the required target.

4. WANDER
Move randomly with no specific target.

5. COHESION
Move to the center of mass of neighbors

6. ALIGNMENT
Maintain heading with neighbors

7. SEPERATION
Maintain a certain distance from neighbors.


Here is the code: It requires no media.
Note that the keys 1-5 change the state of the bots. For alignment (key5) to work correctly it must be used AFTER cohesion with seperation. (key4)



Last edited 2012

Last edited 2012


zoqfotpik(Posted 2012) [#2]
This is very interesting. Thanks a lot, it will come in extremely handy.


Why0Why(Posted 2012) [#3]
Very Cool! Thanks for posting. I have considered and Autoduel remake for years and that would be a great addition.