Irwin Chiu Hau Computer Science McGill University Winter 2004
-
Upload
sacha-hampton -
Category
Documents
-
view
26 -
download
0
description
Transcript of Irwin Chiu Hau Computer Science McGill University Winter 2004
![Page 1: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/1.jpg)
Comp763: Modern Computer Games
Local-lag and Timewarp:Providing Consistency for
Replicated Continuous Applicationsby
Martin Mauve, Jurgen Vogel, Volker Hilt and Wolfgang Effelberg
Irwin Chiu HauComputer ScienceMcGill University
Winter 2004
![Page 2: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/2.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 3: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/3.jpg)
Comp763: Modern Computer Games
Terminology
A Replicated Application is an•application that has its local states maintained by multiple application instances.
Domain Name Servers
Source:Irwin Chiu Hau
![Page 4: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/4.jpg)
Comp763: Modern Computer Games
Terminology
A Replicated Discreet Application is a•replicated application that has its states changing in response to user operations
Microsoft Hearts
Source:Irwin Chiu Hau
![Page 5: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/5.jpg)
Comp763: Modern Computer Games
Terminology
A Replicated Continuous Application is a•replicated application that has its states changing in response to time passage
UT2003
Source:http://www.unrealtournament.com
![Page 6: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/6.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 7: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/7.jpg)
Comp763: Modern Computer Games
Consistency
•What is CONSISTENCY?•Why is it so important?•Consistency in the Discrete Domain•Consistency in the Continuous Domain
![Page 8: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/8.jpg)
Comp763: Modern Computer Games
What is CONSISTENCY?
Definition from www.dictionary.com:
1. Agreement or logical coherence among things or parts 2. Reliability or uniformity of successive results or events
From what we have seen / heard so far
Acronyms:
• “Dead Man Shooting”
![Page 9: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/9.jpg)
Comp763: Modern Computer Games
Why is consistency so Important?
In games, CONSISTENCY could give us:
• Better aim
• Confidence
In games, INCONSISTENCY could make us:
• Fall into pits
• See “Dead Man Shooting”• FRUSTRATED
America’s Army
Source:http://www.americasarmy.com
![Page 10: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/10.jpg)
Comp763: Modern Computer Games
Consistency is Important
Consistency must be present in:• Replicated Discreet Applications
• Replicated Continuous Applications
This paper investigates how consistency can
be established!
![Page 11: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/11.jpg)
Comp763: Modern Computer Games
Consistency in the Discreet Domain
Consistency can be established by:• Finding the correct sequence of all operations that are
dependent of each other
• Making sure that every site executes the dependent operations in that particular sequential order
![Page 12: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/12.jpg)
Comp763: Modern Computer Games
Consistency in the Discreet Domain
Example: Hearts (card game)
Player 1 Player 2
send
Drop Ace of Spades
Drop Two of Spades
Inventory:
Ace of Hearts
Two of Hearts
Player 1 dropped Ace of Spades
Player 1 dropped Two of Spades
Player 1’s Inventory:
Ace of Hearts
Two of Hearts
send
![Page 13: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/13.jpg)
Comp763: Modern Computer Games
Consistency in the Continuous Domain
Consistency can be not established by only:• Reusing approaches for the discreet domain
Timing is critical !!
![Page 14: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/14.jpg)
Comp763: Modern Computer Games
Consistency in the Continuous Domain
Example: Train simulation
User 1 User 2
send
Train approaches a switch
Pull switch
Train turns right
Train approaches a switch
Train passes the switch
Switch pulled
Train goes straight
Inconsistency
![Page 15: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/15.jpg)
Comp763: Modern Computer Games
Consistency in the Continuous Domain
Solving consistency in continuous domain requires
in addition:• That the operations look as they had been executed at the
CORRECT POINT OF TIME
But first, we need to define what is:• Consistency • Correctness
![Page 16: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/16.jpg)
Comp763: Modern Computer Games
More Terminology
Definition of CONSISTENCY and CORRECTNESS
Let the reception function Ri be defined as
Ri(t, oj, t0, t*) = false oj, t0, t* received by i after t
true otherwise
Interpreted as: Ri return false if a given operation has been received
by site i after time t, true otherwise
oj, t0, t* : Operation that has been issued at site i at a time t0, with
t* being the time the operation is supposed to be executed
![Page 17: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/17.jpg)
Comp763: Modern Computer Games
More Terminology
Definition of CONSISTENCY in the continuous domain
So, a replicated continuous application ensures consistency iff
For all t, i, j | for all t* ≤ t, ow,t0,t* є O
Ri(t, ow, t0, t* ) Λ Rj(t, ow, t0, t*) => (si,j = sj,t)
Which means, at any time the state at any two sites i and j must be
the same, if both sites have received all the operation that are
supposed to be executed by time t
![Page 18: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/18.jpg)
Comp763: Modern Computer Games
More Terminology
Definition of CORRECTNESS
in the continuous domain• At any time t the state at any site i
must be the same as the state of the virtual perfect site P
• Provided that i has received all operations that are supposed to be executed before t
A Perfect Virtual Site P is a site that
receives all operations by the time they
should be executed
Source: Local-lag and Timewarp
![Page 19: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/19.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 20: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/20.jpg)
Comp763: Modern Computer Games
Local-lag
One solution to solve short term inconsistencies,
is to make use of the trade-off“Response time vs Short-term inconsistencies”•To lower responsiveness of an application•To minimize short-term consistencies
This concept is called LOCAL-LAG
![Page 21: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/21.jpg)
Comp763: Modern Computer Games
Responsiveness vs Inconsistency
Source: Local-lag and Timewarp
case : t0 = t*
At any site, operations are executed immediately once they have been received
That leads to responsiveness
![Page 22: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/22.jpg)
Comp763: Modern Computer Games
Responsiveness vs Inconsistency
case : t0 < t*
The operations are executed simultaneously by all the sites after a certain delay
This minimizes inconsistency
If response time exceed a certain threshold, players will notice lag
Source: Local-lag and Timewarp
![Page 23: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/23.jpg)
Comp763: Modern Computer Games
Responsiveness vs Inconsistency
Source: Local-lag and Timewarp
![Page 24: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/24.jpg)
Comp763: Modern Computer Games
Determining a value for Local-lag
•Choose the minimal value for local-lagA number that would significantly reduce short-terminconsistencies ( 1ms for LAN, to 150ms for world-wide )
•Choose the highest acceptable response timeA number that will not be noticeable by game players ( 80-100ms )
•Choose a value for local-lagChoose wisely between the values from above
![Page 25: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/25.jpg)
Comp763: Modern Computer Games
Overview
•Consistency•Local-lag•Timewarp•Experiments•Dead Reckoning•Conclusion
![Page 26: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/26.jpg)
Comp763: Modern Computer Games
Timewarp
• Local-lag does not eliminate all inconsistencies• We need a mechanism that repairs the state caused
by these issues
This Mechanism is called TIMEWARP:
• Maintains a list of operations and a list of states• Repairs the lists
![Page 27: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/27.jpg)
Comp763: Modern Computer Games
Timewarp
Timewarp ensures CORRECTNESS:• Proved by induction: At any site, all states that are
saved in the list of states are the same as the ones computed by the virtual perfect site P
Complexity:• Claimed to be O(n2), where n is the number of
participants in a session
![Page 28: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/28.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 29: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/29.jpg)
Comp763: Modern Computer Games
Experiments
A time warp game has been developed to:• Verify the theoretical observations• Show that local-lag and timewarp can be used in real
applications
Timewarp gameSource: Local-lag and Timewarp
Players control a spaceship:
Accelerate, decelerate, turn and shoot
![Page 30: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/30.jpg)
Comp763: Modern Computer Games
Experiments
Results
Simulated Network Delay
Local lag Notice local lag
Notice odd behaviour
0 ms 0-120 ms no no160 ms yes no
40-120 ms --- --- no140-240 ms Half of SND --- no> 290 ms Half of SND --- yes
![Page 31: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/31.jpg)
Comp763: Modern Computer Games
ExperimentsNumber of events: Increases linearly with number of
usersIncreases linearly with network
delayTime warp duration: O(n2) where n is the number of
players
Source: Local-lag and Timewarp
![Page 32: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/32.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 33: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/33.jpg)
Comp763: Modern Computer Games
Dead-Reckoningvs
Local-lag / Timewarp
Both provide consistency
Dead-Reckoning (prediction of objects’ behaviour)• Does not provide correctness• Complexity O(n)
Timewarp• Provides correctness• Complexity O(n2)
![Page 34: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/34.jpg)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
![Page 35: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/35.jpg)
Comp763: Modern Computer Games
Conclusion
Things to remember:
Local-lag minimizes short-term inconsistencies by:• Reducing the responsiveness of an application
Timewarp is an algorithm• Guarantees consistency• Provides correctness
![Page 36: Irwin Chiu Hau Computer Science McGill University Winter 2004](https://reader036.fdocuments.us/reader036/viewer/2022062314/568131f1550346895d985206/html5/thumbnails/36.jpg)
Comp763: Modern Computer Games
Questions ?