Realtime multiplayer games on the web
The technology is already here!
- Game pad API
But why is almost no one writing them?
Online multiplayer games are hard to implement
Graphics + Distributed Systems = Hard problems
Multiplayer games as distributed replicas
Multiple machines, one shared state
Issues in distributed systems
Byzantine failures (aka cheating)
Players are intelligent and malicious agents
Use client-server, one master replica
Cynical Bonus: Scarcity + Control = $$$
Peer-to-peer RAFT/PAXOS (?)
Simple estimate for games:
B = k n2
- B = consumed bandwidth
- k = input rate
- n = number of players
Assume n small (don't make an MMO!)
Region of interest management, throttling
Consequence of physics
Don't make a realtime multiplayer game
Tradeoffs, subject of this talk!
Replication and consistency
Consistency models determine replication algorithms
- Easier to reason about, less non-determinism
- Requires more coordination, latency
- Harder to reason about, bugs
- Less coordination, lower latency
Enforce strict linearizability
All players barrier synchronize each tick
- Strongest possible model of consistency
- All players see same sequence of events
- Input lag >= slowest RTT in network
- Not robust to failures (eg desync bugs, players drop)
Apply inputs immediately
Predict remote events
Dead-reckoning with no correction
Dead-reckoning with corrections
Dead-reckoning with severe lag
- No network lag on local input
- Prediction doesn't always work
- Correction expensive
- Visual glitches
Cheating the system
Players can defer actions by artificial lag
Gives advantage by increasing reaction time
But other players will still see consistent view of events...
What does this look like?
J. Smed, H. Niinisalo, H. Hakonen. (2004) "Realizing bullet time effects in multiplayer games with local perception filters"
Thanks for listening!
Multibody physics doesn't really work with special relativity
Lorentz invariance or Newton's 3rd law: Pick 1
System is either acausal or unstable