Title: Dead reckoning in Sports and Strategy Games
1Dead reckoning in Sports and Strategy Games
- Ushhan D. Gundevia
- November 8, 2004
2Franç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
- francoislaramee_at_videotron.ca
3Some 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
- http//www.gignews.com/fdlcharacterdesign.htm
- The Developer's Life
- http//www.gignews.com/devlife/
- Chess Programming Part I VI
- http//www.gamedev.net/reference/list.asp?category
id18
4Dead 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
5Origins 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
6Equations for DR
- Based on the properties of motion, an article can
be tracked with the help of - Inertia
- Pseudo-Brownian Motion
- Kinematics
7Inertia
- Everyone remember Newtons 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.
8Pseudo-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
9What 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)
10Kinematics
- 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
11How to add Acceleration?
- For free falling objects, its gravity
- For a human, it can be calculated by the buttons
he presses - For everything else, its the second derivative
of the curve - P P0 v0t 0.5at2
12DR 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
13DR 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.
14Example 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 opponents car is out-of-date - ? Both players believe that they are the winner
15DR 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
games domain.
16Defeating Lag With Cubic Splines
Pt P0 vt
P P0 v0t 0.5at2
17Using 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
18Using 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
19Finally
20Inferring Goals
- In cases when the world is not fully accessible,
the AI can use DR to predict the Human Players
future goals and decide its interception strategy
21Correcting 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
22Demonstration - Targeting
- Targeting in Real-Time Network Games
The reality of network games what everyone sees
23Effects of Latency in a Game
Latency causes the game to go in different
directions for each player
24Compensating??
Overly compensating for latency makes the game
look bad.
25Targeting
The target (the blue thing) has two elements A
position, and a velocity.
26Pseudo 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
-
27Final 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
28Conclusion
- 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
29References
- Dead Reckoning in Sports and Strategy Games AI
Game Programming Wisdom 2 - Targeting - A variation of Dead Reckoning - Chris
Haag http//www.gamedev.net/reference/articles/art
icle1370.asp - Defeating Lag With Cubic Splines - Nick Caldwell
- http//www.gamedev.net/reference/articles/article
914.asp - Suitability of Dead Reckoning Schemes for Games
- http//netmedia.kjist.ac.kr/courses/dic1623-2002f
a/reports/Sehchan-Case20(Networked20Game2).ppt1
- A Dead-Reckoning Technique for Streaming Virtual
Human Animation - http//ligwww.epfl.ch/thalmann/papers.dir/ieeetr
_csvt.PDF