cs4344 09/10 lecture 3: dead reckoning and local perception filter

Post on 22-Apr-2015

812 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Lecture 3Dead Reckoning

andLocal Perception Filter

25 January 2010

1Saturday, January 23, 2010

or

Collect Events

Render

Wait

GameStates

events

states

Simulate Game

GameStates

2Saturday, January 23, 2010

Player A

What if a state changes continuously (i.e., is a function of time) ?

Player B

Server

3Saturday, January 23, 2010

Player A

Consider position updates of players. Players send move command. Server replies with positions periodically.

Player B

Server

4Saturday, January 23, 2010

Two issues:

1. Message overhead2. Delay jitter

5Saturday, January 23, 2010

Delay jitter causes player’s movement to appear erratic.

Server

Player A

time

6Saturday, January 23, 2010

Player A

Recall: Short circuiting is used to predict own states. We can similarly predict opponent’s state.

Player B

Server

7Saturday, January 23, 2010

Suppose the velocity remains constant, then we can predict every position at all time.

Server

Player A

time

predicted position

8Saturday, January 23, 2010

x[ti] = x[ti−1] + v × (ti − ti−1)

x[t]v

position of entity at time t

velocity of the entity

9Saturday, January 23, 2010

We send over the initial position x[t], t, and velocity. (Why do we need to send t?)

Server

Player A

time

predicted position

10Saturday, January 23, 2010

But velocity may change (e.g. a car accelerating). To counter this, we send position, velocity, and acceleration as update.

time

Server

Player A

11Saturday, January 23, 2010

x[t]v

position of entity at time t

velocity of the entity

x[ti] = x[ti−1] + v(ti − ti−1) +12a(ti − ti−1)2

a acceleration of the entity

12Saturday, January 23, 2010

B

time

We will still need substantial number of updates if the direction changes frequently (e.g. in a FPS game).

Server

Player A

13Saturday, January 23, 2010

idea: trade-off message overhead and accuracy. No need to update if error is small.

14Saturday, January 23, 2010

time

Server

Player A

error threshold

15Saturday, January 23, 2010

time

Server

Player A

16Saturday, January 23, 2010

time

Server

Player A

17Saturday, January 23, 2010

time

predicted position at A

A’s predicted position at the server

Server

Player A

18Saturday, January 23, 2010

time

A’s version of the entity’s position is now too far away from the correct position. Server updates A with the new velocity and position.

Server

Player A

19Saturday, January 23, 2010

time

A converges the entity to the correct position smoothly.

Server

Player A

20Saturday, January 23, 2010

how to set error threshold?

21Saturday, January 23, 2010

adapt based on game requirement

(e.g. distance to other players)

22Saturday, January 23, 2010

time

Space inconsistency: due to error threshold and convergence

Time inconsistency: due to message delay and clock asynchrony

Server

Player A

23Saturday, January 23, 2010

What is the difference between the actual and predicted position ?

How long does the difference last?

24Saturday, January 23, 2010

error

time

inconsistency =

25Saturday, January 23, 2010

time

what are the different components of distance error?

Server

Player A

26Saturday, January 23, 2010

Any drawbacks?

27Saturday, January 23, 2010

higher CPU cost(needs to simulate other players)

unfair(higher latency leads to larger error)

28Saturday, January 23, 2010

Dead Reckoning

29Saturday, January 23, 2010

Generalized Dead Reckoning : Prediction Contract

30Saturday, January 23, 2010

“return to base”“drive along this road”

31Saturday, January 23, 2010

Server and clients must have a common notion of “time”

32Saturday, January 23, 2010

Two choices:

Wall ClockGame Clock

33Saturday, January 23, 2010

Wall Clock: clients and server have to synchronize their physical clocks using NTP or SNTP.

34Saturday, January 23, 2010

now is 10:18:32

now is 10:18:30

now is 10:18:29.5

now is 10:18:33.5

35Saturday, January 23, 2010

now is 10:18:32

now is 10:18:30

now is 10:18:29.5

