Dead reckoning in sports and strategy games
1 / 29

- PowerPoint PPT Presentation

  • Updated On :

Dead reckoning in Sports and Strategy Games. Ushhan D. Gundevia November 8, 2004. Fran ç ois Dominic Laram é e. In the Gaming business since 1991 Worked on over 20 Games Editor and Principal Author of Game Design Perspectives Secrets of the Game Business [email protected]

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about '' - magdalen

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Dead reckoning in sports and strategy games l.jpg

Dead reckoning in Sports and Strategy Games

Ushhan D. Gundevia

November 8, 2004

Fran ois dominic laram e l.jpg
François Dominic Laramée

  • In the Gaming business since 1991

  • Worked on over 20 Games

  • Editor and Principal Author of

Some other interesting articles by him l.jpg
Some other interesting articles by him

  • Advanced Genetic Programming: New Lessons from Biology

    • AI Game Programming Wisdom 2 – Sec. 11.5

  • A Rule-Based Architecture using Dempster - Shafer Theory

  • Using N-Gram Statistical Models to Predict Player Behavior

  • Genetic Algorithms: Evolving the Perfect Troll

    • All in AI Game Programming Wisdom

  • Character-Based Game Design


  • The Developer's Life


  • Chess Programming Part I – VI


Dead reckoning l.jpg
Dead Reckoning

  • What is Dead Reckoning?

    • Predicting the motion of an object based on its previous state

  • Uses in the Gaming Industry –

    • In Sports Games, AI needs to predict a players position to pass/avoid him

    • In Online Games, its used to offset latency

    • Predicting Goals of the Human Player

Origins of dr l.jpg
Origins of DR

  • Originally developed as a tool for Navigation, e.g. Navigating in Heavy Fog without GPS

  • It does not take into account the effects of outside forces, which leads to less reliable estimates

Equations for dr l.jpg
Equations for DR

  • Based on the properties of motion, an article can be tracked with the help of

    • Inertia

    • Pseudo-Brownian Motion

    • Kinematics

Inertia l.jpg

  • Everyone remember Newton’s First Law of motion

    • Px = Px0 + vxt

    • Py = Py0 + vyt In 3D

    • Pz = Pz0 + vzt

  • In situations which are relatively free of outside influence, it works well

  • Sometimes, may be too well. In these cases we might have to insert evaluation errors.

  • Pseudo brownian motion l.jpg
    Pseudo-Brownian Motion

    • In cases where objects are extremely maneuverable or have many external influences, its impossible to predict its velocity vector over some large interval

    • Hence, from an observers point of view, they appear exhibiting Random Brownian Motion

    What to do then l.jpg
    What to do then?

    • The best that can be done is to compute the average displacement among a number of such particles.

    • In case of objects that are very maneuverable, the best we can do is to calculate a radius of a spherical region in space in which it could have moved

    • In case of a floating mine, we can assume the radius to be a lot less (half or even its root)

    Kinematics l.jpg

    • If an objects initial velocity ‘u’ is unknown

    • Plot a curve of its position for an arbitrary interval, and compute speed as its first Derivative

    • To add an estimate of acceleration, add the acceleration vector

    How to add acceleration l.jpg
    How to add Acceleration?

    • For free falling objects, its gravity

    • For a human, it can be calculated by the buttons he presses

    • For everything else, it’s the second derivative of the curve

      • P = P0 + v0t + 0.5at2

    Dr in sports games l.jpg
    DR in Sports Games

    • We apply DR in two situations

      • AI is trying to shoot pass a human obstacle

      • AI is trying to pass to a human player

    Dr in military stimulations l.jpg
    DR in Military Stimulations

    • Examples –

      • In WWII scenario, the human flies a reconnaissance aircraft over an enemy fleet/army. The bombing raid can be planned with the help of DR

      • In contemporary warfare, DR can assist in missile tracking and firing counter measures

      • In Submarine simulations, DR can be used to avoid floating mines which are not always visible through RADAR.

    Example of a paradoxical situation l.jpg
    Example of a Paradoxical Situation

    • Both cars are going head-to-head while passing the line

    • Due to delay, counter player position arrives late, position of opponent’s car is out-of-date

       Both players believe that they are the winner

    Dr in online games l.jpg
    DR in Online Games

    • DR can be used to mitigate effects of network latency

      • Each player broadcasts a packets containing is location, velocity and acceleration

      • During intervals between packets, the AI uses DR

      • When a new packet arrives, the local world state is updated

    • How often to send a packet will depend on the game’s domain.

    Defeating lag with cubic splines l.jpg
    Defeating Lag With Cubic Splines

    Pt = P0 + vt

    P = P0 + v0t + 0.5at2

    Using cubic splines l.jpg
    Using Cubic Splines

    • Using cubic splines to create a path is a matter of simple algebraic equations. The input for these equations are four (x,y) coordinates.

      • Coordinate 1 = Starting position

      • Coordinate 2 = Position after 1 second using starting velocity = Coordinate1 + StartVelocity

      • Coordinate 3 = Position after 1 second using reversed ending velocity = Coordinate4 – EndVelocity

      • Coordinate 4 = Ending position

    Using cubic splines18 l.jpg
    Using Cubic Splines

    • Here are the parametric equations used to form the spline.

      • x = At3 + Bt2 + Ct + D

      • y = Et3 + Ft2 + Gt + H

        • t is the time variable. It ranges from 0 at the initial point to 1 at the end point.

          A = x3 – 3x2 +3x1 – x0B = 3x2 – 6x1 + 3x0C = 3x1 – 3x0D = x0E = y3 – 3y2 +3y1 – y0F = 3y2 – 6y1 + 3y0G = 3y1 – 3y0H = y0

    Inferring goals l.jpg
    Inferring Goals

    • In cases when the world is not fully accessible, the AI can use DR to predict the Human Player’s future goals and decide its interception strategy

    Correcting errors in dr l.jpg
    Correcting Errors in DR

    • The estimate provided by DR can become unbounded over time

    • A constant bound might be possible by using a Priori map (evidence grid)

      • The Agent computing its own position maintains a local short map of its surroundings

      • This short term map is compared with the priory map using PR techniques

      • Small, incremental corrections are applied to the agents trajectory

    Demonstration targeting l.jpg
    Demonstration - Targeting

    • Targeting in Real-Time Network Games

    The reality of network games; what everyone sees

    Effects of latency in a game l.jpg
    Effects of Latency in a Game

    Latency causes the game to go in different directions for each player

    Compensating l.jpg

    Overly compensating for latency makes the game look bad.

    Targeting l.jpg

    The target (the blue thing) has two elements: A position, and a velocity.

    Pseudo code l.jpg
    Pseudo Code

    for each frame {

    target.x_velocity = target.x_velocity + target.x_acceleration;

    target.y_velocity = target.y_velocity + target.y_acceleration;

    target.z_velocity = target.z_velocity + target.z_acceleration;

    target.x_position = target.x_position + target.x_velocity;

    target.y_position = target.y_position + target.y_velocity;

    target.z_position = target.z_position + target.z_velocity;

    laser.x = (laser.x + target.x_position) / 2;

    laser.y = (laser.y + target.y_position) / 2;

    laser.z = (laser.z + target.z_position) / 2;


    Final effect l.jpg
    Final Effect

    The server and other clients can calculate where the laser is on your screen (the target),

    but rather than just placing it there, it makes the laser quickly converge to that target.

    This makes the game run more smoothly for everybody

    Conclusion l.jpg

    • DR is an easy way to predict trajectories of objects

    • The calculations are based on the information readily available and hence there is no inherent “cheating”

    • Its execution time is linear wrt the no. of objects being tracked

    References l.jpg

    • Dead Reckoning in Sports and Strategy Games – AI Game Programming Wisdom 2

    • Targeting - A variation of Dead Reckoning - Chris Haag

    • Defeating Lag With Cubic Splines - Nick Caldwell

    • Suitability of Dead Reckoning Schemes for Games

    • A Dead-Reckoning Technique for Streaming Virtual Human Animation