CN112675531A - Data synchronization method and device, computer storage medium and electronic equipment - Google Patents
Data synchronization method and device, computer storage medium and electronic equipment Download PDFInfo
- Publication number
- CN112675531A CN112675531A CN202110008744.8A CN202110008744A CN112675531A CN 112675531 A CN112675531 A CN 112675531A CN 202110008744 A CN202110008744 A CN 202110008744A CN 112675531 A CN112675531 A CN 112675531A
- Authority
- CN
- China
- Prior art keywords
- data
- server
- nth frame
- frame
- calculated
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The application discloses a data synchronization method, a data synchronization device, a computer storage medium and electronic equipment. Wherein, the method comprises the following steps: receiving the Nth frame data sent by the server; judging whether the Nth frame data sent by the server is the same as the pre-calculated Nth frame data or not; the pre-calculated Nth frame data is used for displaying a target picture; under the condition that the Nth frame data sent by the server is different from the pre-calculated Nth frame data, displaying correction prompt information in the target picture, and correcting the target picture; and canceling the display of the correction prompt information after the correction is finished, and updating and displaying the target picture based on the Nth frame data sent by the server. By adopting the method, the accuracy of data synchronization can be improved and the game experience of the player can be improved during the time of network environment card pause.
Description
Technical Field
The present application relates to the field of internet, and in particular, to a data synchronization method and apparatus, a computer storage medium, and an electronic device.
Background
With the hot nature of the Real-Time Strategy (RTS) game, frame synchronization is often used to synchronize the content displayed in the various player clients in order to give the game players a better experience and to reduce the stutter caused by network jitter. That is, when the network is disconnected or stuck, a frame buffer (buffer) is used to store the frame that cannot be operated next in the current network. And after the network is restarted, the frames stored in the buffer are continuously synchronized until no frame exists in the buffer.
Because the requirement of the current game on a real-time display picture is higher, the current frame synchronization scheme still causes the phenomenon of blocking in the game, so that animation delay occurs, the judgment of a game result by a player is wrong in the game process, and the game experience of the player is influenced.
Disclosure of Invention
The embodiment of the application provides a data synchronization method and device, a computer storage medium and an electronic device, which can improve the accuracy of data synchronization and improve the game experience of players during the pause of a network environment card.
In a first aspect, an embodiment of the present application provides a data synchronization method, including:
receiving the Nth frame data sent by the server;
judging whether the Nth frame data sent by the server is the same as the pre-calculated Nth frame data or not; the pre-calculated Nth frame data is used for displaying a target picture;
under the condition that the Nth frame data sent by the server is different from the pre-calculated Nth frame data, displaying correction prompt information in the target picture, and correcting the target picture;
and canceling the display of the correction prompt information after the correction is finished, and updating and displaying the target picture based on the Nth frame data sent by the server.
In a second aspect, an embodiment of the present application provides a data synchronization apparatus, including:
the receiving module is used for receiving the Nth frame data sent by the server;
the judging module is used for judging whether the Nth frame data sent by the server is the same as the pre-calculated Nth frame data; the pre-calculated Nth frame data is used for displaying a target picture;
and the display module is used for updating and displaying the target picture based on the N frame data sent by the server under the condition that the N frame data sent by the server is different from the N frame data calculated in advance.
In a third aspect, an embodiment of the present application provides a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method steps provided in the first aspect of the embodiment of the present application.
In a fourth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps as provided by the first aspect of the embodiments of the present application.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
in the embodiment of the application, data of at least one next frame is calculated in advance according to the currently received synchronous frame of the server for display, a verification mechanism is added, prompt information is displayed in a screen under the condition of a verification error to prompt a user to correct the error, the user is told that the current error is not misjudged, the prompt information is cancelled after the correction is finished, and the display is carried out again according to the latest frame data sent by the server. Therefore, the smoothness of the game picture in the weak network can be ensured, the accuracy of pre-calculation can be corrected in time, the player can clearly know that the game is corrected at present instead of misjudgment, and the experience of the user is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a network architecture diagram of a data synchronization system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of various network delays provided by an embodiment of the present application;
fig. 3 is a schematic diagram of network delay time frame synchronization provided in an embodiment of the present application;
fig. 4 is a schematic flowchart of a data synchronization method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a current frame state according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a pre-algorithm according to an embodiment of the present application;
fig. 7 is a schematic interface diagram illustrating display of correction prompt information in a target screen according to an embodiment of the present disclosure;
fig. 8 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Fig. 1 schematically illustrates a structural diagram of a data synchronization system provided in an embodiment of the present application. As shown in fig. 1, the data synchronization system may include an electronic device 10 and a server 20. Wherein the data of the electronic device may be at least two. Three electronic devices (10a, 10b, 10c) are exemplarily shown in fig. 1. Data interaction between the electronic device 10 and the server 20 can be performed through a network. The network may be a wired network or a wireless network. Wherein the wireless network may be a WiFi network or a mobile data network. The mobile data network may include 5G, 4G, 3G, 2G network, etc. It can be appreciated that different networks correspond to different delays. As shown in fig. 2, the 5G network delays by approximately 15 ms; 4G network delay is about 50 ms; the 3G network delay is approximately 100 ms; 2G network delay is about 400 ms; the WiFi network delay is approximately 20 ms. The delay is further increased when a network is handed off or reconnected.
An RTS game client such as, but not limited to, royal glory, interstellar dispute, halo war, etc. may be installed in each electronic device 10. The server may be an application server corresponding to the game client. The electronic device 10 is used for receiving various operations of the player in the game and sending the operations of the player to the server. The electronic device 10 may be further configured to receive frame data broadcast by the server and carrying player operations, calculate content to be rendered according to the frame data broadcast by the server, and display a related screen.
The server 20 may be configured to receive the frame data carrying the operations of the players sent by the electronic devices 10, and broadcast the frame data to the electronic devices 10 corresponding to all players participating in the current game.
Fig. 3 illustrates a network delay time frame synchronization diagram. As shown in FIG. 3, assume that the participants of the current game include Player A and Player B. Player a logs in the game through the game APP installed on electronic device a. The player B logs in the game through the game APP installed on the electronic device B. When the server initialization is completed, the server may transmit a message that the initialization is completed to the electronic device a and the electronic device B. The advance of the game can be divided into one frame, and the frame is different from the rendering frame rate of the game, and only by using the concept of the frame, the self-defined frame can also be called turn. The process of the game is that each turn is continuously propelled forward, and the turn propulsion speed of each player is consistent. The server collects control instructions for player a and player B at a preset time interval t. And after a preset time interval is reached, updating the collected control instruction to the electronic equipment A and the electronic equipment B so that the electronic equipment A and the electronic equipment B calculate the content to be rendered according to the updating instruction sent by the server and display the related picture. As can be seen from fig. 3, the electronic device a has network delay in the second frame, and the network speed of player a is slow, so that player B feels its own operation delay, while the network is smooth.
In the embodiment of the present application, the electronic device 10 may be a mobile phone, a tablet Computer, a desktop Computer, a laptop Computer, a notebook Computer, an Ultra-mobile Personal Computer (UMPC), a handheld Computer, a netbook, a Personal Digital Assistant (PDA), a wearable electronic device, a virtual reality device, or the like.
Fig. 4 schematically shows a flowchart of a data synchronization method provided by an embodiment of the present application. The data synchronization mode is executed by the electronic equipment corresponding to the players participating in the game. As shown in fig. 4, the data synchronization method may include the following steps:
s401: and receiving the Nth frame data sent by the server.
Specifically, the server may broadcast frame data including respective player control instructions to respective electronic devices participating in the game at preset time intervals. In the embodiment of the present application, the frame data sent by the server may be referred to as an acknowledgement frame.
S402: and judging whether the N frame data sent by the server is the same as the pre-calculated N frame data.
Optionally, after receiving the N-1 th frame data sent by the server, the electronic device may pre-calculate the N-th frame data according to the N-1 th frame data.
Optionally, the electronic device does not receive the N-1 th frame data sent by the server, and the N-th frame data may be pre-calculated according to the pre-calculated N-1 th frame data. The pre-calculated N-1 frame data can be calculated according to the N-2 frame data sent by the server or can be calculated according to the pre-calculated N-2 frame data.
Specifically, the pre-calculated manner may be to make a prejudgment according to the behavior of each player in the last frame data. For example, if the player a issues a control command to move to the right in the N-1 th frame data sent from the server, it can be predicted that the player a will turn to the right in the N-th frame data. For another example, if player B is issuing a skill in the N-1 th frame data calculated in advance, the progress of the skill issued by player B in the N-th frame data may be predicted. The above process of pre-calculating the next frame data may be referred to as prediction.
In the embodiment of the application, only trend prediction can be carried out, and false image prediction is not carried out. The trend prediction is a prediction with basis, and the artifact prediction is a prediction without basis.
Illustratively, if a command for B-player to move to (x, y) is received at frame 100 on the a-player terminal. On the other hand, in the 103 th frame, the a-player terminal does not receive the confirmation frame transmitted from the server due to network jitter, and therefore the a-player terminal needs to perform prediction.
If the B-player does not go to point (x, y), the A-player terminal may predict that the B-player will continue to go to point (x, y). At this time, the prediction made by the player a terminal is the trend prediction, and the basis of the prediction is the command for the player B to move to (x, y) received at the 100 th frame.
If the B player has already walked to the (x, y) point, the A player terminal does not need to predict the next action of the B player, only needs to stand in place and does not predict the false image of the next movement track of the B player. This avoids the situation where B-players are mistakenly positioned due to false predictions and flash from one position to another when frames are rolled back.
Specifically, it may be determined whether the state of the target object in the N-th frame data transmitted by the server is the same as the state of the target object in the N-th frame data calculated in advance. The target object is any one of a plurality of independent objects represented by the Nth frame data. The independent object is an independent object, for example, a player who is giving skills to deal with a monster, the image of the player can be regarded as an independent object, the skills given by the player can be regarded as an independent object, and the monster can be regarded as an independent object. For another example, a mountain, a river, a house, a tree, etc. exist in the background of the current screen, and these objects can be regarded as an independent object.
Specifically, the electronic device may save a game snapshot for the nth frame data sent by the server. The game snapshot is to snapshot data of each system in the game or each object in the game, that is, to save the data of each object in the game to a memory of the electronic device, and may be specifically saved in a log (log) corresponding to the local object. After receiving each frame of data sent by the server, the electronic device can save the game snapshot according to the data frame.
Alternatively, the electronic device only saves the game snapshot of one frame of data, that is, after receiving the next frame of data sent by the server, the electronic device may delete the currently saved game snapshot and save the game snapshot of the next frame of data.
Alternatively, the electronic device may save a game snapshot of a plurality of frames of data, where the number of saved game snapshots depends on the size of the memory, or on default setting parameters of the system, or on user-set parameters.
Optionally, the electronic device may save a snapshot of the game corresponding to each frame of each object from the beginning of creation to the disappearance of the object. This may facilitate verification of game synchronicity after game completion. If the object is a character, the object exists from the start of the game (start of creation) to the end of the game (disappearance of the object). If the object is a skill, the object exists from the start of the player's issuance of the skill (start of creation) to the end of the skill (disappearance of the object). The snapshot is stored for each object of each frame, and when data is asynchronous (namely the pre-calculated frame data is different from the frame data sent by the server), the snapshot can be quickly rolled back to the last synchronous frame without frame-by-frame operation, so that the game performance can be improved, and a game player can not feel obvious abnormal network jitter. In addition, each object has its corresponding log information, and player information can be synchronized by transmitting instruction information to the server in frame synchronization. In the testing stage, the problem of asynchronism can be found according to the frame-by-frame log of each object, and the development time is reduced.
For example, in this embodiment of the application, the state of each object included in the nth frame data currently sent by the server may be generally referred to as a current frame state. The current frame state can be characterized from the following several dimensions: skills, items, mapping devices, players, monsters, etc. It can be understood that different game scene settings and strategy settings are different, and the divisible dimensions are also different, which is not limited in the embodiments of the present application.
Illustratively, as shown in FIG. 5, the current frame state may be characterized from dimensions of skills, items, mapping devices, players, monsters, and so forth. The skills may include buffer skills, attribute skills, AOE skills, and the like. The items may include prop items, random items, and the like. The map devices may include trees, houses, obstacles, rivers, and the like. Players may include player 1, player 2, player 3, and so on. Monsters may include small monsters, large boss, small boss, and the like. That is, each skill, each article, each map device, each player, and each monster listed above may be used as a target object for determining whether the N-th frame data calculated in advance is correct.
Optionally, the electronic device may save the game snapshot according to different scene layer data. Illustratively, in a certain scene, the method can be divided into a map layer, a map effect layer, an object bottom frame layer, an object effect layer, an object top effect User Interface (UI) layer, a map global effect layer, a game UI layer, a game pop-up window layer, a UI effect layer, a new guide layer, and a broadcast message layer. Items of the same type in the same layer, proximity processing (e.g., updating monsters in a map, like monsters stored as an array, with adjacent updates). This is advantageous for a batch Processing mechanism using a Graphics Processing Unit (GPU), which can make the data correction faster. Wherein, each layer of the object has the smallest particles for recording the state of the object, which is called as state element in the embodiment of the application.
Since the above-mentioned game snapshots need to be stored in large quantities before the next confirmation frame is received by the server, many unnecessary reads and writes are generated, and the large number of reads and writes can reduce the speed of the game. Therefore, in the embodiment of the present application, preloading may be performed, that is, the object initializes the state element instance of a small number of frames (for example, 10 frames) at first when initializing, and then stores the state data into the state element when the game snapshot needs to be stored, where the state element may be marked as a used state element. If the current frame is confirmed to be the correct frame by receiving the confirmation frame sent by the server, the data stored by the state element can be removed and returns to the initial state, and the state element is marked to be in an unused state so as to be convenient for the next use.
The pre-calculated frame number may be determined according to the current network type of the electronic device. Further, the pre-calculated number of frames may be determined according to the current network type of the electronic device and the time interval for the server to send data.
For example, if the network type currently accessed by the electronic device a is a 4G network, and the network type currently accessed by the electronic device B is a 2G network. As can be seen from fig. 2, the delay of the 4G network is 40ms, and the delay of the 2G network is 200 ms. If the current server sends frame data once every 40ms, the preset time interval t in fig. 3 is 40 ms. In order to ensure that the data of the electronic device and the server are synchronized, as shown in fig. 6, the electronic device a may calculate 1 frame in advance, and the electronic device B may calculate 5 frames in advance (200 ms/40 ms). The electronic device a (player a) calculates 1 frame in advance and can be regarded as prejudged 1 frame. The electronic device a further calculates the player operation according to the pre-determined 1 frame data, that is, calculates the player operation according to the pre-calculated 1 frame data. The pre-calculation of 5 frames by electronic device B (player B) may be considered to be a prejudged 5 frames. The electronic device B also calculates the player operation according to the pre-determined 5 frames of data, that is, calculates the player operation according to the pre-calculated 5 frames of data.
It should be noted that, in the embodiment of the present application, the prediction may be started when the game starts, that is, the data of the electronic device is always earlier than the data of the server.
S403: and when the N frame data transmitted by the server is different from the N frame data calculated in advance, displaying correction prompting information on the target picture, and correcting the target picture.
Specifically, if the nth frame data sent by the server is different from the N th frame data calculated in advance, it indicates that the N th frame data calculated in advance is wrong.
Specifically, if the state of the target object in the N-th frame data sent by the server is different from the state of the target object in the N-th frame data calculated in advance, it indicates that the N-th frame data sent by the server is different from the N-th frame data calculated in advance. For example, if the target object is player B, player B moves straight in the N-th frame data calculated in advance, and turns left in the N-th frame data transmitted from the server, it indicates that the state of the target object in the N-th frame data transmitted from the server is different from the state of the target object in the N-th frame data calculated in advance.
Specifically, in the case where the N-th frame data calculated in advance is erroneous, it is necessary to correct the data in time and display a correct picture. In the process of correction, in order to avoid that the user thinks that the current error is caused by misjudgment of the player by the system and indicates that correction is currently performed, correction prompt information can be displayed in the target picture. As shown in fig. 7, correction prompt information 701 in the target screen 70 may be used to prompt that "data correction in the middle" is currently being performed.
S404: and canceling the display of the correction prompt information after the correction is finished, and updating the display target picture based on the Nth frame data sent by the server.
Specifically, after the correction is finished, that is, after the data is backed up to the nth frame data, the display correction prompt information may be cancelled, and the display target screen may be updated based on the nth frame data sent by the server.
Specifically, the correction of the target picture may be performed in units of frames, i.e., frame-by-frame back. If the electronic device has already displayed the (N + 3) th frame data according to the pre-calculated result, the electronic device may first go back to the (N + 2) th frame data, then go back to the (N +1) th frame data, and finally go back to the (N) th frame data, and display the target image according to the (N) th frame data sent by the server when going back to the (N) th frame data. Therefore, the end time of waiting for the network jitter can be prolonged, and the perception of the user to the network congestion is reduced to the maximum extent.
In addition, a plurality of objects having different states in the N-th frame data transmitted from the server from the state in the N-th frame data calculated in advance may be provided. The electronic device may update the target screen according to the system snapshot corresponding to all the objects in different states in the nth frame data sent by the server.
Correction is to be noted that, when the network is paused, the data sent by the server may stay in the nth frame, and the frame pre-calculated by the electronic device may have reached the (N + 5) th frame, even the (N + 10) th frame, etc., and the electronic device may render the picture (i.e., display the target picture) in real time according to the pre-calculated frame. And after the network is recovered, the electronic equipment receives the (N +1) th frame sent by the server, and if the data error of the (N +1) th frame calculated in advance is judged, the displayed picture is returned to the (N +1) th frame, and is displayed according to the (N +1) th frame sent by the server. Further, at least one next frame of data is pre-calculated according to the (N +1) th frame of data sent by the server. In the embodiment of the application, the number of frames which can be pre-calculated by the electronic device is limited, and when the number of frames which are pre-calculated reaches the maximum value and the network is not recovered, the picture of the electronic device is blocked and waits for frame data sent by the server after the network is recovered.
It can be known that, after the network is blocked, the electronic device may cache the operation instruction of the user in the buffer, and after the network is restored, the electronic device may sequentially send the operation instruction in the buffer to the server, and after the server collects the operation instruction of each player, the server broadcasts the collected operation instruction to each electronic device. The operation instruction broadcasted by the server is the frame data sent by the server.
According to the embodiment of the application, in the game process of the player, the electronic equipment can be ahead of the server to calculate the added frame data in advance when the network is blocked and can be rendered according to the frame data calculated in advance, so that the picture display of the electronic equipment is still smooth when the network is blocked, and the player can respond quickly. In addition, after the network is recovered, the electronic equipment can verify whether the frame data pre-calculated before is correct or not according to the frame data sent by the server, if not, prompt information can be displayed in a screen to prompt a user that the current error is not misjudged, the prompt information is cancelled after the correction is finished, and a display target picture is updated. Under the condition that the network jitter is not particularly serious, the synchronous display of the pictures on each electronic device can be ensured, the smooth display of the pictures can be ensured, and the game experience of the player is ensured. After disconnection reconnection or error prediction, the current frame can be quickly synchronized, and very small performance overhead is ensured.
Fig. 8 is a schematic flowchart illustrating another data synchronization method provided in an embodiment of the present application. As shown in fig. 8, the data synchronization method may include the following steps:
s801: and receiving the data of the N-1 th frame sent by the server.
Specifically, the server may broadcast frame data including respective player control instructions to respective electronic devices participating in the game at preset time intervals.
S802: the type of network currently accessed is determined.
In particular, the type of network the electronic device accesses may be detected by a wireless communication module in the electronic device. Different network types correspond to different delay durations. As shown in particular in figure 3.
S803: the pre-calculated number of frames is determined according to the network type.
Specifically, the pre-calculated number of frames may be determined according to the current network type of the electronic device. Further, the pre-calculated number of frames may be determined according to the current network type of the electronic device and the time interval for the server to send data.
For example, if the network type currently accessed by the electronic device a is a 4G network, and the network type currently accessed by the electronic device B is a 2G network. As can be seen from fig. 2, the delay of the 4G network is 40ms, and the delay of the 2G network is 200 ms. If the current server sends frame data once every 40ms, the preset time interval t in fig. 3 is 40 ms. In order to ensure that the data of the electronic device and the server are synchronized, as shown in fig. 6, the electronic device a may calculate 1 frame in advance, and the electronic device B may calculate 5 frames in advance (200 ms/40 ms). The electronic device a (player a) calculates 1 frame in advance and can be regarded as prejudged 1 frame. The electronic device a further calculates the player operation according to the pre-determined 1 frame data, that is, calculates the player operation according to the pre-calculated 1 frame data. The pre-calculation of 5 frames by electronic device B (player B) may be considered to be a prejudged 5 frames. The electronic device B also calculates the player operation according to the pre-determined 5 frames of data, that is, calculates the player operation according to the pre-calculated 5 frames of data.
It is known that an electronic device may detect the type of network it accesses at preset time intervals and determine the pre-calculated number of frames according to the type of network. Therefore, the electronic equipment can be ensured to detect the network switching in time, and the pre-calculated frame number corresponding to the switched network can be calculated.
It should be noted that, in the embodiment of the present application, the order of implementation of S801 and S802 to S803 is not limited.
S804: and calculating at least one next frame data based on the N-1 frame data sent by the server, and displaying the target picture based on the at least one frame data.
Specifically, the pre-calculated manner may be to make a prejudgment according to the behavior of each player in the last frame data. For example, if the player a issues a control command to move to the right in the N-1 th frame data sent from the server, it can be predicted that the player a will turn to the right in the N-th frame data. For another example, if player B is issuing a skill in the N-1 th frame data calculated in advance, the progress of the skill issued by player B in the N-th frame data may be predicted.
S805: and receiving the Nth frame data sent by the server.
Specifically, S805 is identical to S401, and is not described herein again.
S806: and determining the state of the target object in the Nth frame data based on the Nth frame data sent by the server.
Specifically, the target object is any one of a plurality of independent objects represented by the nth frame data. The independent object is an independent object, for example, a player who is giving skills to deal with a monster, the image of the player can be regarded as an independent object, the skills given by the player can be regarded as an independent object, and the monster can be regarded as an independent object. For another example, a mountain, a river, a house, a tree, etc. exist in the background of the current screen, and these objects can be regarded as an independent object.
Specifically, the electronic device may save a game snapshot for the nth frame data sent by the server. The game snapshot is to snapshot data of each system in the game or each object in the game, that is, to save the data of each object in the game to a memory of the electronic device, which may be specifically saved in a local log (log). After receiving each frame of data sent by the server, the electronic device can save the game snapshot according to the data frame.
For example, in this embodiment of the application, the state of each object included in the nth frame data currently sent by the server may be generally referred to as a current frame state. The current frame state can be characterized from the following several dimensions: skills, items, mapping devices, players, monsters, etc. It can be understood that different game scene settings and strategy settings are different, and the divisible dimensions are also different, which is not limited in the embodiments of the present application.
S807: and judging whether the state of the target object in the N frame data sent by the server is the same as the state of the target object in the pre-calculated N frame data. If yes, go to S811; if not, go to S808.
Specifically, if the nth frame data sent by the server is different from the N th frame data calculated in advance, it indicates that the N th frame data calculated in advance is wrong, and S808 is executed; if the N-th frame data transmitted by the server is the same as the pre-calculated N-th frame data, it indicates that the pre-calculated N-th frame data is correct, and S811 is performed.
S808: and displaying correction prompt information in the target picture to correct the target picture.
Specifically, S808 is identical to S403, and is not described herein again.
S809: and canceling the display of the correction prompt information after the correction is finished, and updating the display target picture based on the Nth frame data sent by the server.
Specifically, S809 is identical to S404, and is not described here again.
S810: and pre-calculating at least one next frame data based on the Nth frame data sent by the server.
Specifically, after correcting the pre-calculated frame data, the electronic device may continue to pre-calculate the next frame data based on the current frame (nth frame) data to synchronize the data displayed by the electronic device with the data transmitted by the server. The nth frame data transmitted by the server at this time may be based on a calculation basis as the N +1 th frame data, and S801-S810 are circularly performed to promote the progress of the game. That is, N may be set to N-1 at this time to return to S801.
S811: and receiving the N +1 th frame data sent by the server.
Specifically, if the nth frame data sent by the server is the same as the N th frame data calculated in advance, indicating that the N th frame data calculated in advance is correct, the electronic device may wait until the next frame (N +1) data sent by the server arrives and verify whether the N +1 th frame data calculated in advance is correct using the next frame data.
According to the embodiment of the application, in the game process of the player, the electronic equipment can be ahead of the server to calculate the added frame data in advance when the network is blocked and can be rendered according to the frame data calculated in advance, so that the picture display of the electronic equipment is still smooth when the network is blocked, and the player can respond quickly. In addition, after the network is recovered, the electronic equipment can verify whether the frame data pre-calculated before is correct according to the frame data sent by the server, can display prompt information in a screen to prompt a user that the frame data is corrected, tell the user that the current error is not misjudgment, cancel the prompt information after the correction is finished, and update the display target picture. Under the condition that the network jitter is not particularly serious, the synchronous display of the pictures on each electronic device can be ensured, the smooth display of the pictures can be ensured, and the game experience of the player is ensured. After disconnection reconnection or error prediction, the current frame can be quickly synchronized, and very small performance overhead is ensured.
Fig. 9 schematically shows a structural diagram of a data synchronization apparatus provided in an embodiment of the present application. As shown in fig. 9, the data synchronization device 90 may include: a receiving module 910, a determining module 920, a correcting module 930, and a displaying module 940. Wherein:
a receiving module 910, configured to receive the nth frame data sent by the server.
A determining module 920, configured to determine whether the nth frame data sent by the server is the same as the N nth frame data calculated in advance; and the pre-calculated N-1 frame data is used for displaying a target picture.
A correcting module 930, configured to display correction prompt information on the target screen and correct the target screen when the nth frame data sent by the server is different from the N nth frame data calculated in advance.
And a display module 940, configured to cancel displaying the correction prompt information after the correction is completed, and update and display the target picture based on the nth frame data sent by the server.
In some possible embodiments, the correcting module 930 is specifically configured to, in a case that the nth frame data sent by the server is different from the N nth frame data calculated in advance, display a correction prompt message in the target screen, and correct the target screen in units of frames.
In some possible embodiments, the pre-calculated nth frame data is obtained based on the nth-1 frame data sent by the server.
In some possible embodiments, the pre-calculated Nth frame data is obtained based on pre-calculated N-1 th frame data.
In some possible embodiments, the data synchronization device 90 further includes: a calculating module, configured to calculate, in advance, at least one next frame of data based on the N-1 frame of data sent by the server before the receiving module 910 receives the N frame of data sent by the server.
The display module 930 is further configured to: displaying a target picture based on the at least one frame of data; the N-1 frame data is data which is sent by the server at last; the at least one frame of data pre-computed includes nth frame of data.
In some possible embodiments, the data synchronization device 90 further includes: and the determining module is used for determining the state of the target object in each frame of data based on the frame of data sent by the server before the calculating module pre-calculates at least one next frame of data based on the N-1 th frame of data sent by the server.
The determining module 920 is specifically configured to determine whether a state of the target object in the N-th frame data sent by the server is the same as a state of the target object in the N-th frame data calculated in advance.
The correcting module 930 is specifically configured to, when a state of the target object in the N-th frame data sent by the server is different from a state of the target object in the N-th frame data calculated in advance, display correction prompt information based on the target screen, and correct the target screen.
In some possible embodiments, the calculation module is further configured to pre-calculate at least one next frame data based on the nth frame data sent by the server after the display module updates and displays the target screen based on the nth frame data sent by the server.
In some possible embodiments, the receiving module 910 is further configured to: and receiving the (N +1) th frame data transmitted by the server under the condition that the (N) th frame data transmitted by the server is the same as the (N) th frame data calculated in advance.
In some possible embodiments, the determining module is further configured to: and determining the currently accessed network type before the display module pre-calculates at least one next frame of data based on the N-1 frame of data sent by the server and displays a target picture based on the at least one frame of data.
The determination module is further configured to: and determining the pre-calculated frame number according to the network type.
In some possible embodiments, the target object is any one of a plurality of independent objects represented by the nth frame data.
In some possible embodiments, the nth frame data sent by the server includes control instructions sent by electronic devices corresponding to at least two players.
According to the embodiment of the application, in the game process of the player, the electronic equipment can be ahead of the server to calculate the added frame data in advance when the network is blocked and can be rendered according to the frame data calculated in advance, so that the picture display of the electronic equipment is still smooth when the network is blocked, and the player can respond quickly. In addition, after the network is recovered, the electronic equipment can verify whether the frame data pre-calculated before is correct according to the frame data sent by the server, can display prompt information in a screen to prompt a user that the frame data is corrected, tell the user that the current error is not misjudgment, cancel the prompt information after the correction is finished, and update the display target picture. Under the condition that the network jitter is not particularly serious, the synchronous display of the pictures on each electronic device can be ensured, the smooth display of the pictures can be ensured, and the game experience of the player is ensured. After disconnection reconnection or error prediction, the current frame can be quickly synchronized, and very small performance overhead is ensured.
It should be noted that, when the data synchronization apparatus provided in the foregoing embodiment executes the data synchronization method, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the data synchronization device and the data synchronization method provided by the above embodiments belong to the same concept, and details of implementation processes thereof are referred to in the method embodiments and are not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 10, the electronic device 100 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, memory 1005, at least one communication bus 1002.
Wherein a communication bus 1002 is used to enable connective communication between these components.
The user interface 1003 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
The Memory 1005 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable medium. The memory 1005 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 10, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a data synchronization application.
In the electronic device 100 shown in fig. 10, the user interface 1003 is mainly used as an interface for providing input for a user, and acquiring data input by the user; the processor 1001 may be configured to call the data synchronization application stored in the memory 1005, and specifically perform the following operations:
receiving the Nth frame data sent by the server;
judging whether the Nth frame data sent by the server is the same as the pre-calculated Nth frame data or not; the pre-calculated Nth frame data is used for displaying a target picture;
under the condition that the Nth frame data sent by the server is different from the pre-calculated Nth frame data, displaying correction prompt information in the target picture, and correcting the target picture;
and canceling the display of the correction prompt information after the correction is finished, and updating and displaying the target picture based on the Nth frame data sent by the server.
In some possible embodiments, when the processor 1001 corrects the target picture, it is specifically configured to: and correcting the target picture by taking a frame as a unit.
In some possible embodiments, before the processor 1001 receives the nth frame data sent by the server, it is further configured to:
pre-calculating at least one next frame data based on the N-1 frame data sent by the server, and displaying a target picture based on the at least one frame data; the N-1 frame data is data which is sent by the server at last; the at least one frame of data pre-computed includes nth frame of data.
In some possible embodiments, the pre-calculated nth frame data is obtained based on the nth-1 frame data sent by the server.
In some possible embodiments, the pre-calculated Nth frame data is obtained based on pre-calculated N-1 th frame data.
In some possible embodiments, before the processor 1001 pre-calculates at least one next frame data based on the N-1 th frame data sent by the server, the processor is further configured to:
determining the state of a target object in each frame data based on the frame data sent by the server;
the processor 1001 determines whether the nth frame data sent by the server is the same as the pre-calculated nth frame data, and specifically executes:
judging whether the state of the target object in the N frame data sent by the server is the same as the state of the target object in the pre-calculated N frame data or not;
when the nth frame data sent by the server is different from the N th frame data calculated in advance, the processor 1001 updates and displays the target screen based on the nth frame data sent by the server, and specifically executes: and in the case that the state of the target object in the N frame data sent by the server is different from the state of the target object in the pre-calculated N frame data, updating and displaying the target screen based on the N frame data sent by the server.
In some possible embodiments, after the processor 1001 updates and displays the target screen based on the nth frame data sent by the server, the processor is further configured to: and pre-calculating at least one next frame data based on the Nth frame data sent by the server.
In some possible embodiments, the processor 1001 is further configured to perform: and receiving the (N +1) th frame data transmitted by the server under the condition that the (N) th frame data transmitted by the server is the same as the (N) th frame data calculated in advance.
In some possible embodiments, the processor 1001 is further configured to, before calculating the next at least one frame data in advance based on the N-1 th frame data sent by the server and displaying the target screen based on the at least one frame data, perform:
determining the type of a currently accessed network;
and determining the pre-calculated frame number according to the network type.
In some possible embodiments, the target object is any one of a plurality of independent objects represented by the nth frame data.
In some possible embodiments, the nth frame data sent by the server includes control instructions sent by electronic devices corresponding to at least two players.
According to the embodiment of the application, in the game process of the player, the electronic equipment can be ahead of the server to calculate the added frame data in advance when the network is blocked and can be rendered according to the frame data calculated in advance, so that the picture display of the electronic equipment is still smooth when the network is blocked, and the player can respond quickly. In addition, after the network is recovered, the electronic equipment can verify whether the frame data pre-calculated before is correct according to the frame data sent by the server, can display prompt information in a screen to prompt a user that the frame data is corrected, tell the user that the current error is not misjudgment, cancel the prompt information after the correction is finished, and update the display target picture. Under the condition that the network jitter is not particularly serious, the synchronous display of the pictures on each electronic device can be ensured, the smooth display of the pictures can be ensured, and the game experience of the player is ensured. After disconnection reconnection or error prediction, the current frame can be quickly synchronized, and very small performance overhead is ensured.
Embodiments of the present application also provide a computer-readable storage medium, which stores instructions that, when executed on a computer or a processor, cause the computer or the processor to perform one or more of the steps in the embodiments shown in fig. 4 or fig. 8. The respective constituent modules of the data synchronization apparatus may be stored in the computer-readable storage medium if they are implemented in the form of software functional units and sold or used as independent products.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in or transmitted over a computer-readable storage medium. The computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)), or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., Digital Versatile Disk (DVD)), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. And the aforementioned storage medium includes: various media capable of storing program codes, such as a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, and an optical disk. The technical features in the present examples and embodiments may be arbitrarily combined without conflict.
The above-described embodiments are merely preferred embodiments of the present application, and are not intended to limit the scope of the present application, and various modifications and improvements made to the technical solutions of the present application by those skilled in the art without departing from the design spirit of the present application should fall within the protection scope defined by the claims of the present application.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110008744.8A CN112675531A (en) | 2021-01-05 | 2021-01-05 | Data synchronization method and device, computer storage medium and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110008744.8A CN112675531A (en) | 2021-01-05 | 2021-01-05 | Data synchronization method and device, computer storage medium and electronic equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN112675531A true CN112675531A (en) | 2021-04-20 |
Family
ID=75457382
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110008744.8A Pending CN112675531A (en) | 2021-01-05 | 2021-01-05 | Data synchronization method and device, computer storage medium and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112675531A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113144620A (en) * | 2021-05-20 | 2021-07-23 | 北京字节跳动网络技术有限公司 | Detection method, device, platform, readable medium and equipment for frame synchronization game |
| CN113577761A (en) * | 2021-07-02 | 2021-11-02 | 深圳迭代如风网络科技有限公司 | High-precision synchronous prediction rollback method based on certainty |
| CN115554695A (en) * | 2021-10-30 | 2023-01-03 | 深圳小悠娱乐科技有限公司 | Method for predicting network fluctuation of network data in battle game |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102640511A (en) * | 2009-11-27 | 2012-08-15 | 三菱电机株式会社 | Method and system for playing video information, and video information content |
| CN111167116A (en) * | 2019-09-29 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Smooth display method, terminal and computer storage medium |
| CN111629262A (en) * | 2020-05-08 | 2020-09-04 | Oppo广东移动通信有限公司 | Video image processing method and device, electronic device and storage medium |
-
2021
- 2021-01-05 CN CN202110008744.8A patent/CN112675531A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102640511A (en) * | 2009-11-27 | 2012-08-15 | 三菱电机株式会社 | Method and system for playing video information, and video information content |
| CN111167116A (en) * | 2019-09-29 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Smooth display method, terminal and computer storage medium |
| CN111629262A (en) * | 2020-05-08 | 2020-09-04 | Oppo广东移动通信有限公司 | Video image processing method and device, electronic device and storage medium |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113144620A (en) * | 2021-05-20 | 2021-07-23 | 北京字节跳动网络技术有限公司 | Detection method, device, platform, readable medium and equipment for frame synchronization game |
| CN113577761A (en) * | 2021-07-02 | 2021-11-02 | 深圳迭代如风网络科技有限公司 | High-precision synchronous prediction rollback method based on certainty |
| CN113577761B (en) * | 2021-07-02 | 2024-06-04 | 深圳迭代如风网络科技有限公司 | High-precision synchronous prediction rollback method based on certainty |
| CN115554695A (en) * | 2021-10-30 | 2023-01-03 | 深圳小悠娱乐科技有限公司 | Method for predicting network fluctuation of network data in battle game |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112675531A (en) | Data synchronization method and device, computer storage medium and electronic equipment | |
| US10771565B2 (en) | Sending application input commands over a network | |
| US20230218999A1 (en) | Information control method and apparatus in game, and electronic device | |
| CN111182226B (en) | Method, device, medium and electronic equipment for synchronous working of multiple cameras | |
| CN111527523A (en) | Apparatus and method for sharing virtual reality environment | |
| JP2015144836A (en) | Video game processing device and video game processing program | |
| US20170354885A1 (en) | Non-transitory storage medium having stored therein information processing program, information processing device, information processing system, and information processing method | |
| WO2019223354A1 (en) | Animation display method and apparatus, electronic device, and storage medium | |
| CN107803029B (en) | Display processing methods and related products | |
| CN114699767B (en) | Game data processing method, device, medium and electronic equipment | |
| CN111569436A (en) | Processing method, device and equipment based on interaction in live broadcast fighting | |
| CN109144642B (en) | Display control method, display control device, electronic equipment and storage medium | |
| CN113198179B (en) | Steering control method and device for virtual object, storage medium and electronic equipment | |
| CN111672132A (en) | Game control method, game control device, server, and storage medium | |
| WO2025044461A1 (en) | Frame animation processing method and apparatus, electronic device, and storage medium | |
| CN109603153B (en) | Virtual event processing method and device, electronic equipment and storage medium | |
| CN113975802B (en) | Game control method, device, storage medium and electronic device | |
| CN117193578A (en) | Signal processing method, device, storage medium and vehicle | |
| CN112995774B (en) | Video playback method, device, terminal and storage medium | |
| CN115098000B (en) | Image processing methods, devices, electronic equipment and storage media | |
| US12001655B2 (en) | Synchronizing user actions to account for data delay | |
| CN114879926B (en) | Information drawing processing method, device, electronic device and storage medium | |
| JP7406930B2 (en) | Game program, game processing method, and information processing device | |
| CN114840285B (en) | Processing method, device, terminal device and storage medium in game | |
| US20220083766A1 (en) | Computer program, server, terminal device, system, and method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |