This document discusses synchronization techniques for multiplayer games. It begins by distinguishing between synchronous and asynchronous games. For asynchronous games, it recommends using an authoritative server model with remote procedure calls and regular state comparisons. It then discusses challenges with real-time games, such as network latency, and proposes solutions like input caching, prediction, and state synchronization to address latency issues. The document notes pros and cons of the predictive approach, such as increased processing but ability to work on a wide range of network qualities.
5. Synchronous and asynchronous
If the attainment of a win
as a part of a loop
depends on the actions
of more than one player,
•that loop is synchronous;
•if not, it is asynchronous.
6. Step 1: Turn-based games
Synchronization:
• once a turn (on commit);
• network latency does not matter;
• race conditions do matter.
7. Remote Procedure Call (RPC)
Send action, reliably, with turn number.
Return nothing on success.
15. Step 3: Predictive RT
When the game turn duration is way shorter than network
latency, the network messages never gets to the remote in
time
Server
Client
A
A
B
B
C
C
22. Prediction issues
• Make sure your logic is “prediction-aware”.
No irreversible actions should be done, e.g. object should
not be actually destroyed a while after their “visual death”.
• Make sure your FX logic is “prediction-aware”.
Some action may happen several times in one frame just
because of prediction.
23. Pros and Cons
Pros:
• is working on a wide range of
network qualities
• load depends on actual
prediction duration (low load
on low-latency networks)
• high security
• moderate server load
• almost out-of-the-box replays
Cons:
• prediction requires relatively
large amount processing time
(a bunch of “frame” amounts)
• load depends on actual
prediction duration (high load
on high-latency networks)
• does not work for synchronous
multiplayer games
• quite hard to implement
• horribly hard to debug
• require predictable and
synchronizable random
numbers