当前位置:网站首页>State synchronization and frame synchronization
State synchronization and frame synchronization
2022-04-23 07:44:00 【0zien0】
Sync , In fact, let all clients see the same content , for instance : Glory of Kings ,5V5 when , When a player A Released a skill ,10 Players ( Include A) You should be able to see players synchronously on your mobile screen A Released skills . So let's say , It generally refers to online games , Players see the same thing on their respective devices . And stand-alone games , Play your own , Basically no synchronization is required . The mainstream synchronization methods are generally state synchronization and frame synchronization .
One . Realization principle :
State synchronization :
The client sends operation instructions to the server , After receiving the instruction, the server performs logical processing , Return the final processing result to the client . Then the client returns the result according to the server , Just play the corresponding effect locally .
Such as :A Click the skill button ( Release a skill attack B), Then the client will send the message of using skills to the server , The server will process this message , Is it enough ” blue “ Put skills , Skills are right for B How much damage is done ,B Death or not , And so on , The results will eventually be returned to all players , Then on all players' devices ( client ) Will play skill release effects ,B Hit animation , then B The effect of deducting blood floating words and so on .
Frame synchronization :
The client sends instructions to the server , The server does nothing to forward instructions to all clients , Then, after all clients receive the instruction, they will execute logical processing locally , Then play the effect .
Two . Comparison of advantages and disadvantages :
1. Server pressure
State synchronization : Because the logical operation is on the server , Relatively speaking, the pressure will be relatively high .
Frame synchronization : No server pressure .
2. Logical consistency
State synchronization : Unified computing on the server , Absolutely consistent .
Frame synchronization : It takes a lot of effort to ensure consistency . Such as : Accept the random factor sent by the server at the beginning of the battle , To ensure that the random results of all clients are consistent . Try to avoid decimal point operation , To ensure that the calculation results on different devices will have errors, etc .
3. Break line reconnection :
State synchronization : It's easier to achieve , Because when reconnecting , The real-time data of the current round is on the server , The server only needs to send the data of the current server to the client , You can directly present the current combat interface state .
Frame synchronization : Because the server only has all the operation steps of the client , When reconnecting , You may need to start with the first step , Until this step of the current game progress , To restore the state of the whole combat interface .
4. Battle replay :
State synchronization : You need to record and save all the status information sent to the client , The quantity saved is relatively large .
Frame synchronization : Just save the operation records forwarded to the client , Playback implementation is more convenient .
5. Data volume :
State synchronization : More , Because the server needs to process all player States after logic , The processing results are sent to the client .
Frame synchronization : less , Just forward the operation instructions .
6. Network delay :
State synchronization : It can be pre expressed , Make players look relatively less stuck , Flow a little .
Frame synchronization : The whole game will be stuck , Poor effect .
7. anti-cheating :
State synchronization : It's simpler , Because the core computing logic is on the server , Even if the player modifies the client , Can only change his local display effect .
Frame synchronization : More difficult , Because the logical processing is performed locally on the client . However, the results can also be verified by some means , Such as : Verify the consistency of the results of all players , If a player cheats , Raised his attack , Then the player's client will show that a knife killed the other party , Other clients show that the other party is only normal blood deduction and does not die , This can also verify that the player's client exception . But there are also some cheating behaviors that are difficult to effectively stop , Such as : Show full map , All player positions, etc
8. Development efficiency :
State synchronization : The client server needs to be clear about the requirements , Co produce , Joint commissioning, etc ( There is more communication cost ). But because many games have battles PVE part , So in fact, there can be a client to uniformly develop the combat system , Single combat and networked combat use the same set of combat codes , This can save communication costs , However, you also need to add some special processing code related to the client or server .
Frame synchronization : The server is only responsible for forwarding , All code has client-side development ( No communication costs ), But also pay attention to ” Anti crack “,” Uniqueness of code execution results “,” Separation of logic and expression “ And so on .
9. Applicable scenario
State synchronization : Applicable to almost all games .
Frame synchronization : Not applicable to games with too many players ( High bandwidth ); Not suitable for large maps MMO game , Because in the game of super map , The client only has the data of this part of the area displayed by the current mobile phone , Other data of the map exists in the server , The client does not have all the data and cannot do logical processing .
PS: Most games can use two synchronization methods , Which is more suitable for , We need to consider the type of game 、 Combat mode 、 network bandwidth 、 Delay response 、 anti-cheating 、 Development cycle and other factors to choose different schemes , Even a mixture of the two , There is no best technology , Only the most appropriate technology . So which way to use can only depend on the specific needs of the project .
-------------------------------------------- Little knowledge -------------------------------------------
1. Early frame synchronization , The server will wait to receive all players' keyframe messages , Will be forwarded to all players , Cause a player to get stuck , All players are stuck , A terrible game experience when they all stop . Now the frame synchronization adopts ” Optimistic frame “, The server forwards the received message sent by the client to other clients at a fixed time interval , The one who doesn't wait for the card . In this way, only the player with the card will be stuck , Other normal network players play games normally , The experience is much better .
版权声明
本文为[0zien0]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623293227.html
边栏推荐
- 7. sub query
- SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
- 层次输出二叉树
- 反思 | 事件总线的局限性,组件化开发流程中通信机制的设计与实现
- 刨根问底---cocos2d源码的理解与分析
- Mvcc (multi version concurrency control)
- Reflection on the systematic design of Android audio and video caching mechanism
- [hdu6833]A Very Easy Math Problem(莫比乌斯反演)
- 安装配置淘宝镜像npm(cnpm)
- 超级宝典&编程指南(红蓝宝书)-读书笔记
猜你喜欢

Reflection on the systematic design of Android audio and video caching mechanism

对js中argumens的简单理解

SAP PI/PO登录使用及基本功能简介

SAP PI/PO rfc2RESTful 發布rfc接口為RESTful示例(Proxy間接法)

King glory - unity learning journey

超级宝典&编程指南(红蓝宝书)-读书笔记

js之预解析

Design optimization of MySQL database

How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)

redis连接出错 ERR AUTH <password> called without any password configured for the default user.
随机推荐
页面动态显示时间(升级版)
Moment.js中format方法函数的格式
int a = 1存放在哪
数论分块(整除分块)
9.常用函数
js之预解析
页面实时显示当前时间
面经的总结
SAP TRANSLATE使用数据对象掩码示例
常用的DOS命令
Processing of common dependency module
MySQL storage engine
js之作用域、作用域链、全局变量和局部变量
ABAP CDS VIEW WITH ASSOCIATION示例
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
canvas学习第一篇
游戏辅助脚本开发之旅
js之自定义属性以及H5中如何判断自定义属性
[self motivation series] you'll never be ready
5. Sql99 standard: internal connection and external connection