320 likes | 570 Views
Dead Reckoning in Sports and Strategy Games. 8.4. Francois Dominic Laramee. Building a Sports AI Architecture. 8.5. Terry Wellmann. Dayne Mickelson AI Game Programming November 4, 2005. t. Dead Reckoning in Sports and Strategy Games. Dead Reckoning (DR).
E N D
Dead Reckoning in Sports and Strategy Games 8.4 Francois Dominic Laramee Building a Sports AI Architecture 8.5 Terry Wellmann Dayne Mickelson AI Game Programming November 4, 2005
t Dead Reckoning in Sports and Strategy Games Dead Reckoning (DR) • PREDICT FUTURE MOTIONEstimation the position of an object – given: • its original position • intended course • Speed • amount of time passed
Dead Reckoning in Sports and Strategy Games Origins in Real Life • Developed for Navigators / Sailors • Not taking wind or current into consideration • The Stronger the effect of these outside factors the less reliable an estimate • For Heavy fog without GPS System • DR Provides enough info to steer clear of dangerous obstacles & estimate position
Dead Reckoning in Sports and Strategy Games Real Life Usage • Used in Military Exercises • Effectively know where enemy • will be at time of attack • Estimate movement of enemy fleets / troops • Between instances of - • Visual Contact • Radar • Spy Satellite Visualization
Dead Reckoning in Sports and Strategy Games DR Use in Video Games • Military Simulation • Attack effectively if know where enemy will be located at time of attack • Sports Games • Exchange the ball/puck every few seconds between players. • Know where teammate / opponent will be • Offset Latency of Online Games
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • INERTIAL MOTION • PSEUDO-BROWNIAN MOTION • KINEMATICS
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • INERTIAL MOTION • MOST Basic Level of Dead Reckoning • Uses Newton’s First Law of Motion • Knowing objects position and speed we can assume it will continue to travel in straight line Pt = P0 +vt • This simple model is good for objects free of outside influence • Asteroid, Spaceship, hockey puck Px,t+1 = Px,t +vx Py,t+1 = Py,t +vy Pz,t+1 = Pz,t +vz
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • INERTIAL MOTION • Human Players can’t do much better • Model might be TOO GOOD • EX.) Shooting at enemy player • May insert evaluation errors into calculation • Add random variable with mean = actual velocity. Dependent on Difficulty Level.
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • PSEUDO-BROWNIAN MOTION • Object that is Extremely maneuverable and impossible to predict its velocity vector over lengthy periods • UFO or Mosquito • Dominated by overwhelming outside factors • Assume that object's initial position and magnitude of velocity vector is known. • Compute average displacement
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • PSEUDO-BROWNIAN MOTION • Initial Position • After Time t Passed • Calculate Spherical region of space in which it could have moved
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning • KINEMATICS • If objects initial velocity is unknown – it can be compute by 1st derivative of plotted position • Estimate future trajectory by using its acceleration vector • Acceleration, Initial Position, & Velocity Pt = P0+v0t+0.5at2
Dead Reckoning in Sports and Strategy Games Implementation of Dead Reckoning USES • KINEMATICS • Ballistic Missile • or Spaceship • Enemy Ship – Water current vector applied to enemy ship is same as AI’s own ship, so they actually cancel out • Human Player – from accel. buttons pressed • Can compute acceleration of any object in game
Dead Reckoning in Sports and Strategy Games Dead Reckoning in Sports Games • AI is trying to shoot ball or puck past an active obstruction or at goal (goalie, defensemen, cornerback, hole...) • AI is trying to pass the ball or puck to human player (FOOTBALL = 3rd dimension) • ALL cases – AI will apply dead reckoning to computer most likely trajectory. • Determine weather the human’s current trajectory will take him to an open spot or if another player will intercept pass
Dead Reckoning in Sports and Strategy Games Dead Reckoning in Sports Games - Soccer
Dead Reckoning in Sports and Strategy Games Dead Reckoning in Sports Games - Football
Dead Reckoning in Sports and Strategy Games Dead Reckoning in Military Simulation • Reconnaissance plane over ENEMY FLEET Provides Fleet’s: • 1.) position 2.) velocity 3.) heading • BOMBING RAID CAN BE PLANNED • Determine targets of incoming missile attacks so can guide anti-missile defenses • Submarine Simulation • Floating mines blink in and out of radar contact • Use DR to determine volumes where mines likely
Dead Reckoning in Sports and Strategy Games • PREDICT ENEMY MOVEMENT with FOG OF WAR
Dead Reckoning in Sports and Strategy Games Dead Reckoning in Online Games • Use DR to subdue the effects of network latency in multiplayer online games • Each player periodically broadcasts a packet containing his location, velocity, and acceleration • During intervals between packets – each machine uses DR to compute approximate positions of all other players • When new incoming packet is received, the local state of the world is updated accordingly
Dead Reckoning in Sports and Strategy Games Dead Reckoning other Applications • CAN INFER AN AGENT’S INTENTIONS & GOALS $$$
Building a Sports AI Architecture 8.5 Terry Wellmann NBA Inside Drive
Building a Sports AI Architecture THE GAME OF BASKETBALL • GAME AI • Straightforward to solve • Simulating cohesive group decision making is more difficult • IN THE REAL WORLD – TEAMS SPEND • HOURS PRACTICING TO: • Improve the skills of individual athletes • Train a group of independently thinking individuals how to function as a cohesive unit
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • Goals to Keep in Mind: • KISS– No need to add extra complexity if doesn’t add to user’s experience • Break decisions down to various levels of responsibility • Plan out the architecture • Don’t be afraid to make a mistake • Don’t underestimate the power or randomness – allows user to observe behaviors that are more complex and realistic than they actually are.
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • INDIVIDUAL AGENT (Player) PLANS • Identify high level decisions the player will make and arrange like decisions together • Offensive • Defensive • Shared Plans • Pass • Shoot • Drive • Run Play • Rescue • Teammate • Position defender • Double team ball • Steal ball • Steal pass • Block Shot • Take a Charge • Rebound • Inbound ball • Free Throw • ETC….
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • INDIVIDUAL AGENT (Player) PLANS • AgentPlan class serves as base class for all plans • class AgentPlan • { • ….. • float EvaluateInitiation(); • float EvaluateContinuation(); • void Initiate(); • void Update(); • …… • } Called every iteration and is responsible for carrying out plan Evaluate how Desirable it is for a plan to continue being used if it is currently executing Evaluates how Desirable it is for a plan to execute Performs 1-Time decision making each time the plan is initiated
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • AGENT (Player) PLANS • float EvaluateInitiation(); • float EvaluateContinuation(); • Returns number (-1.0 – 1.0) for each plan and allows you to build complex system where plans can be compared • Each plan evaluates the current situation independently and determines how appropriate it is to be used • Return Large number (>1.0) if strongly encouraged
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • AGENT (Player) PLANS • Break logic into additional update function: • 1.) Handle the ball handler decision-making • 2.) Handle the non ball handler decision-making • PRIORITY RANK ORDER - if equal evaluation values • 1.) BallHandler_Shoot • 2.) BallHandler_Pass • 3.) BallHandler_Drive • 4.) BallHandler_RunPlay • Don’t want to be on fast break and pull up for 3-Pointer • ASSUME drive plan only returns >0 if player can drive towards basket (aka. – their not well defended) ( .55 ) ( .55 ) ( > 0 )
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • ADDITIONAL AGENT (PLAYER) AI • Must now make high level decisions in hierarchical system • FOR THE CURRENT PLAYER: • POTENTIAL SUCCESS OF SHOT FROM CURRENT LOCATION • - 3 Pointer (guards OK, big men NOT OK) • - BASED ON ATTRIBUTE POINTS • TYPE OF SHOT • -guard (layup) • -big men (dunk) • TELL PLAYER TO EXECUTE
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • TEAM MANAGEMENT • Set of COMMON STATES, OFFENSIVE STATES, and DEFENSIVE STATES with clear TRANSITION POINTS • Each STRATEGY plan evaluates the current situation independently and determines how appropriate it is to be used • Use FINITE-STATE Machine for framework of architecture • OFFENSIVE & DEFENSIVE STATEScomplement each other • Inbound Transition • Frontcourt Rebound • Recover Ball Free-throw
Building a Sports AI Architecture PLANNING SPORTS AI ARCHITECTURE • TEAM MANAGEMENT • COMMON STATES – neutral situation (ball not in play) • Pre-game Substitution • Tip-Off Post Game • Time-out Halftime • Halftime • TRANSITIONS – triggered based on a game event • Made Shot A foul • Missed Shot A timeout • A steal Halftime
IN CONCLUSION • Dead Reckoning is an easy way to predict the trajectory of objects for the game. • Dead Reckoning can also be used to predict the behavior of a human player. • Sports present a unique set of challenges to AI application. • When user plays against AI, the game • must CAPTURE the abilities, personalities, • and decision making of that player. • Agent plans, team management, agent AI, and agent mechanics can be applied to any sport game. • AI development is all about good planning and trial and error.