当前位置:网站首页>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.

边栏推荐
猜你喜欢

以科技赋能设计之美,vivo携手知名美院打造“产学研”计划

How to calculate the independence weight index?

Stm32cubemx learning (5) input capture experiment

关于I/O——内存与CPU与磁盘之间的关系

Software engineering review questions

Prepare these before the interview. The offer is soft. The general will not fight unprepared battles

Day 5 script and UI System

Data-centric vs. Model-centric. The Answer is Clear!

浏览器查看当前页面所有的监听事件

检测点是否在多边形内
随机推荐
故障:Outlook 收发邮件时的 0x800CCC1A 错误
Incluxdb time series database
Unity Addressable批量管理
VOCALOID notes
股票网上开户安全吗?小白求指导
Wechat applet opening customer service message function development
《树莓派项目实战》第五节 使用Nokia 5110液晶屏显示Hello World
What is SKU and SPU? What is the difference between SKU and SPU
Rqt command
Establish open data set standards and enable AI engineering implementation
A solution to slow startup of Anaconda navigator
Problems caused by Gil problems and Solutions
CVPR 2022 oral 2D images become realistic 3D objects in seconds
软件测试月薪10K如何涨到30K,只有自动化测试能做到
Self made ramp, but it really smells good
Can I grant database tables permission to delete column objects? Why?
Index analysis of DEMATEL model
Sampling strategy and decoding strategy based on seq2seq text generation
What do various optimizers SGD, adagrad, Adam and lbfgs do?
[unexpected token o in JSON at position 1 causes and solutions]