130 likes | 373 Views
2.7 Avoiding Dynamic Obstacles and Hazards. Don DeLorenzo. Geraint Johnson – Computer Artworks Ltd. The Thing. First/Third Person Shooter Squad Based Utilized Repulsion Vectors for dynamic obstacle avoidance Fear and Trust. Avoiding Dynamic Hazards.
E N D
2.7 Avoiding Dynamic Obstacles and Hazards Don DeLorenzo
Geraint Johnson – Computer Artworks Ltd.The Thing • First/Third Person Shooter • Squad Based • Utilized Repulsion Vectors for dynamic obstacle avoidance • Fear and Trust
Avoiding Dynamic Hazards • A* or any other method we’ve seen handles long range movement • These often deal poorly with dynamic obstacles • Convincing short range obstacle avoidance • Avoids walking into other agents • Discovers dynamically blocked paths early
Ideal Path Destination Agent Obstacle Direct Path • Dynamic obstacles are obstacles capable of movement • Agent should avoid obstacle smoothly, not bump into it on its way past, which looks bad, and is worse of obstacle is dangerous
Repulsion Vectors Desired Velocity Repulsion Agent • In the direction of the agent from the obstacle • Combine with destination direction via vector addition • Update as agent moves Obstacle Destination Direction Destination
Calculating Vector Direction • Repulsion of Agent ‘a’ from entity ‘e’ • Total repulsion vector is sum of repulsion vectors from all dynamic obstacles • Desired velocity is calculated using desired speed and destination and repulsion vectors
Repulsion Magnitude • No single ‘correct’ value for mae • Desirable characteristics for heuristic: • In the case of an obstacle not worth avoiding, mae = 0 • If the obstacle is too far away, mae = 0 • Otherwise, mae inversely related to distance from a to e • mae should be larger if a and e are on collision course • mae should have clamped upper bound
Sidestepping Destination Ra a Da Sidestep Repulsion Va Obstacle • If obstacle is located directly between agent and destination, either • Ra will overpower Da and agent will never reach destination • Da will overpower Ra and agent will collide with obstacle • If angle between Ra and Da too large, add sidestep vector
Realistic Sidestepping Agent A Agent B
Unworkable Repulsion • Repulsion vector will never allow agent to reach destination • Defer to higher level AI • Ignore repulsion vector • Obstacle can be pushed out of the way • Obstacle is less dangerous than what agent is fleeing • Obstacle is moving and will be gone in time • Give up on this destination Obstacle Agent Destination
Oscillations Time = t0 Ra Time = t1 Ra a Va a e1 e2 e1 Va e2 Da Da • Oscillations occur when agent is near multiple obstacles • If one or more obstacles are non-hazardous, ignore them in calculation • Otherwise, flag failure find a different path
Conclusion • Repulsion vectors from nearby entities are added to agent’s velocity • Sidestepping vectors are added when velocity and repulsion are roughly opposite • Oscillations preempted • Adds realism with convincing short range avoidance • Simple arithmetic – quick to calculate