当前位置:网站首页>Various synchronous learning notes
Various synchronous learning notes
2022-06-25 08:32:00 【Jason? thirteen】
Frame synchronization
One sentence summary : The server only forwards , damage , The location is calculated by all clients ( In the same version ) Independent computing , If the code is correct , Then the calculation results will be consistent .
advantage : Reduce server pressure , High accuracy .
shortcoming : Long reconnection time , Easily out of sync ( The calculation results are inconsistent ), Floating point numbers cannot be used to calculate ( Floating point numbers may not be correct after being transmitted over the network , Even if the same machine is assigned floating-point numbers several times, it will be different ).
Some big guy's explanation :
Synchronize user events at each frame of the game , After broadcast by the server , Simulate state changes on each client . Since only user events are synchronized , So network The transmitted data block is relatively small , Synchronized and timely , very Suitable for fighting games This kind of game needs to do accurate simulation . And because only events, not States, are synchronized , therefore The data transmitted on the network has nothing to do with the number of objects in the game , Compare Suitable for games with more game units , Such as timely strategy game . For a single user , Because the network transmission is often unstable , Often affect the stability of simulation , This causes the rendering to jump (jitter). In order to deal with this problem , It tends to introduce The event buffer To smooth network transmission . But this affects the timeliness of the simulation . And because there is no state , So when it is necessary to disconnect and reconnect , Often because the client needs to complete all previous simulations again , therefore Longer reconnection time . For multiple users , Because for Keep everyone synchronized , It is often necessary to wait for the slowest client , Thus, the whole game is very vulnerable to the network delay of a single user . and Only synchronize Events , It is often difficult to prevent fraud . Of course, the most troublesome problem is to ensure the consistency of the client simulation , So this model is sometimes called Deterministic Lockstep. Including pseudo-random operations using the same random seed , Do not use floating-point arithmetic, etc . Usually, LAN games use this strategy . Age of Empires , Glory of Kings , And famous DOOM, All use this strategy .
Snapshot synchronization
I'm not sure about that .
Some big guy explained :
This is C/S The simplest synchronization strategy in the pattern . The client sends events to the server , After the server completes the simulation, it periodically synchronizes the snapshots of all States to the client . Because of all The simulation is on the server side , This strategy is easiest to use to prevent deception . And in this mode , All clients can be viewed as a state of the server terminal, So it is the easiest to implement . The best aspect is not affected by the network jitter of a single user , However, users with faster networks often have greater advantages . Because you want to synchronize the states of all GameObjects , Therefore, the data packets transmitted through the network are often large , Unable to achieve real-time synchronization . In order to cope with packet size , Some compressed coding methods are often required , such as Delta Encoding. In order to cope with the delay , You need to be right about snapshot Conduct Interpolation and Extrapolation. In order to ensure smooth motion in the game , Will use more complex difference algorithm , But it is often easy to appear unnatural . This strategy is usually used by The game status is relatively small , Games that do not require high real-time performance . Many are based on HTTP The game of agreement , All adopt this strategy .
State synchronization
This is the easiest strategy to think of and the most difficult to implement . Both the client and the server simulate state changes , After the client sends the event to the server , Forecast status changes locally . After the server receives the status , On the server Do the same simulation , then Pass the changed state back to the client . For objects that do not change , The client remains in its original state ( Moving or stationary ), For changed objects , The client is subject to the return of the server . There is often a delay in the status return of the server , therefore After the client receives the new status , Replay events after the synchronization point . The advantage is , Whether it's the content of the transmitted data 、 size , The frequency of synchronization can be adjusted , So we can find a good balance between the precision of simulation and the efficiency of simulation , And because in The client also performs simulation , Users often receive more timely feedback , And the experience is better . However, because the server side and the client side should run the same simulation , Therefore, there is also the problem of two terminal synchronization . Last , In fact, the above agreement , Just let the player's status synchronize . The key to real-time performance lies in the network , So in order to approach real time , Need to minimize network latency , Including reducing the amount of data transferred , Use UDP To avoid TCP The retransmission Problems, etc. . In addition, in order to make the player's actions feel like real-time synchronization , Often rely on local Extrapolation.
边栏推荐
- Find out the possible memory leaks caused by the handler and the solutions
- Establish open data set standards and enable AI engineering implementation
- 开户券商怎么选择?在线开户是安全么?
- 想要软件测试效果好,搭建好测试环境是前提
- First experience Amazon Neptune, a fully managed map database
- What is the role of software validation testing? What is the price of the confirmation test report?
- TCP MIN_ A dialectical study of RTO
- Rqt command
- LeetCode_ Hash table_ Medium_ 454. adding four numbers II
- Super simple case: how to do hierarchical chi square test?
猜你喜欢
Daily question brushing record (III)
Scanpy (VII) spatial data analysis based on scanorama integrated scrna seq
How to calculate critical weight indicators?
The era of enterprise full cloud -- the future of cloud database
面试前准备好这些,Offer拿到手软,将军不打无准备的仗
InfluxDB时序数据库
Stack awareness - stack overflow instance (ret2libc)
420 sequence traversal of binary tree 2 (429. sequence traversal of n-ary tree, 515. find the maximum value in each tree row, 116. fill in the next right node pointer of each node, 104. maximum depth
初识生成对抗网络(11)——利用Pytorch搭建WGAN生成手写数字
How to do factor analysis? Why should data be standardized?
随机推荐
Is it safe to open an account online? Xiaobai asks for guidance
是否可以给数据库表授予删除列对象的权限?为什么?
What do various optimizers SGD, adagrad, Adam and lbfgs do?
4 reasons for adopting "safe left shift"
Biweekly investment and financial report: capital ambush Web3 infrastructure
以科技赋能设计之美,vivo携手知名美院打造“产学研”计划
【强化学习笔记】强化学习中的常见符号
[thesis study] vqmivc
How to calculate the distance between texts: WMD
How to calculate the D value and W value of statistics in normality test?
Unity addressable batch management
What is SKU and SPU? What is the difference between SKU and SPU
Unity Addressable批量管理
Is the securities account given by Qiantang education business school safe? Can I open an account?
Data-centric vs. Model-centric. The Answer is Clear!
Internet of things (intelligent irrigation system - Android end)
Go语言学习教程(十三)
Stm32cubemx Learning (5) Input capture Experiment
Measure the current temperature
Is there no risk in the security of new bonds