dead reckoning

17
Dead Reckoning References: Gamasutra (1), Gamedev (1) Forum articles (1)

Upload: jenna

Post on 05-Jan-2016

77 views

Category:

Documents


0 download

DESCRIPTION

Dead Reckoning. References: Gamasutra ( 1 ), Gamedev ( 1 ) Forum articles ( 1 ). Introduction. Fast-paced interaction in twitch games Players expect the level of performance of distributed games to approximate that of single computer/player game - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Dead Reckoning

Dead Reckoning

References: Gamasutra (1), Gamedev (1)Forum articles (1)

Page 2: Dead Reckoning

Fall 2012 2

Introduction

Fast-paced interaction in twitch gamesPlayers expect the level of performance of distributed games to approximate that of single computer/player gameSolution: dedicated network (end-to-end latency 150-200 ms)

Page 3: Dead Reckoning

Fall 2012 3

Dead Reckoning

From DIS (distributed interactive simulation) protocol of SIMNET project, DoD, USA Was for networking tank simulators Objectives: latency hiding, bandwidth reduction

Basic Ideas: Agree in advance on a set of algorithms that can

be used by all players to extrapolate the behavior of entities

Update threshold: how far reality should be allowed to get from these extrapolations before a correction is issued

Page 4: Dead Reckoning

Fall 2012 4

Dead Reckoning

[point-to-point]01 tt PositionPosition

0101ttvPositionPosition tt

20101 2

101

tta

ttvPositionPosition tt [quadratic]

[linear]

If the motion is still within theDR threshold (on Owner), no updates required.

Page 5: Dead Reckoning

Fall 2012 5

DR Algorithm (point-to-point)

No path

Noticeably jerky unless one packet is received per frame

New packet [p]

New packet [p]

Page 6: Dead Reckoning

Fall 2012 6

DR Algorithm (linear)moves along this v, until …

New packet [p,v]

Path does not consider change of velocity

Page 7: Dead Reckoning

Fall 2012 7

DR Algorithm (quadratic)moves along this v and a, until …

NewPosition = OldPosition + Velocity*time + 0.5*Acceleration*(time)2

New packet [p,v,a]

Path does not consider change of acceleration – jerk

Page 8: Dead Reckoning

Fall 2012 8

PDU (protocol data unit)

Data packet representing each entity Kinematic state: position, velocity,

acceleration, orientation Other info: damage level, turret … Which dead reckoning algorithm to use

Threshold: jerkiness vs. more PDUs to be sent

Page 9: Dead Reckoning

Fall 2012 9

Smoothing

Jerkiness: due to sudden update of positionUse smoothing algorithm to lessen the apparent jerkiness [more later]

Page 10: Dead Reckoning

Fall 2012 10

Extension

Predictive Contract State-based, rather than kinematic-

based State: “drive along road to waypoint”

If the definition of roads, the specific waypoint, the way of driving (right-side), … are known to all players, the vehicle could be computed w/o any network traffic

Others: “turn on/off the sensors”, “send out radio report”

Page 11: Dead Reckoning

Fall 2012 11

Summary

Dead reckoning is not free: every computer runs an algorithm to extrapolate each entityTrade processor cycles to reduced network use and apparent latencyIf all entities behave unpredictably all the time, DR offers little gain

Page 12: Dead Reckoning

Fall 2012 12

DR Smoothing with Cubic Splines (ref)

Jerkiness is due to the sudden update of positionThe following method ensures smooth positional transition while ensuring accuracy by packet (server) updates

Only cubic (parametric) curve can represent R3 curve [quadratic curves are planar]Hermite curves are most common. Two points and their corresponding tangents need to be specified (by quadratic kinematics laws)

Page 13: Dead Reckoning

A Draftsman’s Spline

Fall 2012 13

Page 14: Dead Reckoning

Fall 2012 14

Math of Hermite Curves

h1(s) = 2s33s2 + 1h2(s) = 2s3 + 3s2

h3(s) = s3 2s2 + s h4(s) = s3 s2

P(s) = P1h1(s) + P2h2(s) + T1h3(s) + T2h4(s)P’(s)=P1h1’(s) + P2h2’(s) + T1h3’(s) + T2h4’(s)

h1’ = 6s2 6s h2’ = 6s2+6s h3’= 3s2 4s+1 h4’= 3s2 – 2sNote: end tangent vectors are dP/ds

Page 15: Dead Reckoning

Fall 2012 15

s=0 t=0

s=1 t=T

)0()0(dt

dpT

ds

dP

)()1( Tdt

dpT

ds

dP

Reparameterization

dt

ds

ds

sdP

dt

tdp

tsPtp

t

)()(

))(()(

:(time) isparameter theIf

Tds

sdP

dt

ds

ds

sdP

dt

tdpT

dtds

T

ts

1)()()(velocity

Page 16: Dead Reckoning

Fall 2012 16

Algorithm

When a packet [p,v,a] arrives, begin creating a cubic spline for next position Approximate (extrapolate) the [p,v] after time

T

A piece of Hermite curve is defined by two end points and two end tangents P1: current position T1: (scaled) current velocity P2: extrapolated position after T T2: (scaled) velocity after T T: estimated

interval between packets

T: estimated interval between packets

Page 17: Dead Reckoning

Fall 2012 17

Details

New packet [p,v,a]

Start a new spline by1. Current [p,v]2. New [p,v] computed by [p,v,a] after time T

Move with current spline

P1

T1

P2T2 The position gradually

changes from P1 (s=0) to P2 (s=1, t=T)