Network synchronization explore about the game

Find the information, that later update

Famous gaming network synchronization scheme Summary


The following table shows the network synchronization programs of the famous game of my summary, we have been trying to add a reference source.
With this table, the reader can try to think: Why would they take such a scheme? Look around to see whether what the law? I believe after reading below, should be able to find out.
Note, herein lockstep synchronization (Lockstep) specific to only deterministic lockstep synchronization synchronization (Deterministic Lockstep). This article does not discuss snapshot synchronization (Snapshot Synchronization, Snapshot Interpolation), which is equivalent to that the synchronization state (State Synchronization).

Network transport protocol (Network Transport Protocol)


Article network transport protocol (Network Transport Protocol), mainly refers to the UDP protocol and TCP protocol.
In the TCP / IP protocol suite (Internet protocol suite, Internet Protocol Suite) in, UDP and TCP transport layer is located (Transport Layer), independently Talia more dependent on the IP protocol layer of the bottom layer interconnection network (Internet Layer) of (Internet protocol, Internet protocol).


Berkeley sockets (Berkeley Sockets) is a standard API TCP or UDP communication, belonging to the POSIX standard, so Socket, Berkeley Socket, POSIX Socket, BSD Socket, all referring to the same thing.
Through the Socket class and its methods can be very simple TCP or UDP communication.

 

