Upcoming SlideShare
×

# CS4344 09/10 Lecture 3: Dead Reckoning and Local Perception Filter

798 views
703 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
798
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
20
0
Likes
0
Embeds 0
No embeds

No notes for slide

### CS4344 09/10 Lecture 3: Dead Reckoning and Local Perception Filter

1. 1. Lecture 3 Dead Reckoning and Local Perception Filter 25 January 2010 Saturday, January 23, 2010 1
2. 2. states Simulate Collect Events events Game Game or States Game Render States Wait Saturday, January 23, 2010 2
3. 3. What if a state changes continuously (i.e., is a function of time) ? Player A Server Player B Saturday, January 23, 2010 3
4. 4. Consider position updates of players. Players send move command. Server replies with positions periodically. Player A Server Player B Saturday, January 23, 2010 4
5. 5. Two issues: 1. Message overhead 2. Delay jitter Saturday, January 23, 2010 5
6. 6. Delay jitter causes player’s movement to appear erratic. Player A Server time Saturday, January 23, 2010 6
7. 7. Recall: Short circuiting is used to predict own states. We can similarly predict opponent’s state. Player A Server Player B Saturday, January 23, 2010 7
8. 8. Suppose the velocity remains constant, then we can predict every position at all time. predicted position Player A Server time Saturday, January 23, 2010 8
9. 9. x[t] position of entity at time t v velocity of the entity x[ti ] = x[ti−1 ] + v × (ti − ti−1 ) Saturday, January 23, 2010 9
10. 10. We send over the initial position x[t], t, and velocity. (Why do we need to send t?) predicted position Player A Server time Saturday, January 23, 2010 10
11. 11. But velocity may change (e.g. a car accelerating). To counter this, we send position, velocity, and acceleration as update. Player A Server time Saturday, January 23, 2010 11
12. 12. x[t] position of entity at time t v velocity of the entity a acceleration of the entity 1 x[ti ] = x[ti−1 ] + v(ti − ti−1 ) + a(ti − ti−1 )2 2 Saturday, January 23, 2010 12
13. 13. We will still need substantial number of updates if the direction changes frequently (e.g. in a FPS game). B Player A Server time Saturday, January 23, 2010 13
14. 14. idea: trade-off message overhead and accuracy. No need to update if error is small. Saturday, January 23, 2010 14
15. 15. Player A error threshold Server time Saturday, January 23, 2010 15
16. 16. Player A Server time Saturday, January 23, 2010 16
17. 17. Player A Server time Saturday, January 23, 2010 17
18. 18. predicted position at A A’s predicted position at the server Player A Server time Saturday, January 23, 2010 18
19. 19. 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. Player A Server time Saturday, January 23, 2010 19
20. 20. A converges the entity to the correct position smoothly. Player A Server time Saturday, January 23, 2010 20
21. 21. how to set error threshold? Saturday, January 23, 2010 21
22. 22. adapt based on game requirement (e.g. distance to other players) Saturday, January 23, 2010 22
23. 23. Space inconsistency: due to error threshold and convergence Time inconsistency: due to message delay and clock asynchrony Player A Server time Saturday, January 23, 2010 23
24. 24. What is the difference between the actual and predicted position ? How long does the difference last? Saturday, January 23, 2010 24
25. 25. error time inconsistency = Saturday, January 23, 2010 25
26. 26. what are the different components of distance error? Player A Server time Saturday, January 23, 2010 26
27. 27. Any drawbacks? Saturday, January 23, 2010 27
28. 28. higher CPU cost (needs to simulate other players) unfair (higher latency leads to larger error) Saturday, January 23, 2010 28
29. 29. Dead Reckoning Saturday, January 23, 2010 29
30. 30. Generalized Dead Reckoning : Prediction Contract Saturday, January 23, 2010 30
32. 32. Server and clients must have a common notion of “time” Saturday, January 23, 2010 32
33. 33. Two choices: Wall Clock Game Clock Saturday, January 23, 2010 33
34. 34. Wall Clock: clients and server have to synchronize their physical clocks using NTP or SNTP. Saturday, January 23, 2010 34
35. 35. now is 10:18:32 now is 10:18:29.5 now is 10:18:30 now is 10:18:33.5 Saturday, January 23, 2010 35
36. 36. now is 10:18:32 now is 10:18:29.5 now is 10:18:30 now is 10:18:33.5 Time now should be 10:18:30.5 RTT = 1s OWD = 0.5s Saturday, January 23, 2010 36
37. 37. 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 A Server Player B Saturday, January 23, 2010 37
38. 38. or: synchronize states to game clock, which runs behind the server by an amount of time equals to the one-way delay. Player A Server Player B Saturday, January 23, 2010 38
39. 39. what A sees what B sees A S B 3 4 2 game clock Saturday, January 23, 2010 39
40. 40. Example: using game clock Saturday, January 23, 2010 40
41. 41. A decides to move. Send event to S. A S B 1 2 0 Saturday, January 23, 2010 41
42. 42. S receives event, moves A, and tells A and B that A is moving at t = 3 A S B A S B 1 2 0 2 3 1 Saturday, January 23, 2010 42
43. 43. A moves itself at t = 3. A S B A S B A S B 1 2 0 2 3 1 3 4 2 Saturday, January 23, 2010 43
44. 44. B moves A at t = 3. A S B A S B A S B A S B 1 2 0 2 3 1 3 4 2 4 5 3 Saturday, January 23, 2010 44
45. 45. Example: using wallclock Saturday, January 23, 2010 45
46. 46. A decides to move. Send event to S. A S B 0 0 0 Saturday, January 23, 2010 46
47. 47. S receives event, moves A, and tells A and B that A is moving at t = 1 A S B A S B 0 0 0 1 1 1 Saturday, January 23, 2010 47
48. 48. A moves itself to where it should be at t = 2. A S B A S B A S B 0 0 0 1 1 1 2 2 2 Saturday, January 23, 2010 48
49. 49. B ﬁnds out A moves at t = 1 and moves A to where A should be at t = 3 A S B A S B A S B A S B 0 0 0 1 1 1 2 2 2 3 3 3 Saturday, January 23, 2010 49
50. 50. Tight synchronization allows interaction but can lead to visual disruptions. Saturday, January 23, 2010 50
51. 51. Asynchronization allows smooth movement but hinder interaction. Saturday, January 23, 2010 51
52. 52. Local Perception Filter Saturday, January 23, 2010 52
53. 53. Hybrid Model: Render objects within real- time interaction range in real time, other objects in delayed time. Saturday, January 23, 2010 53
54. 54. Two Kinds of Entities Active: players (unpredictable) Passive: ball, bullet (predictable) Saturday, January 23, 2010 54
55. 55. happening now A happened B time t ago Saturday, January 23, 2010 55
56. 56. Question: What if a player A throws a ball at player B? Saturday, January 23, 2010 56
57. 57. happening now A happened B time t ago Saturday, January 23, 2010 57
58. 58. Question: What if a player B throws a ball at player A? Saturday, January 23, 2010 58
59. 59. happening now A happened B time t ago Saturday, January 23, 2010 59
60. 60. Distance of ball (thrown by A) from A versus time. distance now time t ago time t ago now time Saturday, January 23, 2010 60
61. 61. What A sees.. distance time t ago now time Saturday, January 23, 2010 61
62. 62. Distance of ball (thrown by B) from A versus time. distance time t ago now time t ago now time Saturday, January 23, 2010 62
63. 63. Distance of ball (thrown by B) from A versus time. distance time t ago now time Saturday, January 23, 2010 63
64. 64. A happened t ago happened t - 1 ago happened t - 2 ago B Saturday, January 23, 2010 64
65. 65. Question: What if a player A throws a ball at player B? Saturday, January 23, 2010 65
66. 66. What A sees.. distance time Saturday, January 23, 2010 66
67. 67. What A sees.. distance time Saturday, January 23, 2010 67
68. 68. Question: What if a player B throws a ball at player A? Saturday, January 23, 2010 68
69. 69. Distance of ball (thrown by B) from A versus time. distance time Saturday, January 23, 2010 69
70. 70. Saturday, January 23, 2010 70
71. 71. time Saturday, January 23, 2010 71
72. 72. 3 slots ago 2 slots ago 1 slots ago now time Saturday, January 23, 2010 72
73. 73. Assignment 1 Saturday, January 23, 2010 73
74. 74. Saturday, January 23, 2010 74
75. 75. Assignment 1 Saturday, January 23, 2010 75