Game synchronization method and device, medium and computing equipment
By verifying and pushing legal instructions on the server, combining push-pull and heartbeat mechanisms, the problem of game out of synchronization during frame synchronization is solved, real-time consistency and accuracy of game state are achieved, and user experience is improved.
Patent Information
- Application Number
- CN202411291338.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-13
Smart Images

Figure CN119113528A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of game technology, and more specifically, embodiments of the present disclosure relate to a game synchronization method, medium, apparatus, and computing device. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the present disclosure. No description herein is admitted to be prior art by virtue of its inclusion in this section.
[0003] For online interactive games, network synchronization is a game synchronization technology used to ensure that multiple players in different geographical locations can interact in real time. It is mainly reflected in two aspects: multi-end data synchronization (server-side computing) and multi-end rendering synchronization (client-side performance). Among them, game synchronization includes the synchronization of data and instructions between multiple game players.
[0004] In the related art, game synchronization is performed through frame synchronization to ensure that the game states between multiple players remain consistent. Specifically, in frame synchronization, the game engine simulates the actions of each player on each logical frame, and sends each player's input instructions and state changes to other players, so that each player synchronizes the game state on their respective clients, so that the game screen and state seen by all players are consistent. However, in some scenarios, the problem of game asynchrony still exists after frame synchronization processing. Summary of the invention
[0005] The present disclosure provides a game synchronization method, medium, device and computing equipment to solve the problem of game asynchrony when the game is synchronized through frame synchronization.
[0006] In a first aspect of the embodiments of the present disclosure, a game synchronization method is provided, which is applied to a first client, and the game synchronization method includes:
[0007] receiving first instruction information sent by the server, the first instruction information is uploaded to the server by the second client, and the server verifies the first instruction information is legal and sends it to the first client, the second client and the first client are both player clients participating in the same network interactive game;
[0008] The game state is updated to a first game state according to the first instruction information.
[0009] In a possible implementation, the game synchronization method also includes: receiving a heartbeat signal sent by the server, the heartbeat signal carrying a second game state determined by the server according to the first instruction information; checking whether the second game state is consistent with the first game state; if not, obtaining relevant data of the second game state from the server, and updating the game state according to the relevant data.
[0010] In a possible implementation, obtaining relevant data of the second game state from the server includes: sending an instruction to the server to pull a compensation request to obtain relevant data of the second game state.
[0011] In a possible implementation, after receiving the first instruction information sent by the server, the game synchronization method also includes: obtaining second instruction information, the second instruction information including a second instruction identifier, the second instruction information being the previous instruction information of the first instruction information; determining whether the second instruction identifier is the same as the first instruction identifier, the first instruction identifier being the current maximum instruction identifier stored locally on the first client; if they are not the same, sending an instruction pull compensation request to the server to obtain the instruction information that is not synchronized by the server.
[0012] In a possible implementation, the game synchronization method further includes: if they are the same, obtaining first checksum information corresponding to the first instruction information, the first checksum information being generated by the server based on the first instruction information; determining whether there is a difference between the first checksum information and the second checksum information, the second checksum information being generated by the first client based on the first instruction information; if there is a difference, sending a global game state pull compensation request to the server to obtain global game state data, and updating the game state data through the global game state data.
[0013] In a possible implementation, the game synchronization method also includes: responding to the first client reconnecting to the network, receiving third instruction information sent by the server, the third instruction information including a third instruction identifier; calculating the identification difference between the third instruction identifier and the fourth instruction identifier, the fourth instruction identifier being the current maximum instruction identifier stored locally on the first client; determining whether the identification difference exceeds a preset threshold; if the identification difference exceeds the preset threshold, pulling the latest game status data from the server through a compensation interface, and updating the game status data through the game status data; if the identification difference does not exceed the preset threshold, sending an instruction pull compensation request to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client.
[0014] In one possible implementation, the game state of the first client may be replayed in the following manner: pulling the initial state of the game from the server, and pulling instruction information from the server through an instruction list interface, and executing the instruction information one by one to achieve game playback; and / or quickly locating the target instruction by dragging the progress bar, and pulling a game snapshot corresponding to the target instruction from the server.
[0015] In a possible implementation, the second client and the first client establish a real-time connection with the server by polling heartbeats.
[0016] In a second aspect of the disclosed embodiment, a game synchronization method is provided, which is applied to a server, and the game synchronization method includes: receiving first instruction information uploaded by a second client; verifying whether the first instruction information is legal; in response to the first instruction information being legal, sending the first instruction information to the first client, and the first client updating the game status to the first game status according to the first instruction information, and the second client and the first client are both player clients participating in the same network interactive game.
[0017] In a possible implementation manner, verifying whether the first instruction information is legal includes: verifying whether basic information of the first instruction information is legal.
[0018] In one possible implementation, the game synchronization method further includes: sending a heartbeat signal to the first client, so that the first client verifies whether the second game state is consistent with the first game state, and when they are inconsistent, responds to receiving an instruction to pull a compensation request sent by the first client, and sends relevant data of the second game state to the first client, wherein the heartbeat signal carries the second game state determined according to the first instruction information.
[0019] In a possible implementation, the game synchronization method further includes: verifying whether cheating occurs in the first instruction information; if cheating occurs, intercepting the second instruction information uploaded again by the second client.
[0020] In a third aspect of the embodiments of the present disclosure, a game synchronization device is provided, which is applied to a first client, and the game synchronization device includes:
[0021] A receiving module, used for receiving first instruction information sent by the server, the first instruction information is uploaded to the server by the second client, and the server verifies the first instruction information as legitimate and then sends it to the first client, the second client and the first client are both player clients participating in the same network interactive game;
[0022] An updating module is used to update the game state to a first game state according to the first instruction information.
[0023] In a possible implementation, the game synchronization device also includes a processing module (not shown), which is used to: receive a heartbeat signal sent by the server, the heartbeat signal carrying a second game state determined by the server based on the first instruction information; check whether the second game state is consistent with the first game state; if not, obtain relevant data of the second game state from the server, and update the game state based on the relevant data.
[0024] In a possible implementation, the processing module is further used to: send an instruction to pull a compensation request to the server to obtain relevant data of the second game state.
[0025] In one possible implementation, after receiving the first instruction information sent by the server, the processing module is also used to: obtain second instruction information, the second instruction information includes a second instruction identifier, the second instruction information is the previous instruction information of the first instruction information; determine whether the second instruction identifier is the same as the first instruction identifier, the first instruction identifier is the current maximum instruction identifier stored locally by the first client; if they are not the same, send an instruction pull compensation request to the server to obtain the instruction information that is not synchronized by the server.
[0026] In a possible implementation, the processing module is also used to: if they are the same, obtain first checksum information corresponding to the first instruction information, where the first checksum information is generated by the server based on the first instruction information; determine whether there is a difference between the first checksum information and the second checksum information, where the second checksum information is generated by the first client based on the first instruction information; if there is a difference, send a global game state pull compensation request to the server to obtain global game state data, and update the game state data through the global game state data.
[0027] In one possible implementation, the processing module is also used to: respond to the first client's network reconnection, receive third instruction information sent by the server, the third instruction information including a third instruction identifier; calculate the identification difference between the third instruction identifier and the fourth instruction identifier, the fourth instruction identifier being the current maximum instruction identifier stored locally by the first client; determine whether the identification difference exceeds a preset threshold; if the identification difference exceeds the preset threshold, pull the latest game status data of the server through the compensation interface, and update the game status data through the game status data; if the identification difference does not exceed the preset threshold, send an instruction pull compensation request to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client.
[0028] In one possible implementation, the game state of the first client may be replayed in the following manner: pulling the initial state of the game from the server, and pulling instruction information from the server through an instruction list interface, and executing the instruction information one by one to achieve game playback; and / or quickly locating the target instruction by dragging the progress bar, and pulling a game snapshot corresponding to the target instruction from the server.
[0029] In a possible implementation, the second client and the first client establish a real-time connection with the server by polling heartbeats.
[0030] In a fourth aspect of the embodiments of the present disclosure, a game synchronization device is provided, which is applied to a server, and the game synchronization device includes:
[0031] A receiving module, used for receiving the first instruction information uploaded by the second client;
[0032] A verification module, used to verify whether the first instruction information is legal;
[0033] The sending module is used to respond to the first instruction information being legal and send the first instruction information to the first client. The first client updates the game state to the first game state according to the first instruction information. The second client and the first client are both player clients participating in the same network interactive game.
[0034] In a possible implementation manner, the verification module is specifically used to verify whether basic information of the first instruction information is legal.
[0035] In one possible implementation, the sending module is also used to: send a heartbeat signal to the first client, so that the first client verifies whether the second game state is consistent with the first game state, and when they are inconsistent, responds to receiving an instruction to pull a compensation request sent by the first client, and sends relevant data of the second game state to the first client, and the heartbeat signal carries the second game state determined according to the first instruction information.
[0036] In a possible implementation, the verification module is further used to: verify whether there is cheating in the first instruction information; if cheating is present, intercept the second instruction information uploaded again by the second client.
[0037] In a fifth aspect of the embodiments of the present disclosure, a computing device is provided, comprising: a processor, and a memory communicatively connected to the processor;
[0038] Memory stores computer-executable instructions;
[0039] The processor executes the computer-executable instructions stored in the memory to implement the game synchronization method provided in the first aspect of the present disclosure, or to implement the game synchronization method provided in the second aspect of the present disclosure.
[0040] In the sixth aspect of the embodiment of the present disclosure, a storage medium is provided, in which computer program instructions are stored. When the computer program instructions are executed, the game synchronization method provided in the first aspect of the present disclosure is implemented, or the game synchronization method provided in the second aspect of the present disclosure is implemented.
[0041] In a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed, implements the game synchronization method provided in the first aspect of the present disclosure, or implements the game synchronization method provided in the second aspect of the present disclosure.
[0042] The present disclosure provides a game synchronization method, medium, device and computing equipment. The game synchronization method is applied to a first client, receives a first instruction message sent by a second client to the server, and updates the game state to the first game state according to the first instruction message, wherein the first instruction message is sent to the first client after the server verifies the legitimacy, and the second client and the first client are both player clients participating in the same network interactive game. The present disclosure verifies the first instruction message received from the second client and sends it to the first client after the verification is legal, thereby achieving the accuracy of interactive game instruction synchronization. Further, after the first client receives the first instruction message, the first client updates the game state in real time according to the first instruction message, thereby achieving the real-time nature of interactive game instruction synchronization, and thus achieving synchronization of interactive games. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0044] Figure 1 This is a schematic diagram of the principle of frame synchronization;
[0045] Figure 2 This is a schematic diagram of the principle of state synchronization;
[0046] Figure 3 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;
[0047] Figure 4 A flowchart of a game synchronization method provided by an embodiment of the present disclosure;
[0048] Figure 5 A schematic diagram of a data push-pull structure provided in an embodiment of the present disclosure;
[0049] Figure 6 A flowchart of a game synchronization method provided by another embodiment of the present disclosure;
[0050] Figure 7 A schematic diagram of the structure of the instruction model in game synchronization provided by an embodiment of the present disclosure;
[0051] Figure 8 A schematic diagram of the structure of data verification in game synchronization provided by an embodiment of the present disclosure;
[0052] Fig. 9 A schematic diagram of the structure of a computing device provided in one embodiment of the present disclosure;
[0053] Fig.10A schematic diagram of the structure of a game reconnection solution provided by an embodiment of the present disclosure;
[0054] Fig.11 A flowchart of a game synchronization method provided by another embodiment of the present disclosure;
[0055] Fig.12 A schematic diagram of the structure of a game playback solution provided by an embodiment of the present disclosure;
[0056] Fig.13 A flowchart of a game synchronization method provided by another embodiment of the present disclosure;
[0057] Fig.14 A schematic diagram of the structure of a game synchronization method provided by an embodiment of the present disclosure;
[0058] Fig.15 A schematic diagram of a storage medium provided in an embodiment of the present disclosure;
[0059] Fig.16 A schematic diagram of the structure of a game synchronization device provided by an embodiment of the present disclosure;
[0060] Fig.17 A schematic diagram of the structure of a game synchronization device provided by another embodiment of the present disclosure;
[0061] Fig.18 A schematic diagram of the structure of a computing device provided in one embodiment of the present disclosure.
[0062] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0063] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0064] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0065] According to an embodiment of the present disclosure, a game synchronization method, medium, apparatus and computing device are proposed.
[0066] In this article, it is important to understand that the terms used have the following meanings:
[0067] Term 1, Interactive Game: Interactive games use real-time player actions and feedback to advance the game process and interact with other players or virtual characters in the game. This type of game may include but is not limited to multiplayer online games, cooperative games, battle games, role-playing games, etc. Interactive games usually need to be played in a multi-user environment to increase the game experience and challenge.
[0068] Term 2, Instruction Sync Method: Instruction Sync Method is a technical method used to ensure that in a multi-user interactive game environment, the game instructions executed by each user can be synchronized in real time and accuracy. This includes synchronizing player movements, actions, and state changes to maintain consistency and fairness in the game.
[0069] Term 3, Real-time Communication: Real-time communication is a communication method that allows users to communicate and transfer data instantly during the game. In interactive games, real-time communication is very important to ensure that players can exchange information, synchronize status, and achieve fast response.
[0070] Term 4, Game Engine: refers to the software system used to develop and run games. The game engine includes core functions such as graphics rendering, physics simulation, collision detection, animation, etc., and plays an important role in the implementation of command synchronization.
[0071] Term 5, Network Communication Protocol: It is a protocol standard that specifies the data transmission format, data encapsulation, transmission mode and error handling rules to ensure effective data exchange between different devices. In interactive games, the network communication protocol is the basis for command synchronization.
[0072] Term 6, frame synchronization: Frame synchronization is a technology in multiplayer games that is used to ensure that the game screens seen by all players on different clients are consistent. In frame synchronization, the game engine records the player's input at the end of each frame (that is, each screen) and sends these inputs to the game clients of other players so that these inputs are executed in the same order and time points on each client, thereby maintaining the consistency of the game. Frame synchronization is often used in real-time multiplayer games to ensure that the actions and interactions of all players in the game are synchronized, thereby providing a fair and consistent gaming experience.
[0073] Term 7, state synchronization: State synchronization refers to the technology that ensures that the game state seen by all players on different clients in a multiplayer game remains consistent. This means that the state of the game, including player positions, health points, speeds, actions, etc., is the same on each client. Through state synchronization, the game engine sends each player's state information to other players' clients periodically or when specific events occur to ensure that the game state seen by all players at the same point in time is consistent. State synchronization is often used in real-time multiplayer games to ensure fairness and consistency of the game.
[0074] Term 8, push-pull combination: "push-pull combination" usually refers to a messaging mode used to achieve real-time data transmission and synchronization. In this mode, messaging can be divided into two modes: "push" and "pull". "Push" means that the server actively pushes data or information to the client, usually through server-side push technology (such as long polling, WebSocket, etc.) to transmit data to the client in real time. "Pull" means that the client actively initiates a request as needed to obtain data or information from the server.
[0075] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0076] In addition, any number of elements in the drawings is for illustration and not limitation, and any naming is only for distinction and does not have any limiting meaning.
[0077] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION
[0079] The inventors have found that network synchronization involves almost all online interactive games, mainly manifested in two aspects: multi-end data synchronization (server-side computing) and multi-end rendering synchronization (client-side performance). Game synchronization is mainly used to solve the problem of data and instruction synchronization between two or more parties when multiple game players are online at the same time. Data synchronization has many difficulties: network delay, security and cheating, multi-end data synchronization, data loss and processing, etc.
[0080] At present, for online interactive games, there are two main ways to achieve game synchronization: frame synchronization and state synchronization. However, both the frame synchronization method and the state synchronization method have certain defects. In the current situation where user experience is important, it is not possible to use a single synchronization method to solve all game business problems.
[0081] Among them, frame synchronization is used to ensure that the game status between multiple players remains consistent. Figure 1 Figure 1 is a schematic diagram of the principle of frame synchronization. Figure 1 As shown in the figure, in frame synchronization, the game engine simulates the actions of all players on each logical frame and sends each player's input and state changes to other players so that each player can synchronize the game state on their respective clients, so that all players see the same game screen and state. Frame synchronization mainly relies on client calculations, and the server only collects and forwards data. However, there may be differences in the computing platforms of various clients, such as floating-point calculations and errors caused by hardware differences. In addition, all logical calculations of frame synchronization are completed on the client. With the increase in game players and the jitter of the network environment, the client will experience delays in data synchronization and calculation, affecting the player's gaming experience.
[0082] Figure 2 Figure 1 is a schematic diagram of the principle of state synchronization. Figure 2 As shown in the figure, state synchronization is the process where the server calculates all game information, such as changes in player status (position, action, health, etc.), and sends the result information to each client to ensure that every player in the game can see the same real-time game status. In state synchronization, the server needs to calculate all game status information in real time. The server's computing pressure is relatively large, and it is difficult to ensure the frequency and efficiency of game data synchronization. In addition, the client only performs rendering logic, which will waste performance, and the client needs to wait for the server's status to return when synchronizing data with the server, which will cause client display delays.
[0083] Based on the above problems, the present disclosure provides a game synchronization method, medium, device and computing device, which verify the command information uploaded by any player client among the player clients participating in the same network interactive game through the server, and send it to other player clients after the verification is legal, so as to achieve the accuracy of interactive game command synchronization. Furthermore, after receiving the command information, other player clients update the game status in real time according to the command information, so as to achieve the real-time synchronization of interactive game commands, and thus realize the synchronization of interactive games.
[0084] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0085] Application Scenario Overview
[0086] First reference Figure 3 The application scenarios of the solutions provided in the present disclosure are illustrated by examples.
[0087] Figure 3 A schematic diagram of an application scenario provided by an embodiment of the present disclosure. Figure 3 As shown, the application scenario includes: a client and a server. The client and the server can communicate with each other through a wired network or a wireless network. The client includes a first client and a second client, and the first client and the second client are both player clients participating in the same network interactive game.
[0088] Exemplarily, the client may be a desktop computer, a notebook, a tablet computer, etc.
[0089] Exemplarily, in response to an operation performed by a user on an interface of a second client in a network interactive game, the second client generates instruction information corresponding to the operation and uploads the instruction information to a server. After receiving the instruction information, the server verifies the instruction information and, after verifying that the instruction information is legal, sends the instruction information to the first client, so that the first client calculates the game state corresponding to the instruction information based on the instruction information, and updates the current game state of the first client to the game state corresponding to the calculated instruction information, so that during the game, all players participating in the same network interactive game see the same real-time game state.
[0090] It can be seen that the embodiments of the present disclosure can synchronize games through the interaction between the client and the server.
[0091] It should be noted that Figure 3 This is only a schematic diagram of an application scenario provided by the embodiment of the present disclosure. Figure 3 does not limit the equipment included in Figure 3 The positional relationship between the devices is limited.
[0092] Exemplary Methods
[0093] Combine the following Figure 3 For application scenarios, refer to Figure 3 To describe a method for game synchronization according to an exemplary embodiment of the present disclosure. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0094] Let's first take the above Figure 3The first client shown in is the execution subject, and the game synchronization method provided by the present disclosure is described in detail in combination with specific embodiments.
[0095] Figure 4 Flow chart of a game synchronization method provided by an embodiment of the present disclosure. The method of the embodiment of the present disclosure can be applied to a computing device, such as a first client. Figure 4 As shown, the specific implementation of the game synchronization method includes the following steps:
[0096] S401, receiving the first instruction information sent by the server, the first instruction information is uploaded to the server by the second client, and the server verifies the first instruction information is legal and sends it to the first client, the second client and the first client are both player clients participating in the same network interactive game.
[0097] For example, the first instruction information may be an operation instruction in the process of the online interactive game, such as a movement instruction, an attack instruction, and an interaction instruction, etc. The movement instruction may be forward, backward, left, right, and jump, etc.; the attack instruction may be a normal attack, a special skill, and the use of props, etc.
[0098] It should be noted that the above description of the first instruction information is only an example. In the game synchronization method provided in the embodiment of the present disclosure, the specific content of the first instruction information is not limited and can be determined according to actual application requirements.
[0099] Exemplarily, the second client may upload the first instruction information to the server through an http interface.
[0100] Exemplarily, the server may verify the basic information of the first instruction information.
[0101] For example, when the first instruction information is a special skill, the verification of the basic information of the first instruction information can be used to determine whether the special skill is used correctly. For example, if the current skill should be in a cooling state, but the first instruction information uploaded by the second client is to use the special skill, then the first instruction information is determined to be illegal; if the second client has only three skills corresponding to the game virtual character selected by the user, but the first instruction information uploaded by the second client is to use the fourth skill, then the first instruction information is determined to be illegal, etc.
[0102] It can be understood that in the game synchronization method provided by the embodiment of the present disclosure, after the server receives the first instruction information sent by the second client, the server only verifies the legality of the basic information corresponding to the instruction information, and directly sends the first instruction information to the first client after the first instruction information is verified to be legal. In this process, the server does not need to calculate heavy business logic, that is, there is no need to calculate the game status corresponding to the first instruction information, so as to ensure the real-time synchronization of game instructions.
[0103] S402: Update the game state to a first game state according to the first instruction information.
[0104] In this step, after receiving the first instruction information sent by the server, the first client first calculates the first game state corresponding to the first instruction information, and then updates the current game state of the first client to the first game state corresponding to the first instruction information.
[0105] In the disclosed embodiment, the first client receives the first instruction information uploaded by the second client to the server by the server, and updates the game state to the first game state according to the first instruction information, wherein the first instruction information is sent to the first client after the server verifies the legality, and the second client and the first client are both player clients participating in the same network interactive game. In the disclosed embodiment, the server verifies the first instruction information uploaded by the second client and sends it to the first client after the verification is legal, so as to achieve the accuracy of interactive game instruction synchronization. Further, after the first client receives the first instruction information, the first client updates the game state in real time according to the first instruction information, so as to achieve the real-time nature of interactive game instruction synchronization, thereby achieving synchronization of interactive games.
[0106] It is understandable that during the online interactive game, when the player's network environment fluctuates, such as network jitter, entering an elevator, or network signal switching, it will affect the real-time synchronization of game data, thereby affecting the user's gaming experience. Based on this, the game synchronization method provided in the embodiment of the present disclosure uses a push-pull combination to synchronize game data, thereby achieving the anti-interference ability of online interactive games and improving the user experience.
[0107] In the game synchronization method provided by the embodiment of the present disclosure, on the one hand, the server and the client can synchronize the game data in real time through a push-pull message transmission mode. The server can actively push game data to the client, or the client can actively initiate a request to the server according to actual needs to obtain game data from the server. On the other hand, the server and the client can maintain a connection through a timed heartbeat mechanism to ensure the synchronization of the game state and the real-time synchronization during the network interactive game process. Specifically, by maintaining the same heartbeat between the server and the client, the server can sense in real time whether the current client is alive. At the same time, the server can also send the game state to the client through the heartbeat interface, so that the client can sense whether the current game state of the client is consistent with the game state corresponding to the server in the process of pulling the heartbeat, and when inconsistent, the client pulls the relevant data of the game state corresponding to the server from the server by triggering the pull logic.
[0108] Optionally, the second client and the first client establish a real-time connection with the server by polling heartbeats.
[0109] Figure 5 This is a schematic diagram of the structure of data push-pull combination provided by the embodiment of the present disclosure. Figure 5 As shown, the first client and the cloud service end communicate bidirectionally through the long push channel, the first client and the business service end establish a real-time connection through http heartbeat polling, the business service end pushes the instruction information of the business side to the cloud service end through the message middle station (im middle station) based on the remote procedure call (Remote Procedure Call, referred to as RPC), and the cloud service end pushes information to the first client through the underlying channel. Among them, the business service end and the first client can verify whether the game state of the server and the local game state of the first client are consistent through the heartbeat logic, and when they are inconsistent, the first client can pull the instruction information through the http interface to compensate. In this data push-pull combined message transmission mode, in the case of weak network, that is, when the network signal of the first client is poor, the long push channel may experience push accumulation and data loss. At this time, the instructions that the server has not synchronized to the first client can be sent to the client through the http pull compensation of the business layer to ensure the normal operation of the game.
[0110] Among them, the cloud communication server can also be described as a long connection server.
[0111] Combine the following Figure 6 The specific implementation method of performing game synchronization based on a data push-pull combined structure in the game synchronization method provided in the embodiment of the present disclosure is described in detail.
[0112] Figure 6A flowchart of a game synchronization method provided by another embodiment of the present disclosure. The method of the embodiment of the present disclosure can be applied to a computing device, such as a first client. Figure 6 As shown, the specific implementation of the game synchronization method includes the following steps:
[0113] S601, receiving a heartbeat signal sent by a server, where the heartbeat signal carries a second game state determined by the server according to the first instruction information.
[0114] Optionally, when the server receives the first instruction information sent by the second client, the server can deliver the first instruction information to an asynchronous processor, and in the asynchronous processing logic, the server asynchronously calculates the game state corresponding to the first instruction information, that is, the current game state displayed by the client, that is, the second game state.
[0115] It is understandable that in the game synchronization method provided by the embodiment of the present disclosure, when the server receives the first instruction information sent by the second client, on the one hand, it verifies the legitimacy of the basic information of the first instruction information, and after the verification is passed, sends the first instruction information to the first client; on the other hand, the server verifies the legitimacy of the basic information of the first instruction information, and after the verification is passed, delivers the first instruction information to an asynchronous processor, and in the asynchronous processing logic, the server calculates the game state corresponding to the first instruction information. The game synchronization method provided by the embodiment of the present disclosure synchronizes game data by combining frame synchronization and state synchronization, which ensures the efficiency of frame synchronization while having the advantage of state synchronization to prevent client cheating.
[0116] In this step, the first client and the server may maintain a connection through a timed heartbeat mechanism, and the first client receives a heartbeat signal sent by the server based on the timed heartbeat mechanism.
[0117] Exemplarily, the heartbeat signal can be used to enable the server to sense whether the first client is online, and can also be used to enable the first client to sense the current game state corresponding to the server, that is, the second game state.
[0118] S602, verify whether the second game state is consistent with the first game state.
[0119] In this step, the first client verifies the first game state and the second game state to determine whether the first game state and the second game state are consistent.
[0120] It can be understood that when the first game state and the second game state are consistent, it means that the current game of the first client is running normally; when the first game state and the second game state are inconsistent, it means that the current game of the first client is running abnormally, that is, the instructions of the server may not be synchronized to the first client, causing data loss in the first client, etc.
[0121] S603: If they are inconsistent, obtain relevant data of the second game state from the server, and update the game state according to the relevant data.
[0122] It is understandable that in online interactive games, when the local game state of the client is inconsistent with the current game state of the server, the current gameplay state of the server shall prevail by default.
[0123] In this step, when the first client verifies that the second game state is inconsistent with the first game state, optionally, the first client sends an instruction to pull a compensation request to the server through the http interface to obtain relevant data of the second game state from the server, and updates the game state according to the relevant data.
[0124] In the disclosed embodiment, a heartbeat signal carrying the second game state determined by the server according to the first instruction information is received from the server, and the second game state is verified to be consistent with the first game state. If they are inconsistent, the relevant data of the second game state is obtained from the server, and the game state is updated according to the relevant data. In the disclosed embodiment, the first client and the server are connected through a timed heartbeat mechanism, and the game is synchronized by combining data push and pull, so that the first client can have the ability to reconnect after disconnection in a weak network condition, quickly restore the game progress, and realize the normal operation of the game.
[0125] Optionally, in the game synchronization method provided by the embodiment of the present disclosure, after receiving the first instruction information sent by the server, the first client needs to perform data verification according to the previous instruction identifier corresponding to the first instruction information contained in the first instruction information to determine whether there is data loss in the first client, and if the verification passes, further verify the checksum information contained in the first instruction information to determine whether there is a deviation in the game advancement logic of the first client and the server. Based on this, the following first combines Figure 7 The instruction model structure of the game synchronization provided by the embodiment of the present disclosure is described.
[0126] Figure 7 This is a schematic diagram of the structure of the instruction model in the game synchronization provided by the embodiment of the present disclosure. Figure 7As shown, the instruction model of game synchronization is represented in the form of a class linked list in chronological order. Among them, the game synchronization instruction model corresponding to each instruction information includes instruction id, previous instruction id, game id, instruction type, instruction status, instruction data, checksum and creation time, etc. Among them, the instruction id can be a serial number arranged in the order of instruction generation by the server, such as the previous instruction id is less than the current instruction id; the instruction type can include system instructions and user instructions, etc.; the instruction status can be the instruction executed or the instruction not executed; the checksum can be the hash check data of the game status.
[0127] It should be noted that in the game synchronization instruction model provided by the embodiment of the present disclosure, the server can send some specific system instructions to the first client, such as game debugging instructions, while sending user instructions such as game operation instructions to the first client, to facilitate debugging of problems during game development.
[0128] Figure 8 This is a schematic diagram of the structure of data verification in game synchronization provided by the embodiment of the present disclosure. Figure 8 As shown, the server includes a synchronization unit, a state calculation unit and a monitoring log unit, and the first client includes an instruction identifier verification unit. In the game synchronization method provided by the embodiment of the present disclosure, after receiving the first instruction information uploaded by the second client, the server generates an instruction identifier corresponding to the first instruction information on the one hand, and returns the instruction identifier to the second client; on the other hand, the server calculates the game state corresponding to the first instruction information through the state calculation unit based on asynchronous calculation, and the synchronization unit obtains the instruction state corresponding to the previous instruction information of the first instruction information from the state calculation unit, and sends a prompt message of an instruction information error to the second client when the instruction state is that the instruction is not executed; when the instruction state is that the instruction has been executed, the first instruction information and the instruction identifier corresponding to the first instruction information are synchronized to the first client through the synchronization unit, so that the first client calculates the game state corresponding to the first instruction information, and updates the game state to the game state corresponding to the calculated first instruction information; on the other hand, the first client performs data verification based on the instruction identifier verification unit according to the previous instruction identifier corresponding to the first instruction information contained in the first instruction information and the current maximum instruction identifier stored locally, and reports to the monitoring log unit of the server when the verification fails.
[0129] Based on the above Figure 7 The instruction model structure shown and Figure 8 The data verification structure shown below is combined with Fig. 9A specific implementation method for the first client to perform data verification according to a previous instruction identifier corresponding to the first instruction information contained in the first instruction information after receiving the first instruction information sent by the server is described in detail.
[0130] Fig. 9 FIG. 1 is a flowchart of a game synchronization method provided by another embodiment of the present disclosure. Fig. 9 As shown, after the first client receives the first instruction information sent by the server, the specific implementation method of the game synchronization method is:
[0131] S901, obtaining second instruction information, where the second instruction information includes a second instruction identifier, and the second instruction information is the previous instruction information of the first instruction information.
[0132] Exemplarily, the second instruction identifier may be the above Figure 7 The previous instruction id shown in .
[0133] Based on the above Figure 7 The displayed instruction model shows that the server includes the last instruction ID in the first instruction information sent to the first client. Therefore, in this step, after receiving the first instruction information sent by the server, the first client can obtain the second instruction information from the first instruction information.
[0134] S902: Determine whether the second instruction identifier is the same as the first instruction identifier, where the first instruction identifier is the current maximum instruction identifier stored locally on the first client.
[0135] It can be understood that the first client locally stores all instruction information / data before the first instruction information sent by the server, and the server stores all instruction information / data.
[0136] It should be noted that in the game synchronization method provided by the embodiment of the present disclosure, after the first client receives the first instruction information sent by the server, it is necessary to perform data verification according to the previous instruction identifier corresponding to the first instruction information contained in the first instruction information, and after the verification is successful, the first instruction information is stored locally on the first client.
[0137] Exemplarily, the current maximum instruction identifier locally stored by the first client may be an instruction identifier corresponding to instruction information successfully verified by the first client before receiving the first instruction information.
[0138] Exemplarily, when instruction 1, instruction 2, and instruction 3 are stored on the server, the server sends instruction information corresponding to instruction 1, instruction 2, and instruction 3 to the first client in sequence. If the first client receives instruction information corresponding to instruction 1 and instruction 2, and successfully verifies the instruction information corresponding to instruction 1 and instruction 2, the instruction information corresponding to instruction 1 and instruction 2 is stored locally on the first client, that is, at this time, the current maximum instruction identifier stored locally on the first client is the instruction identifier corresponding to the instruction information corresponding to instruction 2. When the first client receives instruction 3 sent by the server, the first client obtains the previous instruction identifier corresponding to instruction 3, that is, the instruction identifier corresponding to instruction 2, from the instruction information corresponding to instruction 3, and compares the previous instruction identifier with the maximum instruction identifier stored locally on the first client, that is, the instruction identifier corresponding to instruction 2, and obtains that the instruction identifier corresponding to instruction 2 is the same as the instruction identifier corresponding to instruction 2.
[0139] If the first client receives instruction information corresponding to instruction 1 but does not receive instruction information corresponding to instruction 2, and the instruction information corresponding to instruction 1 is successfully verified, the instruction information corresponding to instruction 1 is stored locally on the first client, that is, at this time, the current maximum instruction identifier stored locally on the first client is the instruction identifier corresponding to the instruction information corresponding to instruction 1. Then, when the first client receives instruction 3 sent by the server, the first client obtains the previous instruction identifier corresponding to instruction 3, that is, the instruction identifier corresponding to instruction 2, from the instruction information corresponding to instruction 3, and compares the previous instruction identifier with the maximum instruction identifier stored locally on the first client, that is, the instruction identifier corresponding to instruction 1, and obtains that the instruction identifier corresponding to instruction 1 is different from the instruction identifier corresponding to instruction 2.
[0140] S903: If they are not the same, a command pull compensation request is sent to the server to obtain the unsynchronized command information of the server.
[0141] Based on step S902, it can be understood that when the second instruction identifier is different from the first instruction identifier, it means that data loss has occurred in the first client. Then, through the push-pull combined messaging mode shown above, the first client actively sends an instruction pull compensation request to the server to obtain the unsynchronized instruction information from the server through the http interface.
[0142] In the disclosed embodiment, after receiving the first instruction information sent by the server, the first client determines whether the second instruction identifier is the same as the current maximum instruction identifier stored locally on the first client, i.e., the first instruction identifier, by obtaining the second instruction information including the second instruction identifier, and if they are not the same, sends an instruction pull compensation request to the server to obtain the instruction information that is not synchronized with the server. In the disclosed embodiment, when the first client receives the current instruction information sent by the server, it verifies the current instruction information to determine whether the first client has data loss, and if data loss exists, actively pulls the data that is not synchronized with the server from the server through a combination of push and pull, so as to achieve the normal progress of the game and improve the user experience.
[0143] Optionally, if the second instruction identifier is the same as the first instruction identifier, obtain the first checksum information corresponding to the first instruction information, and the first checksum information is generated by the server based on the first instruction information; determine whether there is a difference between the first checksum information and the second checksum information, and the second checksum information is generated by the first client based on the first instruction information; if there is a difference, send a global game status pull compensation request to the server to obtain global game status data, and update the game status data through the global game status data.
[0144] Exemplarily, the first checksum information is hash verification data of the game state corresponding to the first instruction information, generated by the server based on preset rules according to the first instruction information; the second instruction information is hash verification data of the game state corresponding to the first instruction information, generated by the first client based on preset rules according to the first instruction information.
[0145] It can be understood that the same instruction information generates the same checksum information, while different instruction information generates different checksum information.
[0146] It is understandable that when there is a difference between the first checksum information and the second checksum information, it indicates that there is a deviation in the game advancement logic of the first client and the server, that is, the server may have tampered with data during the process of synchronizing the first instruction information to the first client.
[0147] Compared to the PC gaming era, the gaming environment is relatively fixed and the possibility of network disconnection is small. During the game, disconnection and reconnection have less impact on the user experience. However, currently, in the mobile Internet era, the network environment is unstable and the possibility of network disconnection is relatively large. During the game, disconnection and reconnection have a greater impact on the user experience. Therefore, in order to ensure that the user's gaming experience is not affected when the network is unstable, the game synchronization method provided in the embodiment of the present disclosure triggers the game instruction compensation logic when the network switching, network disconnection and reconnection, etc. occur on the first client, so as to achieve game reconnection and improve the user experience.
[0148] Let's first combine Fig.10 The structure of the game reconnection solution in the game synchronization method provided in the embodiment of the present disclosure is explained. Fig.10 This is a schematic diagram of the structure of the game reconnection solution provided by the embodiment of the present disclosure. Fig.10 As shown, the server contains the latest game status and command list corresponding to the current command information. After the first client is disconnected and reconnected, it will receive the command information sent by the server.
[0149] It should be noted that in the game synchronization method provided by the embodiment of the present disclosure, by adopting a combination of frame synchronization and state synchronization, after receiving the instruction information sent by the second client, the server will asynchronously calculate the running state of the game according to the instruction uplink situation and store it. At the same time, the server will store all instruction information including the current instruction information, and sort them according to the order in which the instructions were generated, that is, sort them according to the order from small to large according to the instruction identifiers, to obtain an instruction list.
[0150] Combine the following Fig.11 The specific implementation of the game reconnection solution in the game synchronization method provided in the embodiment of the present disclosure is described in detail.
[0151] Fig.11 FIG. 1 is a flowchart of a game synchronization method provided by another embodiment of the present disclosure. Fig.11 As shown, the specific implementation of the game synchronization method includes the following steps:
[0152] S110, in response to the first client reconnecting to the network, receiving third instruction information sent by the server, where the third instruction information includes a third instruction identifier.
[0153] It is understandable that the first client may experience a network interruption during the game due to network switching, network disconnection, etc.
[0154] Exemplarily, the third instruction identifier may be the instruction id corresponding to the third instruction information.
[0155] S111, calculating the difference between the third instruction identifier and the fourth instruction identifier, where the fourth instruction identifier is the current maximum instruction identifier stored locally on the first client.
[0156] It is understandable that when the first client is disconnected from the network and reconnected, data loss occurs during the period of network interruption. That is, after the first client is disconnected from the network and reconnected, the third instruction identifier contained in the received third instruction information must be different from the current maximum instruction identifier stored locally on the first client.
[0157] S112, determining whether the identification difference exceeds a preset threshold.
[0158] Exemplarily, the preset threshold value may be adjusted according to the game type.
[0159] In this step, if the identification difference exceeds the preset threshold, step S113 is executed; if the identification difference does not exceed the preset threshold, step S114 is executed.
[0160] It should be noted that when the identification difference exceeds the preset threshold, the game synchronization method provided in the embodiment of the present disclosure updates the game status data of the first client through a large reconnection; when the identification difference does not exceed the preset threshold, the game synchronization method provided in the embodiment of the present disclosure obtains the lost data of the first client through a small disconnection.
[0161] S113, pull the latest game status data from the server through the compensation interface, and update the game status data through the game status data.
[0162] S114, sending an instruction pull compensation request to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client.
[0163] Exemplarily, the first client passes the above Fig.10 The instruction list interface shown in sends an instruction pull compensation request to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client, thereby achieving disconnection and reconnection by catching up with the instructions.
[0164] The disclosed embodiment receives the third instruction information including the third instruction identifier sent by the server when the first client reconnects to the network, calculates the difference between the third instruction identifier and the current maximum instruction identifier stored locally on the first client, namely the fourth instruction identifier, determines whether the difference exceeds a preset threshold, and pulls the latest game status data of the server through the compensation interface when the difference exceeds the preset threshold, so as to update the game status data through the game status data, and sends an instruction pull compensation request to the server when the difference does not exceed the preset threshold, so as to obtain the instruction information corresponding to the difference missing from the first client. The disclosed embodiment provides two methods, small disconnection and large reconnection, for the situation where the first client's instruction synchronization is lagging, so as to improve the speed of resuming the game.
[0165] Combine the following Fig.12 The structure of the game playback solution in the game synchronization method provided in the embodiment of the present disclosure is explained. Fig.12 This is a schematic diagram of the structure of the game playback solution provided by the embodiment of the present disclosure. Fig.12As shown, the server stores all the instruction information of the game, i.e., the instruction list, and stores the game state data corresponding to each frame of instruction, i.e., the game snapshot, through asynchronous computing logic, so that each frame of the game progress can be quickly replayed. In the game synchronization method provided by the disclosed embodiment, the server records the initial snapshot information at the beginning of the game, saves all the instruction information during the game, and designs two game replay methods: replay through the instruction list and replay through the game snapshot.
[0166] Optionally, the game state of the first client can be replayed in the following ways: pulling the initial state of the game from the server, and pulling instruction information from the server through the instruction list interface, executing the instruction information one by one to achieve game playback; and / or, quickly locating the target instruction by dragging the progress bar, and pulling the game snapshot corresponding to the target instruction from the server.
[0167] Exemplarily, through instruction list playback, that is, the first client pulls the initial state of the game from the server, and pulls the instruction information from the server through the instruction list interface, and executes the instruction information one by one to achieve game playback. In this game playback mode, the user can see the execution effect of each instruction during the game.
[0168] For example, through game snapshot playback: the server stores the game status information after each instruction is executed, and the first client can quickly locate a specific target instruction by dragging the progress bar, and pull the game snapshot corresponding to the target instruction from the server. This game playback method has a great advantage when there are a large number of instructions, and can quickly play back to any time point.
[0169] The following is the above Figure 3 The server shown in is the execution entity, and the game synchronization method provided by the present disclosure is described in detail in combination with specific embodiments.
[0170] Fig.13 FIG. 1 is a flowchart of a game synchronization method provided by another embodiment of the present disclosure. Fig.13 As shown, the specific implementation of the game synchronization method includes the following steps:
[0171] S130, receiving first instruction information uploaded by the second client.
[0172] The first instruction information is similar to the above and will not be repeated here.
[0173] S131, verifying whether the first instruction information is legal.
[0174] The specific implementation method is similar to the above and will not be repeated here.
[0175] S132, in response to the first instruction information being legal, the first instruction information is sent to the first client, and the first client updates the game state to the first game state according to the first instruction information. The second client and the first client are both player clients participating in the same network interactive game.
[0176] The specific implementation method is similar to the above and will not be repeated here.
[0177] In the disclosed embodiment, the server receives the first instruction information uploaded by the second client, verifies whether the first instruction information is legal, and sends the first instruction information to the first client if the first instruction information is legal, so that the first client updates the game state to the first game state according to the first instruction information. In the disclosed embodiment, the server verifies the instruction information uploaded by the second client, and sends it to the first client after verification of legality, so as to achieve the accuracy of interactive game instruction synchronization. Furthermore, after receiving the instruction information, the first client updates the game state in real time according to the instruction information, so as to achieve the real-time nature of interactive game instruction synchronization, thereby achieving synchronization of interactive games.
[0178] Optionally, the specific implementation method of verifying whether the first instruction information is legal in step S131 may be to verify whether basic information of the first instruction information is legal.
[0179] The basic information of the first instruction information is similar to the above and will not be repeated here.
[0180] Optionally, an implementation of the game synchronization method provided by the embodiment of the present disclosure may also include: sending a heartbeat signal to the first client, so that the first client verifies whether the second game state is consistent with the first game state, and when they are inconsistent, responds to receiving an instruction pull compensation request sent by the first client, and sends relevant data of the second game state to the first client, where the heartbeat signal carries the second game state determined according to the first instruction information.
[0181] The specific implementation method is similar to the above and will not be repeated here.
[0182] It should be noted that in the game synchronization method provided by the embodiment of the present disclosure, in addition to verifying the basic information of the first instruction information, the server also verifies the skill release method information of the first instruction information to determine whether the second client has cheated or the game is abnormal. Optionally, the first instruction information is verified to determine whether there is cheating; if there is cheating, the second instruction information uploaded again by the second client is intercepted.
[0183] Exemplarily, when the first instruction information is instruction information corresponding to the use of a skill, if the skill is in a cool-down period at the current moment, but the first instruction information is the user using the skill, then it is determined that the first instruction information contains cheating or game abnormalities, and the server marks the second client, and when the second client uploads the instruction information again, intercepts the instruction information to prevent the client from cheating during the game.
[0184] In a possible implementation, in the asynchronous processing logic, the server verifies whether the first instruction information contains cheating.
[0185] In summary, the following combination Fig.14 The game synchronization method provided by the embodiment of the present disclosure is described in detail.
[0186] Fig.14 This is a schematic diagram of the structure of the game synchronization method provided by the embodiment of the present disclosure. Fig.14 As shown, after receiving the first instruction information uploaded by the second client, the server first verifies the basic information of the first instruction information through the instruction executor of the server, and synchronizes the first instruction information to the instruction synchronization unit of the server after the verification is passed, and further synchronizes the first instruction information to the first client through the instruction synchronization unit. At the same time, the instruction synchronization unit and the first client establish a connection through a timed heartbeat mechanism, and the instruction synchronization unit uses a push-pull combination method to synchronize the game with the first client. The specific implementation method of game synchronization is similar to the above, and will not be repeated here.
[0187] like Fig.14 As shown, the instruction executor on the server verifies the basic information of the first instruction information, and after the verification is passed, delivers the first instruction information to the state response logic unit through asynchronous delivery such as container image service and memory delay queue dual delivery, calculates the game state corresponding to the first instruction information through the instruction event response unit in the state response logic unit, and updates the world state of the server according to the game state. At the same time, when the first client verifies that the game state of the first client is inconsistent with the game state calculated by the server, it obtains the relevant data of the corresponding game state from the server through a combination of push and pull, and updates the game state according to the relevant data. The specific implementation method is similar to the above, and will not be repeated here.
[0188] like Fig.14 As shown, after calculating the game state corresponding to the first instruction information, the server further synchronizes the game state corresponding to the first instruction information to the state machine transformation response unit, and when it is detected that the first client is a robot or a hosting mode, the game state of the first client is automatically updated to the game state corresponding to the first instruction information, thereby realizing robot anthropomorphism.
[0189] like Fig.14 As shown, after the server calculates the game state corresponding to the first instruction information, the computing module unit in the server can also calculate the changes that the corresponding instructions in the instruction information will make to the game state based on the business logic, the instruction information and some previous world states in the state response logic unit, and further predict the user's next one or more executable instructions through the calculated changes, and select one instruction from them to be executed by the system, i.e., executed by the robot.
[0190] like Fig.14 As shown, the server can also be used to check the user behavior delay, and when it is detected that the user has not executed the instruction within a specific time, the user behavior is switched to the robot hosting mode. It is understandable that in the robot hosting mode, the delay execution unit can be used to simulate the delay in the user's actual operation to make the user operation more realistic.
[0191] In summary, the game synchronization method provided by the embodiment of the present disclosure can achieve the following beneficial effects:
[0192] 1) By combining frame synchronization and state synchronization, the game synchronization efficiency and data correctness of online interactive games can be improved. At the same time, the game synchronization method does not need to introduce complex game engines and frameworks to effectively achieve data synchronization of online interactive games, which helps businesses quickly develop and launch game products;
[0193] 2) Based on the real-time communication between the client and the server through long polling heartbeat, the game synchronization is carried out in a push-pull manner to achieve game synchronization in weak network conditions;
[0194] 3) Return the command identification based on the heartbeat mode to achieve real-time perception of command synchronization;
[0195] 4) The server asynchronously delivers the game status corresponding to the calculation instruction information to improve the interactive performance and prevent the client from cheating;
[0196] 5) In case of delayed synchronization of client commands, two game reconnection methods, small disconnection and large reconnection, are provided to improve the speed of resuming the game.
[0197] Exemplary Media
[0198] After introducing the method of the exemplary embodiment of the present disclosure, next, refer to Fig.15 A storage medium according to an exemplary embodiment of the present disclosure is described.
[0199] Fig.15 A schematic diagram of a storage medium provided by an embodiment of the present disclosure. Fig.15As shown, the storage medium 150 stores a program product for implementing the above method according to an embodiment of the present disclosure, which can be a portable compact disk read-only memory (CD-ROM) and includes program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto.
[0200] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0201] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable signal medium may also be any readable medium other than a readable storage medium.
[0202] Program code for performing the disclosed operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0203] Exemplary Devices
[0204] After introducing the medium of the exemplary embodiment of the present disclosure, next, reference is made to Fig.16 The game synchronization device of the exemplary embodiment of the present disclosure is described, which is used to implement the method in any of the above method embodiments. The implementation principle and technical effect are similar and will not be repeated here.
[0205] Fig.16 Schematic diagram of the structure of a game synchronization device provided by an embodiment of the present disclosure. Fig.16 As shown, the game synchronization device 160 of the embodiment of the present disclosure includes: a receiving module 161 and an updating module 162. Among them:
[0206] The receiving module 161 is used to receive the first instruction information sent by the server, the first instruction information is uploaded to the server by the second client, and the server verifies the first instruction information is legal and sends it to the first client. The second client and the first client are both player clients participating in the same network interactive game;
[0207] The updating module 162 is used to update the game state to the first game state according to the first instruction information.
[0208] In a possible implementation, the game synchronization device also includes a processing module 163, which is used to: receive a heartbeat signal sent by the server, the heartbeat signal carrying a second game state determined by the server based on the first instruction information; verify whether the second game state is consistent with the first game state; if not, obtain relevant data of the second game state from the server, and update the game state based on the relevant data.
[0209] In a possible implementation, the processing module 163 is further used to: send an instruction to pull a compensation request to the server to obtain relevant data of the second game state.
[0210] In one possible implementation, after receiving the first instruction information sent by the server, the processing module 163 is also used to: obtain second instruction information, the second instruction information includes a second instruction identifier, the second instruction information is the previous instruction information of the first instruction information; determine whether the second instruction identifier is the same as the first instruction identifier, the first instruction identifier is the current maximum instruction identifier stored locally by the first client; if they are not the same, send an instruction pull compensation request to the server to obtain the instruction information that is not synchronized by the server.
[0211] In a possible implementation, the processing module 163 is also used to: if they are the same, obtain first checksum information corresponding to the first instruction information, where the first checksum information is generated by the server based on the first instruction information; determine whether there is a difference between the first checksum information and the second checksum information, where the second checksum information is generated by the first client based on the first instruction information; if there is a difference, send a global game state pull compensation request to the server to obtain global game state data, and update the game state data through the global game state data.
[0212] In one possible implementation, the processing module 163 is also used to: respond to the first client's network reconnection, receive third instruction information sent by the server, the third instruction information including a third instruction identifier; calculate the identification difference between the third instruction identifier and the fourth instruction identifier, the fourth instruction identifier being the current maximum instruction identifier stored locally on the first client; determine whether the identification difference exceeds a preset threshold; if the identification difference exceeds the preset threshold, pull the latest game status data from the server through the compensation interface, and update the game status data through the game status data; if the identification difference does not exceed the preset threshold, send an instruction pull compensation request to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client.
[0213] In one possible implementation, the game state of the first client may be replayed in the following manner: pulling the initial state of the game from the server, and pulling instruction information from the server through an instruction list interface, and executing the instruction information one by one to achieve game playback; and / or quickly locating the target instruction by dragging the progress bar, and pulling a game snapshot corresponding to the target instruction from the server.
[0214] In a possible implementation, the second client and the first client establish a real-time connection with the server by polling heartbeats.
[0215] The device of the embodiment of the present disclosure can be used to execute the solution of the game synchronization method in any of the above method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0216] Fig.17 FIG. 1 is a schematic diagram of the structure of a game synchronization device provided by another embodiment of the present disclosure. Fig.17 As shown, the game synchronization device 170 of the embodiment of the present disclosure includes: a receiving module 171, a checking module 172 and a sending module 173.
[0217] in:
[0218] The receiving module 171 is used to receive the first instruction information uploaded by the second client;
[0219] A verification module 172, used to verify whether the first instruction information is legal;
[0220] The sending module 173 is used to respond to the first instruction information being legal and send the first instruction information to the first client. The first client updates the game state to the first game state according to the first instruction information. The second client and the first client are both player clients participating in the same network interactive game.
[0221] In a possible implementation manner, the verification module 172 is specifically used to verify whether the basic information of the first instruction information is legal.
[0222] In a possible implementation, the sending module 173 is also used to: send a heartbeat signal to the first client, so that the first client verifies whether the second game state is consistent with the first game state, and when they are inconsistent, responds to receiving an instruction to pull a compensation request sent by the first client, and sends relevant data of the second game state to the first client, and the heartbeat signal carries the second game state determined according to the first instruction information.
[0223] In a possible implementation, the verification module 172 is further used to: verify whether there is cheating in the first instruction information; if there is cheating, intercept the second instruction information uploaded again by the second client.
[0224] The device of the embodiment of the present disclosure can be used to execute the solution of the game synchronization method in any of the above method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0225] Exemplary Computing Devices
[0226] After introducing the method, medium and apparatus of the exemplary embodiments of the present disclosure, next, reference is made to Fig.18 A computing device according to an exemplary embodiment of the present disclosure is described.
[0227] Fig.18 The computing device 180 shown is only an example and should not bring any limitation to the functionality and scope of use of the embodiments of the present disclosure.
[0228] Fig.18 A schematic diagram of the structure of a computing device provided in one embodiment of the present disclosure. Fig.18 As shown, the computing device 180 is in the form of a general computing device. The components of the computing device 180 may include, but are not limited to: at least one processing unit 181, at least one storage unit 182, and a bus 183 connecting different system components (including the processing unit 181 and the storage unit 182). Exemplarily, the processing unit 181 may be specifically a processor, the storage unit 182 stores computer-executable instructions, and the processing unit 181 executes the computer-executable instructions stored in the storage unit 182 to implement the above-mentioned game synchronization method.
[0229] Bus 183 includes a data bus, a control bus, and an address bus.
[0230] The storage unit 182 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1821 and / or a cache memory 1822 , and may further include a readable medium in the form of a non-volatile memory, such as a read-only memory (ROM) 1823 .
[0231] The storage unit 182 may also include a program / utility 1825 having a set (at least one) of program modules 1824, such program modules 1824 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0232] The computing device 180 may also communicate with one or more external devices 184 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 185. In addition, the computing device 180 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 186. Fig.18 As shown, the network adapter 186 communicates with other modules of the computing device 180 via the bus 183. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the computing device 180, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0233] It should be noted that although several units / modules or sub-units / modules of the game synchronization device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0234] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0235] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A game synchronization method, characterized in that: Applied to the first client, the game synchronization method includes: receiving first instruction information sent by a server, wherein the first instruction information is uploaded to the server by a second client, and the server verifies that the first instruction information is legal and sends it to the first client, wherein the second client and the first client are both player clients participating in the same network interactive game; Update the game state to the first game state according to the first instruction information.
2. The game synchronization method according to claim 1, characterized in that: Also includes: Receiving a heartbeat signal sent by the server, wherein the heartbeat signal carries a second game state determined by the server according to the first instruction information; Verifying whether the second game state is consistent with the first game state; If they are inconsistent, the relevant data of the second game state is obtained from the server, and the game state is updated according to the relevant data.
3. The game synchronization method according to claim 2, characterized in that: The obtaining relevant data of the second game state from the server includes: Send an instruction to the server to pull a compensation request to obtain relevant data of the second game state.
4. The game synchronization method according to any one of claims 1 to 3, characterized in that: After receiving the first instruction information sent by the server, the method further includes: Acquire second instruction information, where the second instruction information includes a second instruction identifier, and the second instruction information is instruction information previous to the first instruction information; Determine whether the second instruction identifier is the same as the first instruction identifier, where the first instruction identifier is the current maximum instruction identifier locally stored by the first client; If they are not the same, an instruction pull compensation request is sent to the server to obtain the instruction information that is not synchronized by the server.
5. The game synchronization method according to claim 4, characterized in that: Also includes: If they are the same, obtaining first checksum information corresponding to the first instruction information, where the first checksum information is generated by the server according to the first instruction information; determining whether there is a difference between the first checksum information and the second checksum information, where the second checksum information is generated by the first client according to the first instruction information; If there is a difference, a global game state pull compensation request is sent to the server to obtain the global game state data, and the game state data is updated through the global game state data.
6. The game synchronization method according to any one of claims 1 to 3, characterized in that: Also includes: In response to the first client reconnecting to the network, receiving third instruction information sent by the server, wherein the third instruction information includes a third instruction identifier; Calculate the difference between the third instruction identifier and the fourth instruction identifier, where the fourth instruction identifier is the current maximum instruction identifier locally stored by the first client; Determining whether the identification difference exceeds a preset threshold; If the identification difference exceeds the preset threshold, the latest game status data of the server is pulled through the compensation interface, and the game status data is updated through the game status data; If the identification difference does not exceed the preset threshold, an instruction pull compensation request is sent to the server to obtain the instruction information corresponding to the identification difference that is missing from the first client.
7. A game synchronization device, characterized in that: Applied to the first client, the game synchronization device comprises: A receiving module, configured to receive first instruction information sent by a server, wherein the first instruction information is uploaded to the server by a second client, and the server verifies that the first instruction information is legal and then sends it to the first client, wherein the second client and the first client are both player clients participating in the same network interactive game; An updating module is used to update the game state to a first game state according to the first instruction information.
8. A computing device comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the game synchronization method according to any one of claims 1 to 6.
9. A storage medium storing computer program instructions, wherein the computer program instructions, when executed, implement the game synchronization method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, wherein when the computer program is executed, the game synchronization method according to any one of claims 1 to 6 is implemented.