UDP over the IP, the concept of increasing the port (Port), the transceiver can both good agreement so that several ports to communicate different functions; checksum increased in order to increase the ability of certain check.
So you could see that UDP for network games, and IP are almost similar features:

    • Does not guarantee reliable transmission sequence (Unsequenced Unreliable Transmission), namely transmission order can not be maintained, not up to ensure, in the course of a particular packet transmission, is likely lost; it may packet arrives, but the data error thus the verification fails, it is discarded Socket,
    • Transmission speed , thanks to the unreliable, so the Socket will not waste time and bandwidth, the lost packet retransmission
    • Application packets over UDP Socket ensure success is to get the right
    • Fast connection, because there is no connection. Thanks unreliable, so the sending and receiving sides each communication are stateless, so no need to establish a connection before communication
    • Simple, upper-demand applications can achieve additional transmission characteristics (QoS), such as order-preserving unreliable, reliable order can not be maintained, reliable protection order, the latest state transfer (Most Recent State), fast redundant transmission (Quickest Possible Delivery), Wait,
    • Small header, saving bandwidth
       
  • In addition there are ports, external verification, TCP provides major additional:
    • Guarantee reliable transmission order (Sequenced Reliable Transmission), achieved by a header Sequence number, Acknowledgement Number, Window Size field and the like,
    • Flow Control (Flow Control), header by Window Size achieve the recipient to his expectations traffic presented to the sender, the sender transmits data to prevent excessive speed to a recipient
    • Congestion Control (Congestion Control), header by Sequence number, Acknowledgement number and other fields, as well as mechanisms to achieve by Timer, whereby both parties can send and receive data to determine packet loss, and deduce whether the current network congestion, and take some measures to mitigate data send.

    TCP itself is complex enough, we did not closer look at their specific principles, features only briefly and synchronization-related online games:

    • Paul sequence itself provides reliable transmission, no game for extra work, it is suitable for turn-based games, RPG and other communication frequency is not high type of game
    • Slow transmission , TCP itself because of all packets sent, are considered reliable protection order, flow control, congestion control (includes slow start (Slow-Start), and these types of functions for most of the game, especially fast-paced ( Fast Paced) game is not suitable, since this type of game the high frequency communications, require low latency communications, new hair may be more important than the data packet sent the data packet (packet data such as a game status, a game state changes frequently, their old state retransmission data packet, it would be discarded, a new state quickly transmitted packets),
    • Slow connection, communication needs to be the first time the famous three-way handshake connection,
    • Black Box is complex and difficult expansion,
    • Header large, does not apply to the case where the number of data packets
    In summary, most of the online games using UDP.
    TCP is more suitable for turn-based and other slow-paced games, such as furnace slag legends.
    Another World of Warcraft uses TCP, and made a brilliant commercial success, so there are many MMORPG also use TCP, nevertheless, TCP might not be the best choice. [9]

Network synchronization model (Network Model)


The main network model are: lock-step synchronization (Lockstep) and state synchronization (State Synchronization) .
Paper "frame" in the following two terms are defined:
logical frame , will be referred to herein as Tick, the game process is discrete logic level, i.e. a logical frame may be considered a logical frame performs a logical operation, a logical frame number It refers to the game logic levels currently in the first few frames;
rendered frame , known as frame in this article will, in the game screen showing the level is discrete process, which can be considered to be a picture of the picture presented to the player, rendering frame numbers refer to the game pieces of the current picture is the first presentation;
logical frame rate and frame rate of the game is rendered independent of one another, such as a game logic may be 20 frames per second, 60 frames per second rendering.


Game logic is a logical frame a logical frame lasts discrete carried out, can be abstracted as:
[official]
,

In the first game [official]when the logical frame, based on the player information [official]and game configuration [official], initialization operation [official], initialization state set obtained [official],

In the first game [official]when the logical frame, according to a previous set of states [official]and the game configuration [official], according to the [official]set of external causes changes to the frame received [official], the logical [official]operation results of [official]logical frame of the new game state sets [official].

 

[official]It is a collection of the root causes of the game state changes, often each player operation.
[official]Game state is set by the state number of subsets, wherein there are two important subsets of the following definitions,

[official]

Wherein [official]some of the player-object can be clearly observed in the set of states [official]for some of the intermediate state it can be used to derive the final set state.

When the network synchronization, said process information sent from the client network for transmitting uplink , said network clients over the course of transmission information received is a downlink , then,

Lockstep synchronization general nature is, the vertical line contains only external reasons set changes the game [official],
the nature of the general state of synchronization is, only the results of the downlink status of the game comprising a set of calculation results [official](more precisely, a subset of the state [official]), comprising an uplink [official]and / or a subset of the state [official].


Note lockstep herein refers specifically to synchronous deterministic synchronization lock-step synchronization only (Deterministic Lockstep). This article does not discuss snapshot synchronization (Snapshot Synchronization, Snapshot Interpolation), which is equivalent to that state synchronization.


A brief history of network synchronization model


In the 1990s it has been carried out to stop waiting for (stop-and-wait-type ) network synchronization method for each step (step, turn), that is, the client step by step to put their information to other clients, this information can be the state of the local network client objects, or may be operated by the player [13] [14].
Over the same period, P2P (see below network topology a) is connected to the network topology is more prevalent. But stop waiting for synchronization program P2P has lookahead-cheating type of plug-in, such as the use of plug-in client A at the step k deliberately wait until someone else to step k information arrives, only to perform logical operations and send their first k further information, equal after the game the decision-making of others before making their own decisions, to derive an unfair benefit upper hand client a is always peeping.
So, in 2001, Nathaniel Baughman and Brian Neil Levine on this basis, the proposed lock-step synchronization (Lockstep) [14] against the plug. All before sending each client plaintext k-th step, to encrypt plaintext for generating information calculation "pre-submitted hash value (commitment hash)" sent to other clients, until the client receives the first step k after the client a hash of the pre-end, before sending a clear message to the step k their other clients, until the receipt of any other step k plaintext client, the client is a plaintext hash value generated by one of these plaintext message and pre-commit and compare the hash value, the hash value of the plaintext if found to client B and pre-filed hash value range, it represents the client B is a plug.
At this point, lock step synchronization client is both can synchronize player operation, the client can synchronize network object authority also states. So it does not require certainty.
Then, it is also 2001, Mark Terrano and Paul Bettner in Age of Empires (Age of Empire) game in order to solve the problem of the game massive network entity, based on lock-step synchronization, lodge a deterministic lockstep synchronization (Deterministic Lockstep) [ 15], i.e., each step of synchronizing, with only a player operation data, the network does not contain object data.


Further, in 1999, Christophe Diot and Laurent Gautier proposed Bucket Synchronization [13], i.e., the fixed time duration (approximately 40ms) is divided into Bucket, the data in the duration attributed to the Bucket. It has a longer playing time delay (Playout Delay, about 100ms) at the beginning, waiting for the other clients transmit data arrive Bucket. Data did not arrive in time will not be applied directly, but can also be saved for extrapolation (Extrapolation) such as dead reckoning (Dead Reckoning) may occur.
Which Bucket, i.e. in fact the concept of logical frames (the Tick) a.

 

Finally, in 2003, Ho Lee, who conducted the above-mentioned lock-step synchronization for each step of the delay are major disadvantages optimization, learn Bucket Synchronization, proposed Pipelined Lockstep [16].
At this point, it is understood by everyone: the synchronous operation without waiting for the uncertainty lock-step synchronization operation timeout players, finally forming.


All in all, every step to stop waiting for network synchronization very early, but the lack of a short name. In order to "Lockstep" program proposed the use of a wide range of security, it has become synonymous with synchronized stop waiting. When translated into Chinese, introduced the concept of Bucket Synchronization time frame and Lockstep also been used in combination, it puts a "step" translated frame, called "frame sync." Then more narrowly deterministic synchronous lock-step with more and more, we all gradually "Deterministic Lockstep" referred to as "Lockstep", therefore, uncertainty in lock-step synchronization verbal communication is more often referred to as "frame synchronization" sometimes referred to as "synchronous operation."
Therefore, this article also the uncertainty of lock-step synchronization referred to as lock-step synchronization.


Lockstep synchronization (Lockstep)


Because of lock-step synchronization only synchronizes changes [official], so the requirements of each client arithmetic logic [official], [official]is strictly deterministic (Deterministic), and all clients to work out strict consistent results [official]. If you include a hint of uncertainty in the calculation process, which will lead to each client computing [official]a hint of error, then the next logical frame error will increase, leading to the butterfly effect, which ultimately saw each client the result is completely different state.
When the game known as the king of glory lockstep example, suppose your client and other clients correct inconsistency has occurred, reasonable operation of other players in the correct client made, you have to reach an inconsistent state of the client to do the logical calculus has changed Debu same state results, the result is likely to be unreasonable, so you are likely to see other players heroes are surprised to run around, and even went to the tower to die, or put in front of air skills, and so on.
Game to be strictly deterministic, must do a few things:

  • Without using floating point numbers using fixed-point, or define each client hardware and the operating system is running so that the floating-point operation is the same,
  • Deterministic random number mechanism,
  • Deterministic algorithms and containers (adding, removing, sorting, etc.),
  • And packing logic isolation layer to prevent calls to other uncertainties,
  • For, it is also required to achieve deterministic physical mechanisms, navigation mechanisms, skeletal animation mechanisms,
  • All logical investigation causes abnormal (Exception) of

Lock-step synchronization of games, cause of sync gaming experience is very poor, even now out of sync problem is very troublesome, so the development pipeline flow detection is not synchronized lock-step synchronization is crucial game , such as a frame that the hash comparison, static code scanning analysis, even a frame level performance level log function, the external network is not synchronized rate statistics, and the like.


Synchronous state (State Synchronization)


Since only the synchronization state synchronization operation state of the game results obtained [official], it is necessary to have the state machine authority (Authoritative) is calculated, and transferred to another machine, the other machine will adopt the received status.
This article discusses only the case of only one of the machines authority. Depending on the specific network topology, this machine will be known as the authoritative server (Server) or host (Host), no authority other machine called a client (Client).
Therefore, synchronization status, verbal communications often less accurately referred to as "CS synchronization (Client-Server)".


Including Halo, Unreal, Unity, Overwatch and so on, almost all the famous state synchronization technology, are the ultimate reference to Mark Frohnmayer and Tim Gift released in 1998 at The Tribes Networking Engine Model [1] article for implementation.


State synchronization process of developing the most basic and most important, regardless of the client network object is currently in what state, it must be done correctly completely out of the old state, not logic layer residual effect after the exit of the old state, and correctly in the new state authoritative server informed, leading to the logical layer effect of the new state.
Also avoid non-state synchronous mode synchronization state authority, such as a server only transmits [official]to the client (without transport [official]), allowing the client to calculate a new state of the network object locally [official]. This may lead to an inconsistent state between server client. For example, a network object at the k happened a logical frame [official]to enter [official], and then [official]are no longer changed, then only the first server [official]will send frame [official]; if a client because after reconnection or real-time replay and other causes of death lead to the network object status is reset to the client [official], but the current frame is greater than the logical server [official], the server will no longer transmit Ik to the client, then the client network object where it mistakenly remained at [official]the.


Before lock-step synchronization to discuss certainty refers to the "strict" certainty. Synchronization, occasionally referred to "relaxed" uncertainties (such as the last question [4] Q / A phase) in the state of the discussion, such uncertainty between the client only requires the server to meet the "enough" is determined resistance, so that the client can be pre-performance can be more accurately, because in the end the client will adopt the status of the server, the cumulative correction of errors.

 

Original https://zhuanlan.zhihu.com/p/56923109

Guess you like

Origin www.cnblogs.com/dragon2012/p/11903515.html