Assume that the client has a latency of 30 ms between the client and the server. The client sends "I want to move the racket down," and its racket is y = 100px at a speed of 0.1px / ms
30ms seconds later:
- the client racket is at y = 100 + 30 * 0.1 = 103px
- ( y = 100px )
20 . :
- y = 103 + 20 * 0,1 = 105px
- y = 100 + 20 * 0,1 = 102px
- (102px)
30ms :
- rarcket y = 105 + 30 * 0,1 = 108px
- positon racket: 102px
"" 108 102 ...
?
:
aproach , "". : , , , . , .
, "" . , . : ( ).
:
30 :
- y = 100 + 30 * 0,1 = 103px
- 30 ( ) y = 100 + * 0,1 = 100 + 30 * 0,1 = 103
Perfect! .
20 :
- y = 103 + 20 * 0,1 = 105px
30 :
- y = 105 + 30 * 0,1 = 108px
- (105px ), 30 y = 105 + * 0,1 = 105 * 30 * 0,1 = 108
!
Desync , . " ". , .
, .