Steering Behavior CIS 488588 Bruce R Maxim UMDearborn
Steering Behavior CIS 488/588 Bruce R. Maxim UM-Dearborn 10/18/2021 1
Alife • Focuses on behavior of individual creatures that combine into complex pattern • The interaction of simple patterns can create incredibly sophisticated simulations • Alife can be used to simulate crowds in complex environments using streering behaviors • This was the basis of Conway’s game of life 10/18/2021 2
Assumptions • Steering behaviors assume the existence of a lower-level of the engine to handle locomotion • The locomotion system processes each characters position and velocity • When player stops pressing a key movement stops (heavy duty friction) • In many games a key press is likely to control velocity and not acceleration • In this chapter velocity persists and the AI applies an acceleration to effect steering 10/18/2021 3
Seeking and Fleeing • Seeking – Steering behavior moving creatures toward target • Fleeing – Steering behavior moving creatures away from target • Pursuit – Seeking a moving target • Evasion – Avoiding a moving target 10/18/2021 4
Enhancements - 1 • Wandering – Make random behavior appear a little more purposeful – Patterns should be slightly unpredictable, but not arbitrarily random – Could accumulate steering values and filter them using the sin function (gives both + and – values) • Projecting Targets – Look ahead randomly for point where target is predicted to be and move there 10/18/2021 5
Seeking Implementation #compute velocity vector toward target desired_velocity = truncate(position_target, max_speed); #compute steering force steering_force = desired_velocity; • Arrival behavior can be simulated by slowing down the velocity to something less than max_speed within some distance from target 10/18/2021 6
Fleeing Implementation // compute velocity vector toward target desired_velocity = truncate(position_target, max_speed); // compute steering force steering_force = - desired_velocity; 10/18/2021 7
Modeling Flocks • There additional steering components needed (e. g. alignment and cohesion) when modeling group behaviors • These require position and orientation information for neighbors rather than surrounding obstacles 10/18/2021 8
Generalized Obstacle Avoidance function avoid_obstacles { project future position based on velocity if collision predicted { project empty position away from collision compute turn to get to empty position } if obstacle is within critical distance determine braking force // slow or stop apply steering and braking forces } 10/18/2021 9
Comments • Application of steering and braking forces is easy since our interface outputs turn and move values • The challenge is in acquiring the inputs used to determine future collisions • This algorithm requires environment knowledge, intersection tests, collision normal forces, and location of nearby empty spaces • This makes it unsuitable for implementation 10/18/2021 10
Updated Obstacle Avoidance - 1 function avoid_obstacles 2 { check sensors for free space front, left, right if front collision predicted { find furthest obstacle on right or left determine best side to turn toward compute turn to seek that free space } if front obstacle is within critical distance determine braking force // slow or stop 10/18/2021 11
Updated Obstacle Avoidance - 2 if obstacle on left adjust steering to step right if obstacle on right adjust steering to step left apply steering and braking forces } • Implementing this involves simple translation to C++ and finding suitable parameters during experimentation phase 10/18/2021 12
Enhancements - 2 • Forced Exploration – Keep track of previous positions a flee from them – Done usingle vector (provenance)pointing toward last position – Coefficients a + b = 1 provenance = a * previous + b * provenance 10/18/2021 13
Advantages - 1 • Simplicity – Hard to find a simpler architecture • Reliability – Most situations can be identified requirements • Predictability – No ambiguity, each rule written explicitly • Efficiency – Very low computational overhead 10/18/2021 14
Disadvantages - 1 • Local traps – Can still get stuck in corners, if it begins to turn one way and then decides the another way might be better • Testing – This approach requires extensive testing because there are so many parameters to play with 10/18/2021 15
Disadvantages - 2 • Realism – Robotic movement is not as smooth as it might be (local decisions are not integrated into a plan) • Scalability – Additional behaviors are added by adding additional lines of code and recompiling 10/18/2021 16
Marvin • Uses obstacle sensors and steering behaviors to prevent collisions in a reactive fashion • Uses chapter enhancements to improve its wandering behavior 10/18/2021 17
- Slides: 17