[Turn] Frame synchronization and state synchronization

Reprinted from: http://www.gameres.com/489361.html

Tencent released two MOBA games at once, National Super God and King Glory. I played it and the effect was good. I analyzed some of its underlying technologies and found that one is the state synchronization and TCP protocol used, and the other is the frame used. Synchronous, UDP protocol. Since I learned about the technology of instant game frame synchronization last year, I have been paying attention to the games that use this technology, but I have never found it, although our own games also use frame synchronization, after all, it has not been launched yet, and now there are online games with frame synchronization , the effect is quite good, a little excited. So I wrote this article and shared it with everyone.

  Let’s talk about some digression first, sigh with emotion, and skip it directly if you are not interested.

  Having been playing games for so many years, I deeply know that the success of a game requires many factors, not only people and people, but sometimes the right time and place, but as a game developer, it is people and people who can decide. The basis for the success of a game is to have a group of people who can devote themselves to developing a game, constantly polish and even adjust the direction, timely feedback and iterate on problems, just like making an Internet product, in this process, the team Everyone in the store can trust each other and make changes to the product without hesitation. The source of trust every time is not for everyone, but for real data analysis and rational decision-making after trying to summarize the reasons. If you can insist on the above, let’s not talk about innovation, at least games can achieve the ultimate in a certain category. I think in any market environment, as long as this category is not dead, there will always be a place for you. In my opinion, there are many The game is dead. Many reasons are that the work is not in place. There are many games that copied COC from the past, but none of them were successful in the end. As of now, the profit of COC is still rising. If domestic plagiarists can really achieve COC The same experience, I think there will be success.

  Then someone wants to say, how can we do better than others? This problem is really complicated. I feel that there must be a suitable person first. What is a suitable person? From three aspects: responsibility, enthusiasm, Learning ability, ability, I put ability last because if the first two conditions are met, this person will definitely become able, and then there is a need for high requirements, the goal is quality, this is not just talk That’s it. From planning and design, program implementation, and art to the highest standards, they must be better than those on the market, and there will never be any compromises for various other factors (time point, implementation complexity). In the end, you need a little patience, arrange the planning time reasonably, and complete it efficiently. In fact, this is the most difficult thing. There are many people in the team. Sometimes game production often needs to be repeated. In the later stage (especially when the project encounters difficulties), it is relatively lax. If it is impatient people, it is estimated that it is a problem to continue working together, how to talk about the previous things. The team needs to be polished. If you have such a team, you must really cherish it.

  Well, these are some of my feelings about game development. Let’s get back to the point. For a game, battle is the soul. I have been involved in the development of a lot of games, many of which involved the whole process from decision-making to death, and I am deeply moved. From PC games to web games, from web games to mobile games, when every new market opportunity emerges, you can make money with your eyes closed to most of you can't make too much money, and the requirements for game development technology are getting more and more. High, but the time for each market to mature has been greatly shortened. For the battle, many of them are planned brain supplements that are completely different from the actual ones. Many reasons are that the selection of the battle plan is wrong.

  From a procedural point of view, I classify combat from two dimensions:

  1. From the operation mode, it is divided into round operation and instant operation.

  2. From the perspective of interaction, it is divided into offline battles and online battles. This place needs to be explained. Although some games can also attack others, such as COC, because of the battle, another person cannot operate, similar to this kind of battle. Can be called offline combat.

  Basically, all battles are a combination of the above two methods to some extent. For example, Fantasy Westward Journey can be considered as a network battle and round operation type.

  The recently popular national super god, the glory of the king, belongs to the (online battle | offline battle) real-time operation type.

  The latest NetEase Kung Fu Panda belongs to the (online battle|offline battle) real-time operation type. Compared with the national super god and the glory of the king of the dota category, he has higher requirements for delay.

  If you are not sure about the operation type of the game and the network requirements at the beginning of the project planning, if you want to adjust it later, the changes will be fatal. Assuming that the pure offline battle and real-time game realized in the way of the previous time and space hunter, at most only Can do offline PVP, if you want to increase the function of online PVP, it is almost necessary to rewrite the battle for the program.

  As the mobile game market becomes more and more mature, the requirements for combat are also increasing. It used to be enough to make an ARPG with only single-player gameplay, and there is no need to develop real-time PVP, but now the ARPG on the market can not only connect to PVP, but also The online team PVE has been established, so I feel that if I play the game now, it is just a stand-alone game, or the offline PVP game is far from satisfying the tastes of modern players.

  I think the battle system now needs to meet a few points.

  1. There must be offline PVE gameplay, or offline PVP gameplay, which can let players have fun when the network is not good and save traffic. (National Super God and King of Glory have a certain chance of being matched to offline battles during 5V5 matches. At this time, no traffic is consumed, and everyone else is controlled by AI)

  2. There must be online PVP and online PVE, which can make players When the network is better, real-time competition. Increase playability.

  3. During the battle, try to save the player's traffic to the greatest extent possible. For example, in the game of National Super God, a 30-minute battle basically consumes 20M of traffic, and most of these games are online battles, basically Can't play without wifi.

  4. There needs to be a battle playback mechanism, which can make planning and design of offline gameplay more free, such as COC, battle playback has basically become a part of its game.

  5. Anti-cheating, if there is offline gameplay, there must be a mechanism to verify the results of offline gameplay, otherwise, when your game is really popular, you will know it is wrong.

  6. The difficulty of realization is relatively low.

  For online games, there are two main synchronization methods: state synchronization and frame synchronization.

  1. Status synchronization: As the name suggests, it refers to the way of synchronizing the status and behavior of other players. In a group of cases, AI logic, skill logic, and combat calculation are all calculated by the server, but the results of the calculation are synchronized to the client, and the client only You need to accept the state changes sent by the server, and then update your local action state, Buff state, location, etc., but in order to give players a good experience and reduce the amount of synchronized data, the client will also do a lot of local operations. Reduce the frequency of server synchronization and the amount of data.

  2. Frame synchronization: a synchronization technology often used in RTS games. The amount of data in the previous state synchronization method will increase with the number of units that need to be synchronized. For RTS games, hundreds of units can be operated. If If these all need to be synchronized, the amount of data is unacceptable, so the frame synchronization is not synchronized, and only the operation is synchronized. After each client receives the operation, a consistent state can be achieved through the operation (the random seed is used to ensure that all clients are random The sequence is consistent), in this case, even if there are more units, his synchronization amount will not increase accordingly.

  Below we describe the respective implementation methods from the above five aspects:


 

  总结一下:

  1、对于回合制战斗来讲,其实选用哪种方式实现不是特别重要了,因为本身实现难度不是很高,采用状态同步也能实现离线战斗验证。所以采用帧同步的必要性不是很大。

  2、对于单位比较多的RTS游戏一定是帧同步,对于COC来讲,他虽然是离线游戏,但是他在一样输入的情况下是能得到一样结果的,所以也可以认为他是用帧同步方式实现的战斗系统。

  3、对于对操作要求比较高的,例如MOBA类游戏有碰撞(玩家、怪物可以互相卡位)、物理逻辑,纯物理类即时可玩休闲游戏,帧同步实现起来比较顺畅,(有开源的Dphysics 2D物理系统可用 它是Determisti的)。

  4、对于战斗时大地图MMORPG的,一个地图内会有成千上百的玩家,不是小房间性质的游戏,只能使用状态同步,只同步自己视野的状态。    

  5、帧同步有个缺点,不能避免玩家采用作*弊工具开图。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326288312&siteId=291194637