now is 10:18:33.5

Time now should be10:18:30.5

RTT = 1sOWD = 0.5s

36Saturday, January 23, 2010

Player A

Players try to sync the game states with the server at the same wallclock time, and predict ahead with an amount of time equal to one-way delay.

Player B

Server

37Saturday, January 23, 2010

Player A

or: synchronize states to game clock, which runs behind the server by an amount of time equals to the one-way delay.

Player B

Server

38Saturday, January 23, 2010

A S B

what A seeswhat B sees

3 4 2 game clock

39Saturday, January 23, 2010

Example: using game clock

40Saturday, January 23, 2010

A S B

1 2 0

A decides to move. Send event to S.

41Saturday, January 23, 2010

A S B

1 2 0

S receives event, moves A, and tells A and B that A is moving at t = 3

A S B

2 3 1

42Saturday, January 23, 2010

A S B

1 2 0

A moves itself at t = 3.

A S B

2 3 1

A S B

3 4 2

43Saturday, January 23, 2010

A S B

1 2 0

B moves A at t = 3.

A S B

2 3 1

A S B

3 4 2

A S B

4 5 3

44Saturday, January 23, 2010

Example: using wallclock

45Saturday, January 23, 2010

A S B

0 0 0

A decides to move. Send event to S.

46Saturday, January 23, 2010

A S B

0 0 0

S receives event, moves A, and tells A and B that A is moving at t = 1

A S B

1 1 1

47Saturday, January 23, 2010

A S B

0 0 0

A moves itself to where it should be at t = 2.

A S B

1 1 1

A S B

2 2 2

48Saturday, January 23, 2010

A S B

0 0 0

B finds out A moves at t = 1 and moves A to where A should be at t = 3

A S B

1 1 1

A S B

2 2 2

A S B

3 3 3

49Saturday, January 23, 2010

Tight synchronization allows interaction but can lead to visual disruptions.

50Saturday, January 23, 2010

Asynchronization allows smooth movement but hinder interaction.

51Saturday, January 23, 2010

Local Perception Filter

52Saturday, January 23, 2010

Hybrid Model:Render objects within real-time interaction range in real time, other objects in

delayed time.

53Saturday, January 23, 2010

Two Kinds of Entities

Active: players (unpredictable)Passive: ball, bullet (predictable)

54Saturday, January 23, 2010

happening now

happened time t ago

A

B

55Saturday, January 23, 2010

Question:What if a player A throws a

ball at player B?

56Saturday, January 23, 2010

happening now

happened time t ago

A

B

57Saturday, January 23, 2010

Question:What if a player B throws a

ball at player A?

58Saturday, January 23, 2010

happening now

happened time t ago

A

B

59Saturday, January 23, 2010

Distance of ball (thrown by A) from A versus time.

distance

time

nowtime t ago

now time t ago

60Saturday, January 23, 2010

What A sees..

distance

time

nowtime t ago

61Saturday, January 23, 2010

Distance of ball (thrown by B) from A versus time.

distance

time

nowtime t ago

now

time t ago

62Saturday, January 23, 2010

Distance of ball (thrown by B) from A versus time.

distance

time

nowtime t ago

63Saturday, January 23, 2010

happened t ago

happened t - 1 ago

happened t - 2 ago

A

B

64Saturday, January 23, 2010

Question:What if a player A throws a

ball at player B?

65Saturday, January 23, 2010

What A sees..

distance

time

66Saturday, January 23, 2010

What A sees..

distance

time

67Saturday, January 23, 2010

Question:What if a player B throws a

ball at player A?

68Saturday, January 23, 2010

Distance of ball (thrown by B) from A versus time.

distance

time

69Saturday, January 23, 2010

70Saturday, January 23, 2010

time

71Saturday, January 23, 2010

time

3 slots ago

now

2 slots ago

1 slots ago

72Saturday, January 23, 2010

Assignment 1

73Saturday, January 23, 2010

74Saturday, January 23, 2010

Assignment 1

75Saturday, January 23, 2010

top related