Local-lag and Timewarp: Providing Consistency for Replicated Continuous Applications by Martin Mauve, Jurgen Vogel, Volker Hilt and Wolfgang Effelberg Irwin Chiu Hau Computer Science McGill 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 Drop Ace of Spades Drop Two of Spades send send 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 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 Train approaches a switch Train approaches a switch Pull switch Train turns right send Train passes the switch Switch pulled Inconsistency Train goes straight 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 case : t0 = t* At any site, operations are executed immediately once they have been received That leads to responsiveness Source: Local-lag and Timewarp 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-lag A number that would significantly reduce short-term inconsistencies ( 1ms for LAN, to 150ms for world-wide ) •Choose the highest acceptable response time A number that will not be noticeable by game players ( 80-100ms ) •Choose a value for local-lag Choose 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 game Source: Local-lag and Timewarp Players control a spaceship: Accelerate, decelerate, turn and shoot Comp763: Modern Computer Games Experiments Results Simulated Local lag Network Delay 0 ms 0-120 ms 160 ms 40-120 ms --140-240 ms Half of SND > 290 ms Half of SND Notice local lag no yes ------- Comp763: Modern Computer Games Notice odd behaviour no no no no yes Experiments Number of events: Increases linearly with number of users Increases linearly with network delay Time 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-Reckoning vs 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 ? Comp763: Modern Computer Games
© Copyright 2026 Paperzz