comp763: modern computer games local-lag and timewarp: providing consistency for replicated...
TRANSCRIPT
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
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
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
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
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
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
Comp763: Modern Computer Games
Consistency
•What is CONSISTENCY?•Why is it so important?•Consistency in the Discrete Domain•Consistency in the Continuous Domain
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”
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
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!
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
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
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 !!
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
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
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
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
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
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
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
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
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
Comp763: Modern Computer Games
Responsiveness vs Inconsistency
Source: Local-lag and Timewarp
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
Comp763: Modern Computer Games
Overview
•Consistency•Local-lag•Timewarp•Experiments•Dead Reckoning•Conclusion
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
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
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
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
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
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
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
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)
Comp763: Modern Computer Games
Overview
• Consistency• Local-lag• Timewarp• Experiments• Dead Reckoning• Conclusion
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
Comp763: Modern Computer Games
Questions ?