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

边栏推荐
- 检测点是否在多边形内
- 家庭服务器门户Easy-Gate
- 测一测现在的温度
- 第五天 脚本与UI系统
- 417 sequence traversal of binary tree 1 (102. sequence traversal of binary tree, 107. level traversal of binary tree II, 199. right view of binary tree, 637. layer average of binary tree)
- Go language learning tutorial (13)
- Almost taken away by this wave of handler interview cannons~
- Common action types
- [QT] qtcreator shortcut key and QML introduction
- UEFI:修复 EFI/GPT Bootloader
猜你喜欢

Incluxdb time series database
![[thesis study] vqmivc](/img/38/a97ac763a7d6e71d4c7340c7abb6e7.png)
[thesis study] vqmivc

面试前准备好这些,Offer拿到手软,将军不打无准备的仗

【操作教程】TSINGSEE青犀视频平台如何将旧数据库导入到新数据库?

Use pytorch to build mobilenetv2 and learn and train based on migration

What are the indicators of VIKOR compromise?

Biweekly investment and financial report: capital ambush Web3 infrastructure

What are the indicators of entropy weight TOPSIS method?

Paper:Generating Hierarchical Explanations on Text Classification via Feature Interaction Detection

【515. 在每个树行中找最大值】
随机推荐
Is there any risk in the security of new bonds
[thesis study] vqmivc
SharePoint:SharePoint Server 2013 与 ADRMS 集成指南
Can I grant database tables permission to delete column objects? Why?
测一测现在的温度
Stack awareness - stack overflow instance (ret2libc)
How to calculate the positive and negative ideal solution and the positive and negative ideal distance in TOPSIS method?
leetcode.13 --- 罗马数字转整数
Scanpy(七)基于scanorama整合scRNA-seq实现空间数据分析
Internet of things (intelligent irrigation system - Android end)
Day 5 script and UI System
The difference between personal domain name and enterprise domain name
Find out the possible memory leaks caused by the handler and the solutions
股票网上开户安全吗?小白求指导
Is it safe to open an account online? Xiaobai asks for guidance
What is SKU and SPU? What is the difference between SKU and SPU
With the beauty of technology enabled design, vivo cooperates with well-known art institutes to create the "industry university research" plan
打新债安不安全 有风险吗
Is there no risk in the security of new bonds
Common action types