Method, device and electronic device for synchronizing game object positions in games
By using displacement calculation formulas to predict the position of game objects in the game, the performance pressure and lagging problems of terminal devices are solved, and efficient synchronization and smooth performance of game object positions are achieved.
Patent Information
- Application Number
- CN202210361761.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-04-07
AI Technical Summary
Achieving synchronization in the game requires the terminal device to transmit a large amount of data, resulting in high performance pressure, and the existing technology is prone to lags when the network fluctuates.
By receiving the displacement command of the game object sent by the terminal device, the displacement calculation formula corresponding to the motion type is obtained, and the initial motion state data is filled in to generate the target displacement calculation formula, and synchronized to the target terminal device, so that it can predict the position of the game object based on the calculation formula. Reduce the amount of data transmission and reduce device performance pressure.
It achieves smooth synchronization of the positions of game objects, reduces the performance pressure on terminal devices, reduces the number of data transmissions, improves the accuracy and fluency of synchronization, and avoids lags caused by network fluctuations.
Smart Images

Figure CN114570017B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of Internet technology, and in particular to a method for synchronizing the position of game objects in a game, a device for synchronizing the position of game objects in a game, an electronic device, and a storage medium. Background Art
[0002] At present, with the rapid development of network technology, online games are gradually entering people's lives. More and more people are playing games through terminal devices (such as smart phones, computers, etc.). People play games to kill their leisure time and make their lives more colorful.
[0003] In simple terms, games can be understood as 3D (three-dimensional) animations that can be controlled by computers. Animations are composed of frames. If the displacement of game objects in the game is a smooth animation viewed from the player's perspective, the position change of the game objects in each frame needs to be kept within a relatively stable range of movement. If the movement range of the game objects is very small or even does not move in some frames, common lag will occur.
[0004] In games, synchronization is a very important concept. Specifically, the content that a player sees on his own terminal device is consistent with the content that other players see on their terminal devices. Specifically, to achieve synchronization, the terminal device needs to transmit the position of the game object in the game to other terminal devices, and the other terminal devices then calculate and display it based on the received position. However, since achieving synchronization in games requires transmitting a large amount of data on the terminal device, the performance pressure of the terminal device is relatively high. Summary of the invention
[0005] The embodiment of the present invention provides a method for synchronizing the positions of game objects in a game, so as to solve the problem in the prior art that a large amount of data needs to be transmitted on a terminal device to achieve synchronization in the game, which puts a great pressure on the performance of the terminal device.
[0006] Correspondingly, an embodiment of the present invention further provides a device for synchronizing the positions of game objects in a game, so as to ensure the implementation and application of the above method.
[0007] In order to solve the above problems, an embodiment of the present invention discloses a method for synchronizing the positions of game objects in a game, the method comprising:
[0008] Receiving a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object;
[0009] Obtaining a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game;
[0010] Filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula;
[0011] The target displacement calculation formula is synchronized to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0012] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0013] Calculating the predicted position of the game object in the game using the target displacement calculation formula;
[0014] If it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0015] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0016] If the corresponding end condition in the target displacement calculation formula is met at the predicted position, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0017] Optionally, the using the target displacement calculation formula to calculate the predicted position of the game object in the game includes:
[0018] Obtaining a generation time of the target displacement calculation formula, and determining an elapsed time after the generation time;
[0019] The elapsed time is entered into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0020] Optionally, after receiving the displacement instruction of the game object in the game sent by the terminal device, the method further includes:
[0021] Obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time;
[0022] Calculating a predicted position of the game object in the game using the initial motion state data and the continued motion time;
[0023] The predicted position is synchronized to the target terminal device.
[0024] Optionally, the initial motion state data includes an initial position, displacement speed, displacement direction and displacement state of the game object.
[0025] Optionally, the using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game includes:
[0026] When the displacement state is a continuing motion state, the initial position, displacement speed, displacement direction and the continuing motion time are used to calculate the predicted position of the game object in the game.
[0027] Optionally, the method further comprises:
[0028] If the next displacement instruction of the game object in the game sent by the terminal device is not received within the specified time, then after the continued movement time, the initial motion state data and the continued movement time are stopped to calculate the predicted position of the game object in the game.
[0029] The embodiment of the present invention further discloses a device for synchronizing the position of a game object in a game, the device comprising:
[0030] A receiving module, configured to receive a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object;
[0031] An acquisition module, used to acquire a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game;
[0032] An obtaining module, used for filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula;
[0033] A synchronization module is used to synchronize the target displacement calculation formula to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0034] Optionally, the device also includes: a stop prediction module, used to use the target displacement calculation formula to calculate the predicted position of the game object in the game; if it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0035] Optionally, the device also includes: a stop prediction module, which is used to send a stop prediction instruction to the target terminal device if the corresponding end condition in the target displacement calculation formula is met at the predicted position, so that the target terminal device stops predicting the position of the game object in the game based on the target displacement calculation formula.
[0036] Optionally, the stop prediction module is used to obtain the generation time of the target displacement calculation formula and determine the elapsed time after the generation time; fill the elapsed time into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0037] Optionally, the device also includes: a position prediction module, used to obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time; using the initial motion state data and the continued movement time, calculate the predicted position of the game object in the game; and synchronize the predicted position to the target terminal device.
[0038] Optionally, the initial motion state data includes an initial position, displacement speed, displacement direction and displacement state of the game object.
[0039] Optionally, the position prediction module is used to calculate the predicted position of the game object in the game by using the initial position, displacement speed, displacement direction and the continued motion time when the displacement state is a continued motion state.
[0040] Optionally, the device also includes: a stop prediction module, which is used to stop using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game after the continued motion time if the next displacement instruction of the game object in the game sent by the terminal device is not received within a specified time.
[0041] An embodiment of the present invention discloses an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the method for synchronizing the position of game objects in the game as described above are implemented.
[0042] An embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for synchronizing the positions of game objects in a game are implemented as described above.
[0043] The embodiment of the present invention further discloses a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the embodiment of the present invention.
[0044] The embodiments of the present invention include the following advantages:
[0045] In an embodiment of the present invention, a displacement instruction of a game object in a game sent by a terminal device is received, a corresponding displacement calculation formula is obtained based on the displacement motion type in the displacement instruction, the initial motion state data in the displacement instruction is filled into the displacement calculation formula to obtain a target displacement calculation formula, and then the target displacement calculation formula is synchronized to the target terminal device, so that the target terminal device predicts the position of the game object based on the target displacement calculation formula. In an embodiment of the present invention, if the displacement motion type of the game object has a corresponding displacement calculation formula, indicating that the game object performs displacement motion according to a certain motion law in the game, then after synchronizing the target displacement calculation formula to the target terminal device, the target terminal device can predict the position of the game object based on the target displacement calculation formula, and only a small amount of data needs to be transmitted to achieve position synchronization, without the need for the terminal device and the server to transmit position data multiple times to achieve position synchronization, thereby reducing the performance pressure of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flowchart of an embodiment of a method for synchronizing positions of game objects in a game according to the present invention;
[0047] Figure 2 It is a schematic diagram of an application environment for synchronizing the positions of game objects in a game of the present invention;
[0048] Figure 3 It is another timing diagram of the present invention for realizing the synchronization process of game objects in the game;
[0049] Figure 4 It is a structural block diagram of an embodiment of a device for synchronizing positions of game objects in a game according to the present invention;
[0050] Figure 5 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] Currently, there are two solutions to achieve game object synchronization in the game: state synchronization and frame synchronization:
[0053] State synchronization:
[0054] The player's terminal device will continuously upload the current position of the game object he controls in the game and broadcast it to other players' terminal devices. After receiving the current position, the other players' terminal devices will smoothly transition the game object from the current position to the next position in the game according to the set interpolation algorithm, thereby achieving position synchronization.
[0055] Frame synchronization:
[0056] The player's terminal device sends the game instructions corresponding to the game object to the server, which receives and summarizes them, and then forwards them to all terminal devices logged in to the same game. The terminal device then performs calculations and displays the corresponding position of the game object based on the received game instructions.
[0057] However, the above two solutions have the following common disadvantages: 1. They require more data for synchronization, and the accuracy and fluency of synchronization are positively correlated with the frequency of data synchronization. 2. They have high requirements for network status. Once network fluctuations occur during the synchronization process, it is easy to cause lag on the synchronized party.
[0058] In addition, frame synchronization is based on game instructions and is performed on local terminal devices. In order to maintain data consistency, more data is needed for correction. State synchronization is limited by the server's frame rate. Even if the terminal device maintains a high frame rate to upload the position of the game object (for example, 25 frames per second), when the server broadcasts data, it is usually impossible to broadcast data at the same frame rate as the terminal device (for example, 10 frames per second), which will cause a certain amount of data loss and cause certain errors in the synchronization of other terminal devices.
[0059] Of course, in practice, in many cases, it is still necessary to use state synchronization and frame synchronization to solve the problem of position synchronization of game objects in the game. However, it is obviously not appropriate to apply these two solutions to all synchronization solutions.
[0060] In the embodiment of the present invention, considering that the movement of the game object in the game has certain rules, and once the displacement movement type of the game object occurs, the position of the game object can be predicted based on the displacement calculation formula over a long period of time. For example, the parabolic movement of the projectile in the game, the linear movement or the ground movement not affected by gravity, etc., these regular movements still use frame synchronization and state synchronization to solve the synchronization problem, but require the terminal device to synchronize a large amount of data to other terminal devices. Therefore, in the embodiment of the present invention, for the regular movement of the game object, a smaller amount of data and a lower synchronization frequency can be used to achieve a smoother and more consistent synchronization effect.
[0061] In one embodiment of the present invention, the method for synchronizing the position of game objects in the game can be run on a local terminal device or a server. When the method for synchronizing the position of game objects in the game is run on a server, the method for synchronizing the position of game objects in the game can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0062] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operation subject of the game program and the game screen presentation subject are separated. The storage and operation of the game object position synchronization method in the game are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a first terminal device, a TV, a computer, a handheld computer, etc.; but the game object position synchronization method in the game is performed by the cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0063] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0064] Reference Figure 1 , shows a flowchart of a method for synchronizing the position of a game object in a game according to an embodiment of the present invention. The embodiment of the present invention may specifically include the following steps:
[0065] Step 101, receiving a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes the displacement motion type of the game object.
[0066] In the embodiment of the present invention, the application executed on the processor of the terminal device can be an application that needs to be downloaded and installed, or an application that can be used immediately after clicking, which is not limited in the embodiment of the present application. The terminal device can be an electronic device such as a smart phone, a tablet computer, a game console, an e-book reader, a multimedia player, a wearable device, a robot, etc.
[0067] The application running on the terminal device may be a game application, and a graphical user interface is rendered on the touch display of the terminal device, and the content displayed by the graphical user interface at least partially includes a partial or complete game scene. In addition, the game scene may include at least one game object, which may be a game virtual character controlled by a player through a mobile terminal, a non-player character (NPC) pre-set by a game developer in a specific game scene, and virtual items (such as stones, bombs, ropes, medicines), etc.
[0068] Among them, displacement motion types can include parabolic motion, accelerated motion, linear uniform motion, etc.
[0069] In a specific implementation, the game object can be controlled by the player through the terminal device to perform displacement movement in the game scene. For example, the player makes the game object fall from the air from rest to perform displacement movement (the displacement movement type is acceleration), makes the game object perform displacement movement on a smooth ground (the displacement movement type is a straight line and uniform speed), throws the game object from the air to the ground to perform displacement movement (the displacement movement type is a parabola), etc. Accordingly, the terminal device extracts the initial position, speed, acceleration, displacement movement type and other data of the game object as the initial motion state data of the game object, and generates a displacement instruction based on the initial motion state data and submits it to the server, and the server then forwards the displacement instruction to other terminal devices.
[0070] Step 102: Obtain a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion rule in the game.
[0071] Step 103: Fill the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula.
[0072] Among them, if the displacement motion of the game object has a certain motion law, then the displacement motion can be expressed by using the displacement operation formula (mathematical formula). For example, acceleration motion can be expressed by the acceleration formula, parabolic motion can be expressed by the parabola formula, and linear uniform motion can be expressed by the speed formula.
[0073] In an embodiment of the present invention, if the displacement motion type has a corresponding displacement calculation formula, after obtaining the displacement calculation formula corresponding to the displacement motion type, the initial motion state data submitted by the terminal device can be filled into the displacement calculation formula to obtain the target displacement calculation formula.
[0074] Of course, if the displacement motion type does not have a corresponding displacement calculation formula, it means that the displacement motion of the game object does not have a certain motion law. In this case, you can choose to use frame synchronization or state synchronization to achieve position synchronization of the game object in the game.
[0075] Step 104: synchronize the target displacement calculation formula to the target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0076] The target terminal device includes other terminal devices that enter the same game as the terminal device. Of course, the target terminal device may also include the terminal device itself, which is not limited in the embodiment of the present invention.
[0077] For example, refer to Figure 2, is a schematic diagram of an application environment for synchronizing the position of a game object in a game of the present invention, wherein the terminal device 201 can submit a displacement instruction containing initial motion state data to the server 202, and the server 202 can determine the displacement operation formula based on the displacement motion type in the initial motion state number, and after filling in the initial motion state data to obtain the target displacement operation formula, the target displacement operation formula can be synchronized to the terminal device 201 and the target terminal device 203, so that the target terminal device 203 can predict the position of the game object based on the target displacement operation formula.
[0078] It can be understood that if the displacement movement of the game object can be expressed by a displacement calculation formula, and therefore the target displacement calculation formula is obtained by filling the initial motion state data submitted by the terminal device into the corresponding displacement calculation formula, it means that within a certain time or under certain conditions, the game object can be moved according to the target displacement calculation formula. Therefore, if all terminal devices predict the position of the game object based on the target displacement calculation formula, the predicted position is accurate, and since there is no need for the terminal device to synchronize the position to other terminal devices, the pressure on the terminal device is reduced.
[0079] It should be noted that if the displacement motion type of the game object does not have a corresponding displacement calculation formula, other solutions can be used to achieve the position synchronization of the game object. For example, frame synchronization or state synchronization can be used to achieve the position synchronization of the game object. The embodiment of the present invention does not need to be limited to this.
[0080] In the above-mentioned method for synchronizing the position of a game object in the game, a displacement instruction of a game object in the game sent by a terminal device is received, a corresponding displacement calculation formula is obtained based on the displacement motion type in the displacement instruction, the initial motion state data in the displacement instruction is filled into the displacement calculation formula, and a target displacement calculation formula is obtained, and then the target displacement calculation formula is synchronized to the target terminal device, so that the target terminal device predicts the position of the game object based on the target displacement calculation formula. In an embodiment of the present invention, if the displacement motion type of the game object has a corresponding displacement calculation formula, indicating that the game object performs displacement motion according to a certain motion law in the game, then after synchronizing the target displacement calculation formula to the target terminal device, the target terminal device can predict the position of the game object based on the target displacement calculation formula, and only a small amount of data needs to be transmitted to achieve position synchronization, and there is no need for the terminal device and the server to transmit position data multiple times to achieve position synchronization, thereby reducing the performance pressure of the device.
[0081] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0082] In an exemplary embodiment, after the step 104 of synchronizing the target displacement calculation formula to the target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method may further include the following steps:
[0083] Calculating the predicted position of the game object in the game using the target displacement calculation formula;
[0084] If it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0085] In an embodiment of the present invention, the displacement movement of the game object is initiated by the client in the terminal device, which notifies the server to prepare to start the displacement movement. At this time, the server will prepare a target displacement calculation formula generated based on the initial motion state data and synchronize it to all terminal devices. After receiving the formula, the terminal device can start predicting the position of the game object based on the target displacement calculation formula to simulate the displacement movement of the game object in the client. At the same time, the server can also start predicting the position of the game object based on the target displacement calculation formula to simulate the displacement movement of the game object in the client.
[0086] In practice, the displacement of a game object may be interrupted during its movement. For example, if the game object is a bomb, it may collide with other objects in the game scene during its parabolic movement. For example, if the bomb collides with obstacles such as the ground or a wall, it will explode and the parabolic movement needs to be ended.
[0087] Therefore, in an embodiment of the present invention, a target displacement calculation formula is used to calculate the predicted position of a game object in the game, and based on the predicted position, it is determined whether a collision with other objects in the game scene will occur. For example, if the predicted position overlaps with the position of other game objects in the game, or the line between the predicted position and the previous position intersects with other game objects, it can be determined that the game object has collided with other game objects in the game, indicating that the movement needs to be ended. A stop prediction instruction is then sent to the target terminal device. After receiving the stop prediction instruction, the target terminal device will stop predicting the position of the game object based on the target displacement calculation formula.
[0088] In the above exemplary embodiment, when the target displacement calculation formula is used to calculate the predicted position of the game object in the game, if it is determined based on the predicted position that the game object collides with other game objects in the game, it means that the game object will no longer continue the displacement movement that conforms to the target displacement calculation formula. In this case, the target terminal device can send a stop prediction instruction to stop predicting the position of the game object in the game based on the target displacement calculation formula, thereby avoiding erroneous position predictions by the server and the target terminal device.
[0089] In an exemplary embodiment, after the step 104 of synchronizing the target displacement calculation formula to the target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method may further include the following steps:
[0090] If the corresponding end condition in the target displacement calculation formula is met at the predicted position, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0091] In practice, when a game object moves in a game scene, in addition to the possibility that the displacement movement may be interrupted (for example, the game object collides with other game objects in the game), which requires ending the prediction of the game object, the prediction of the game object can also be ended when the predicted position meets the corresponding end condition in the target displacement calculation formula.
[0092] Specifically, in order to give players a more realistic gaming experience, the game objects in the game need to conform to the laws of motion in the real world when moving in the game scene. For example, a game object in parabolic motion in the game scene will not continue to move in a parabolic motion if the moving trajectory is a complete parabola. For another example, a game object in accelerated motion in the game scene will not continue to move in an accelerated motion after the moving time reaches a certain moving time.
[0093] In the above exemplary embodiment, the target displacement calculation formula is used to calculate the predicted position of the game object in the game, and it will be detected whether the corresponding end condition in the target displacement calculation formula is met at the predicted position. If the corresponding end condition in the target displacement calculation formula is met at the predicted position, it means that the movement needs to be ended, and a stop prediction instruction is sent to the target terminal device. After receiving the stop prediction instruction, the target terminal device will stop predicting the position of the game object based on the target displacement calculation formula, thereby avoiding erroneous position predictions by the server and the target terminal device.
[0094] In an exemplary embodiment, the step of calculating the predicted position of the game object in the game using the target displacement calculation formula may include the following steps:
[0095] Obtaining a generation time of the target displacement calculation formula, and determining an elapsed time after the generation time;
[0096] The elapsed time is entered into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0097] The target displacement calculation formula can be expressed as: p=F(t).
[0098] Among them, t represents the time that has passed, F represents the displacement method, and p represents the predicted position after time t has passed if the displacement movement is carried out in the method of F.
[0099] As a specific example, the target displacement calculation formula for uniformly accelerated linear motion can be:
[0100] p=F(t)=p0+vt+0.5at*t
[0101] Among them, p0 represents the initial position of the game object, and acceleration represents a, that is, p represents the position reached by the game object after time t, when it starts from p0 and moves at speed v and acceleration a. For example, assuming that the server or target terminal device receives the game object's displacement instruction at time point T0, and then, if the game object moves to time point TN, then t = TN-T0.
[0102] In an embodiment of the present invention, when the terminal device or server calculates the predicted position based on the target displacement calculation formula, the position of the next frame can also be calculated based on the time of each frame (for example, assuming 25 frames per second, the time of each frame is 1 / 25 second). For example, assuming that the game object has moved to p12 in the previous frame, if the time of each frame is t`, then the predicted position of the next frame is p13 = p12 + t`*v + 0.5a*t`.
[0103] Of course, the predicted position calculation method based on the time of each frame has a relatively large error compared to the predicted position calculation method based on the elapsed time. Therefore, if it is used for synchronous and high-speed displacement movement, you can choose to calculate the predicted position from the start of the displacement movement of the game object to the current elapsed time t, which can calculate the most accurate predicted position.
[0104] The application of the embodiments of the present invention reduces the amount of data that needs to be transmitted during position synchronization. In the related art, the position data is synchronized once per frame, and the position may need to be uploaded hundreds of times to complete a displacement. Instead, the embodiments of the present invention only require data synchronization once. For more complex displacement movements, only segmented transmission is required (for example, assuming that the complex position movement includes two types of displacement movements, parabolic movement and acceleration movement, the target displacement movement formulas corresponding to the parabolic movement and acceleration movement can be transmitted in segments). Therefore, the number and quantity of data transmissions are also limited. It can be understood that since other terminal devices can perform position prediction on their own, thereby simulating the displacement movement of game objects in the game on other terminal devices, there is no need to wait for the next frame of synchronized position data. Since there is no need to wait for the terminal device to synchronize the position, the performance of the displacement movement of the game object on other terminal devices will be smoother.
[0105] In order to make those skilled in the art better understand, a specific example is used below for illustration. Figure 3 , is a timing diagram of an overall game object synchronization process in a game according to an embodiment of the present invention, the timing diagram includes a terminal device (client), a server (server) and other terminal devices (others), and the specific process may include:
[0106] 1. Start moving: When the game object in the game of the terminal device starts moving, it sends a displacement instruction to the server;
[0107] 2. Simulate trajectory: The server simulates the trajectory of the game object in the terminal device based on the initial motion state data of the game object in the displacement instruction;
[0108] 3. Sending displacement data; the server sends the displacement data (i.e., the target displacement calculation formula) to the terminal device and other terminal devices;
[0109] 4. Synchronization: In the terminal device, server and other terminal devices, position prediction is performed based on the target displacement calculation formula to simulate the trajectory of the game object.
[0110] 5. Dynamic collision occurs, interrupting displacement; when the movement of the game object is interrupted due to the detection of a collision, or ends normally, the server can send a stop prediction instruction to the terminal device and other terminal devices;
[0111] 6. End of displacement: Based on the stop prediction instruction, the terminal device, server and other terminal devices end the position prediction of the game object.
[0112] By applying the embodiments of the present invention, for game objects whose displacement motion can be expressed by mathematical formulas, a target displacement calculation formula generated based on the initial motion state data of the game object and the displacement calculation formula submitted by the terminal device can be broadcast to all terminal devices at one time, so that the terminal device can simulate the displacement motion of the game object in the game based on the target displacement calculation formula. Of course, for game objects whose displacement motion cannot be expressed by mathematical formulas, frame synchronization or state synchronization can be used to achieve position synchronization of the game objects, thereby realizing a lighter and better performing game object position synchronization method.
[0113] In an exemplary embodiment, after the step 101 of receiving the displacement instruction of the game object in the game sent by the terminal device, the method may further include the following steps:
[0114] Obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time;
[0115] Calculating a predicted position of the game object in the game using the initial motion state data and the continued motion time;
[0116] The predicted position is synchronized to the target terminal device.
[0117] The continuous movement time refers to the time the game object moves in the game before receiving the next displacement instruction.
[0118] In a specific implementation, there may be a situation where the network environment is not good. At this time, the server may not be able to receive the next displacement instruction sent by the terminal device in time. Therefore, in an embodiment of the present invention, the predicted position of the game object in the game is calculated based on the continued motion time and the initial motion state data, and then synchronized to other terminal devices, so that even if the network environment is not good, the displacement movement of the game object in the game in other terminal devices is always smooth.
[0119] In an exemplary embodiment, the initial motion state data may include the initial position, displacement speed, displacement direction and displacement state of the game object. For example, the initial motion state data included in the displacement instruction of a certain frame received by the server include: 1. the initial position p that the game object needs to reach in this frame; 2. the displacement speed v; 3. the displacement direction drc; 4. the displacement state moveState of the game object.
[0120] Specifically, the moving distance can be calculated based on the displacement speed v, displacement direction drc and continued movement time, and the predicted position can be obtained by adding the moving distance to the initial position p. The predicted position is then synchronized to the target terminal device to achieve position synchronization of game objects in the game.
[0121] During the specific implementation process, it is taken into account that the network environment may have network jitter, that is, the delay time is sometimes high and sometimes low. For example, the delay time of this frame may be 100ms (milliseconds), and the delay time of the next frame may be 250ms. Therefore, in an embodiment of the present invention, the value of the continuation time can be dynamically adjusted and generated with reference to the delay time of the current network environment, so that there is actual observable optimization for the network jitter within the range of 100ms to 250ms.
[0122] Of course, if the displacement instruction of the next frame is received when the predicted position is calculated based on the continuous movement time, the displacement movement can be performed at the predicted position based on the displacement instruction of the next frame, so that the displacement movement of the game object in the game is smooth. For example, assuming that the predicted position A is calculated based on the displacement instruction of the previous frame, the game object will move to the predicted position A. At this time, if the displacement instruction of the next frame is received, it will move from the predicted position A to the position B in the displacement instruction of the next frame.
[0123] In the above exemplary embodiment, the predicted position of the game object in the game can be calculated based on the continued motion time generated based on the current network delay and combined with the initial motion state data of the previous frame, and then synchronized to the target terminal device, so that the position synchronization of the game object can be achieved even if the network environment is not good.
[0124] In an exemplary embodiment, the calculating the predicted position of the game object in the game by using the initial motion state data and the continued motion time may include the following steps:
[0125] When the displacement state is a continuing motion state, the initial position, displacement speed, displacement direction and the continuing motion time are used to calculate the predicted position of the game object in the game.
[0126] Among them, the displacement state (moveState) is used to represent whether the game object continues to move in the game.
[0127] In an embodiment of the present invention, if the displacement state in the initial motion state data received in the previous frame is a continued motion state, when no displacement instruction of the next frame is received, it can be determined that the game object is still in displacement motion, and the displacement speed, displacement direction and continued motion time in the displacement instruction of the previous frame can be used to calculate the moving distance, and then the moving distance is added to the initial position in the initial motion state data to obtain the predicted position, which is then synchronized to other terminal devices to achieve position synchronization of the game object.
[0128] Of course, if the displacement state in the displacement instruction received in the previous frame is not a continued motion state, it means that the game object has stopped the displacement movement in the game, and there is no need to use the initial motion state data of the previous frame to predict the position of the game object.
[0129] In the above exemplary embodiment, whether to perform position prediction of the game object is determined according to the displacement state, which can avoid performing position prediction when the game object is no longer displacing and motion, thereby reducing unnecessary consumption of computing performance.
[0130] In an exemplary embodiment, the method may further include the following steps:
[0131] If the next displacement instruction of the game object in the game sent by the terminal device is not received within the specified time, then after the continued movement time, the initial motion state data and the continued movement time are stopped to calculate the predicted position of the game object in the game.
[0132] The designated time may be a continuous exercise time.
[0133] In an embodiment of the present invention, if a displacement instruction for the next frame of a game object is received during the position prediction process, the game object can be controlled to perform displacement movement at the predicted position based on the displacement instruction; if the displacement instruction for the next frame of the game object is still not received after a specified time, it means that the network environment is poor, and the player may no longer be able to play the game normally, and the predicted position is of little significance. Therefore, after a specified time, for example, after the continued movement time, the position prediction of the game object is stopped.
[0134] In the above exemplary embodiment, if the displacement instruction of the next frame is not received within the specified time, the position prediction of the game object can be stopped, so as to reduce the consumption of unnecessary computing performance.
[0135] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0136] Reference Figure 4 , shows a structural block diagram of an embodiment of a device for synchronizing the position of game objects in a game of the present invention. The embodiment of the present invention may specifically include the following modules:
[0137] The receiving module 401 is used to receive a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object;
[0138] An acquisition module 402 is used to acquire a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform a displacement motion according to a certain motion law in the game;
[0139] Obtaining module 403, for filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula;
[0140] The synchronization module 404 is used to synchronize the target displacement calculation formula to the target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0141] In an exemplary embodiment, the apparatus may further include: a stop prediction module, configured to calculate the predicted position of the game object in the game using the target displacement calculation formula; if it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device, so that the target terminal device stops predicting the position of the game object in the game based on the target displacement calculation formula.
[0142] In an exemplary embodiment, the apparatus may further include: a stop prediction module, configured to send a stop prediction instruction to the target terminal device if the corresponding end condition in the target displacement calculation formula is met at the predicted position, so as to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0143] In an exemplary embodiment, the stop prediction module is used to obtain the generation time of the target displacement calculation formula and determine the elapsed time after the generation time; fill the elapsed time into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0144] In an exemplary embodiment, the device may also include: a position prediction module, used to obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time; using the initial motion state data and the continued movement time, calculate the predicted position of the game object in the game; and synchronize the predicted position to the target terminal device.
[0145] In an exemplary embodiment, the initial motion state data may include an initial position, displacement speed, displacement direction, and displacement state of the game object.
[0146] In an exemplary embodiment, the position prediction module is used to calculate the predicted position of the game object in the game using the initial position, displacement speed, displacement direction and the continued motion time when the displacement state is a continued motion state.
[0147] In an exemplary embodiment, the device may also include: a stop prediction module, which is used to stop using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game after the continued motion time if the next displacement instruction of the game object in the game sent by the terminal device is not received within a specified time.
[0148] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0149] In addition, an embodiment of the present invention further provides an electronic device, which may include a terminal device, a server (cluster) and other electronic devices, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0150] Memory 503, used for storing computer programs;
[0151] The processor 501 is used to execute the program stored in the memory 503 to implement the following steps, for example:
[0152] Receiving a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object;
[0153] Obtaining a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game;
[0154] Filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula;
[0155] The target displacement calculation formula is synchronized to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0156] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0157] Calculating the predicted position of the game object in the game using the target displacement calculation formula;
[0158] If it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0159] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0160] If the corresponding end condition in the target displacement calculation formula is met at the predicted position, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0161] Optionally, the using the target displacement calculation formula to calculate the predicted position of the game object in the game includes:
[0162] Obtaining a generation time of the target displacement calculation formula, and determining an elapsed time after the generation time;
[0163] The elapsed time is entered into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0164] Optionally, after receiving the displacement instruction of the game object in the game sent by the terminal device, the method further includes:
[0165] Obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time;
[0166] Calculating a predicted position of the game object in the game using the initial motion state data and the continued motion time;
[0167] The predicted position is synchronized to the target terminal device.
[0168] Optionally, the initial motion state data includes an initial position, displacement speed, displacement direction and displacement state of the game object.
[0169] Optionally, the using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game includes:
[0170] When the displacement state is a continuing motion state, the initial position, displacement speed, displacement direction and the continuing motion time are used to calculate the predicted position of the game object in the game.
[0171] Optionally, the method further comprises:
[0172] If the next displacement instruction of the game object in the game sent by the terminal device is not received within the specified time, then after the continued movement time, the initial motion state data and the continued movement time are stopped to calculate the predicted position of the game object in the game.
[0173] Through the above method, if the displacement movement type of the game object has a corresponding displacement calculation formula, it means that the game object moves according to a certain motion law in the game. Then after synchronizing the target displacement calculation formula to the target terminal device, the target terminal device can predict the position of the game object based on the target displacement calculation formula. Only a small amount of data needs to be transmitted to achieve position synchronization. There is no need for the terminal device and the server to transmit position data multiple times to achieve position synchronization, which reduces the performance pressure of the device.
[0174] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0175] The communication interface is used for communication between the above terminal and other devices.
[0176] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0177] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0178] The embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps described in the embodiment of the method for synchronizing the position of game objects in the game are implemented, for example:
[0179] Receiving a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object;
[0180] Obtaining a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game;
[0181] Filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula;
[0182] The target displacement calculation formula is synchronized to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
[0183] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0184] Calculating the predicted position of the game object in the game using the target displacement calculation formula;
[0185] If it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0186] Optionally, after synchronizing the target displacement calculation formula to a target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes:
[0187] If the corresponding end condition in the target displacement calculation formula is met at the predicted position, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
[0188] Optionally, the using the target displacement calculation formula to calculate the predicted position of the game object in the game includes:
[0189] Obtaining a generation time of the target displacement calculation formula, and determining an elapsed time after the generation time;
[0190] The elapsed time is entered into the target displacement calculation formula to calculate the predicted position of the game object in the game.
[0191] Optionally, after receiving the displacement instruction of the game object in the game sent by the terminal device, the method further includes:
[0192] Obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time;
[0193] Calculating a predicted position of the game object in the game using the initial motion state data and the continued motion time;
[0194] The predicted position is synchronized to the target terminal device.
[0195] Optionally, the initial motion state data includes an initial position, displacement speed, displacement direction and displacement state of the game object.
[0196] Optionally, the using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game includes:
[0197] When the displacement state is a continuing motion state, the initial position, displacement speed, displacement direction and the continuing motion time are used to calculate the predicted position of the game object in the game.
[0198] Optionally, the method further comprises:
[0199] If the next displacement instruction of the game object in the game sent by the terminal device is not received within the specified time, then after the continued movement time, the initial motion state data and the continued movement time are stopped to calculate the predicted position of the game object in the game.
[0200] Through the above method, if the displacement movement type of the game object has a corresponding displacement calculation formula, it means that the game object moves according to a certain motion law in the game. Then after synchronizing the target displacement calculation formula to the target terminal device, the target terminal device can predict the position of the game object based on the target displacement calculation formula. Only a small amount of data needs to be transmitted to achieve position synchronization. There is no need for the terminal device and the server to transmit position data multiple times to achieve position synchronization, which reduces the performance pressure of the device.
[0201] An embodiment of the present invention provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the embodiment of the game object position synchronization method in the above-mentioned game, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0202] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0203] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0204] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0205] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0206] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0207] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0208] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0209] The above is a detailed introduction to a method for synchronizing the position of game objects in a game, a device for synchronizing the position of game objects in a game, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for synchronizing the position of game objects in a game, characterized in that: The method comprises: Receiving a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object; the displacement motion type includes at least parabolic motion, accelerated motion, and linear uniform motion; Obtaining a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game; Filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula; The target displacement calculation formula is synchronized to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
2. The method according to claim 1, characterized in that After synchronizing the target displacement calculation formula to the target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes: Calculating the predicted position of the game object in the game using the target displacement calculation formula; If it is determined based on the predicted position that the game object collides with other game objects in the game, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
3. The method according to claim 2, characterized in that After synchronizing the target displacement calculation formula to the target terminal device so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula, the method further includes: If the corresponding end condition in the target displacement calculation formula is met at the predicted position, a stop prediction instruction is sent to the target terminal device to cause the target terminal device to stop predicting the position of the game object in the game based on the target displacement calculation formula.
4. The method according to claim 2, characterized in that: The using the target displacement calculation formula to calculate the predicted position of the game object in the game includes: Obtaining a generation time of the target displacement calculation formula, and determining an elapsed time after the generation time; The elapsed time is entered into the target displacement calculation formula to calculate the predicted position of the game object in the game.
5. The method according to claim 1, characterized in that After the receiving terminal device sends a displacement instruction of a game object in the game, the method further includes: Obtain the continued movement time of the game object; the continued movement time is generated based on the current network delay time; Calculating a predicted position of the game object in the game using the initial motion state data and the continued motion time; The predicted position is synchronized to the target terminal device.
6. The method according to claim 5, characterized in that The initial motion state data includes the initial position, displacement speed, displacement direction and displacement state of the game object.
7. The method according to claim 6, characterized in that The step of using the initial motion state data and the continued motion time to calculate the predicted position of the game object in the game includes: When the displacement state is a continuing motion state, the initial position, displacement speed, displacement direction and the continuing motion time are used to calculate the predicted position of the game object in the game.
8. The method according to claim 6, characterized in that The method further comprises: If the next displacement instruction of the game object in the game sent by the terminal device is not received within the specified time, then after the continued movement time, the initial motion state data and the continued movement time are stopped to calculate the predicted position of the game object in the game.
9. A device for synchronizing the position of game objects in a game, characterized in that: The device comprises: A receiving module, configured to receive a displacement instruction of a game object in a game sent by a terminal device; the displacement instruction includes initial motion state data of the game object in the game, and the initial motion state data includes a displacement motion type of the game object; the displacement motion type includes at least parabolic motion, accelerated motion, and linear uniform motion; An acquisition module, used to acquire a displacement calculation formula corresponding to the displacement motion type; the displacement calculation formula is used to instruct the game object to perform displacement motion according to a certain motion law in the game; An obtaining module, used for filling the initial motion state data into the displacement calculation formula to obtain a target displacement calculation formula; A synchronization module is used to synchronize the target displacement calculation formula to a target terminal device, so that the target terminal device predicts the position of the game object in the game based on the target displacement calculation formula.
10. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the method for synchronizing the position of game objects in the game as described in any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for synchronizing the position of a game object in a game as claimed in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
System and method for remote control gaming sessions using a mobile device
CN106462910A
Method and device for realizing information synchronization, storage medium and electronic equipment
CN112642143A
