How Counterstrike Works
(it’s about time)
Copyright © 2018
Chris Colohan
How does it work?
?
Client-server model
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
LAG
When is now?
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Time
Input
Now
Server
Now
Display
Now
Latency (lag)
Speculation
Time
Execution
if()
Now
if()
if()
if()
if()
Speculation
Time
Execution
if()
Now
if()
if()
if()
if()
Speculation
Time
Execution
if()
Now
if()
if()
if()
if()
if()
Speculation
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Time
Display
Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
4
P1:3,1,4�P2:1,5,9
B1:2,6,5
5
P1:3,1,4�P2:1,5,9
B1:2,6,5
6
Input
Now
Speculative
Display
Now
Speculative
Display
Now
Speculative
Display
Now
Speculative
Display
Now
Speculative
Display
Now
Speculative
Display
Now
Speculative Display and Input Now
Speculation
Display
Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Time
Display
Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
4
P1:3,1,4�P2:1,5,9
B1:2,6,5
5
P1:3,1,4�P2:1,5,9
B1:2,6,5
6
Speculative Display and Input Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Display
Now
Display
Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
4’
P1:3,1,4�P2:1,5,9
B1:2,6,5
5’
P1:3,1,4�P2:1,5,9
B1:2,6,5
6’
Display
Now
Speculative Display and Input Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
4
Display
Now
Progress
What about the enemy?
Lag compensation
Server side:
That’s It!
Shot by a ghost! (Server perspective)
Shot by player you never saw,
through a wall!
Shot by a ghost! (Shooter perspective)
Einstein’s theory of relativity
applies to CSGO?
Consistency is Good!
Predicting the future?
Predicting the future?
AI
Side-channel improves prediction
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
The Hard Parts
Time
Display
Now
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
4
P1:3,1,4�P2:1,5,9
B1:2,6,5
5
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
6
Speculative Display and Input Now
Is it fresh?
How new?
P1:3,1,4�P2:1,5,9
B1:2,6,5
4’
P1:3,1,4�P2:1,5,9
B1:2,6,5
5’
P1:3,1,4�P2:1,5,9
B1:2,6,5
6’
Broadcast Keystrokes Everywhere
Problems:
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Use Time of Day
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
Clocks are Hard
Sequence numbers
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
P1:3,1,4�P2:1,5,9
B1:2,6,5
3
P1:3,1,4�P2:1,5,9
B1:2,6,5
2
P1:3,1,4�P2:1,5,9
B1:2,6,5
1
4
5
6
7
8
9
5
4
6
7
8
4
5
6
7
8
9
4
5
6
7
8
0
1
2
1
3
3
3
3
0
1
2
1
Can we do better?
Want More?
Useful articles:
�Read up on: