Action synchronization method, device, electronic device and storage medium in game

By obtaining the target position data and current position information issued by the server on the game client, calculating calibration parameters, and calibrating the virtual character position, the problem of client and server position being out of sync in online games is solved, improving the game experience and synchronization consistency. .

CN112206511BActive Publication Date: 2024-08-23NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011103347.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-15
Publication Date
2024-08-23
Estimated Expiration
2040-10-15

AI Technical Summary

Technical Problem

The action synchronization method based on state synchronization in existing online games leads to the problem of asynchronous position of the virtual character between the client and the server, which affects the instant feedback of the game and the player experience.

Method used

By obtaining the target location data issued by the server, combined with the client's current location information, the local location calibration parameters are calculated, and the virtual character's location is calibrated to ensure location synchronization between the client and the server. Historical joystick operation queues and timestamps are used. Perform data processing to reduce the pull of synchronization.

Benefits of technology

It realizes the synchronization of virtual character positions between the game client and the server, improves the game experience, reduces the pulling feeling caused by synchronization, and does not change the running logic of the server, but only optimizes the performance of the client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112206511B
    Figure CN112206511B
Patent Text Reader

Abstract

The present application provides an action synchronization method, device, electronic device and storage medium in a game, and relates to the field of game technology. The method can be applied to a game client, including: obtaining target position data sent by a server; obtaining local position calibration parameters according to the target position data and the current position information of a virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data; calibrating the current position information of the virtual character according to the local position calibration parameters, and obtaining the calibrated position information of the virtual character. By applying the embodiment of the present application, since calibration can be performed based on the current position information of the virtual character predicted by the game client, a smooth rollback can be achieved, so that when the position of the virtual character in the game client is updated and displayed, the pulling feeling caused by synchronization can be reduced during the display process, thereby improving the player experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of game technology, and in particular to an action synchronization method, device, electronic device and storage medium in a game. Background Art

[0002] There are usually two types of mobile synchronization methods for online games: lockstep synchronization and state synchronization. Each of these two synchronization methods has its own advantages and disadvantages. Among them, for state synchronization, it synchronizes various states in the game. The general process is that the client uploads the operation to the server, the server calculates the result of the game behavior after receiving it, and then broadcasts various states in the game. After receiving the state, the client displays the content according to the state.

[0003] When implementing mobile synchronization of online games based on state synchronization, for action online games, since players have very strict requirements for instant feedback on operations in such games, the client is generally used first, that is, the mobile position of the virtual character is updated in advance on the client without waiting for the server position information to be sent.

[0004] However, in the existing synchronization method, due to the error in the position calculation between the client and the server, the position of the virtual character in the client and the server is out of sync. Summary of the invention

[0005] The purpose of this application is to provide a method, device, electronic device and storage medium for synchronizing actions in a game, in response to the deficiencies in the above-mentioned prior art, which can ensure the synchronization of the positions of virtual characters in the game client and server and enhance the gaming experience.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides an action synchronization method in a game, which is applied to a game client, and the method includes:

[0008] Obtaining target location data sent by the server, the target location data including: a sending timestamp, location information of the virtual character, and a frame interval;

[0009] Acquire local position calibration parameters according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is position information predicted by the game client according to the current frame data;

[0010] The current position information of the virtual character is calibrated according to the local position calibration parameters to obtain the calibrated position information of the virtual character.

[0011] Optionally, obtaining the target location data sent by the server includes:

[0012] Determining whether the position data corresponding to the current frame data is received;

[0013] If not, the location data most recently sent by the server is used as the target location data.

[0014] Optionally, acquiring a local position calibration parameter according to the target position data and the current position information of the virtual character includes:

[0015] Acquire a historical joystick operation queue, wherein the joystick operation queue includes: historical joystick information in a preset historical duration, a historical timestamp corresponding to the historical joystick information, and a frame interval;

[0016] Acquire deduced position information according to the historical joystick operation queue and the target position data;

[0017] The local position calibration parameter is obtained according to the current position information of the virtual character and the deduced position information.

[0018] Optionally, acquiring the local position calibration parameter according to the current position information of the virtual character and the deduced position information includes:

[0019] Calculating and obtaining a position difference between the current position information of the virtual character and the deduced position information;

[0020] If it is determined that the position difference is greater than a preset first threshold and less than a second preset threshold, obtaining the local position calibration parameter according to a first preset calibration algorithm;

[0021] If it is determined that the position difference is greater than a second preset threshold, the local position calibration parameters are obtained according to a second preset calibration algorithm.

[0022] Optionally, the method further comprises:

[0023] If the position data corresponding to the current frame data is received, the historical joystick operation queue is updated according to the position data corresponding to the current frame data.

[0024] Optionally, updating the historical joystick operation queue according to the position data corresponding to the current frame data includes:

[0025] Acquire historical joystick information and frame intervals stored in the historical joystick operation queue;

[0026] If it is determined that the number of the historical joystick information is equal to 1, the frame interval is used as the first time difference; or, if it is determined that the number of the historical joystick information is greater than 1, the minimum time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue is calculated and obtained as the first time difference;

[0027] Obtaining a historical timestamp corresponding to the historical joystick information in the historical joystick operation queue and taking the minimum time difference between the timestamp in the position data corresponding to the current frame data as a second time difference;

[0028] The historical joystick operation queue is updated according to the first time difference and the second time difference.

[0029] Optionally, updating the historical joystick operation queue according to the first time difference and the second time difference includes:

[0030] Acquire historical joystick information corresponding to the second time difference, and record the historical timestamp corresponding to the historical joystick information as a reference timestamp;

[0031] The historical joystick operation queue is deleted, and the historical joystick operation queue after the update is obtained.

[0032] Optionally, before obtaining the target location data sent by the server, the method further includes:

[0033] If it is determined that the current frame data includes joystick information, the current joystick information corresponding to the current frame data is added to the historical joystick operation queue.

[0034] Optionally, the method further comprises:

[0035] If it is determined that the current frame data includes joystick information, obtaining a direction parameter of the virtual character according to the joystick information included in the current frame data;

[0036] The orientation of the virtual character is adjusted according to the orientation parameter.

[0037] Optionally, adjusting the orientation of the virtual character according to the orientation parameter includes:

[0038] Obtaining a joystick direction according to the joystick information included in the current frame data;

[0039] The orientation of the virtual character is adjusted according to the current orientation of the virtual character, the joystick direction, the frame interval, and the preset turning angular velocity of the virtual character.

[0040] Optionally, the method further comprises:

[0041] If it is determined that the current frame data includes joystick information, the motion state of the virtual character is set to a moving state; or if it is determined that the current frame data does not include joystick information, the motion state of the virtual character is set to a stopped state.

[0042] In a second aspect, an embodiment of the present application provides an action synchronization device in a game, which is applied to a game client, and the device includes: a first acquisition module, a second acquisition module, and a calibration module;

[0043] The first acquisition module is used to acquire the target location data sent by the server, and the target location data includes: a sending timestamp, location information of the virtual character, and a frame interval;

[0044] The second acquisition module is used to acquire the local position calibration parameter according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data;

[0045] The calibration module is used to calibrate the current position information of the virtual character according to the local position calibration parameters, and obtain the calibrated position information of the virtual character.

[0046] Optionally, the first acquisition module is specifically used to determine whether the position data corresponding to the current frame data is received; if not, the position data most recently sent by the server is used as the target position data.

[0047] Optionally, the second acquisition module is specifically used to acquire a historical joystick operation queue, wherein the joystick operation queue includes: historical joystick information in a preset historical duration, a historical timestamp corresponding to the historical joystick information, and a frame interval;

[0048] Acquire deduced position information according to the historical joystick operation queue and the target position data;

[0049] The local position calibration parameter is obtained according to the current position information of the virtual character and the deduced position information.

[0050] Optionally, the second acquisition module is specifically used to calculate and acquire a position difference between the current position information of the virtual character and the deduced position information;

[0051] If it is determined that the position difference is greater than a preset first threshold and less than a second preset threshold, obtaining the local position calibration parameter according to a first preset calibration algorithm;

[0052] If it is determined that the position difference is greater than a second preset threshold, the local position calibration parameters are obtained according to a second preset calibration algorithm.

[0053] Optionally, the device further includes: an updating module, configured to update a historical joystick operation queue according to the position data corresponding to the current frame data if position data corresponding to the current frame data is received.

[0054] Optionally, the updating module is specifically used to obtain the historical joystick information and frame interval stored in the historical joystick operation queue;

[0055] If it is determined that the number of the historical joystick information is equal to 1, the frame interval is used as the first time difference; or, if it is determined that the number of the historical joystick information is greater than 1, the minimum time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue is calculated and obtained as the first time difference;

[0056] Obtaining a historical timestamp corresponding to the historical joystick information in the historical joystick operation queue and taking the minimum time difference between the timestamp in the position data corresponding to the current frame data as a second time difference;

[0057] The historical joystick operation queue is updated according to the first time difference and the second time difference.

[0058] Optionally, the updating module is specifically configured to obtain historical joystick information corresponding to the second time difference, and record a historical timestamp corresponding to the historical joystick information as a reference timestamp;

[0059] The historical joystick operation queue is deleted, and the historical joystick operation queue after the update is obtained.

[0060] Optionally, the device further includes: an adding module, configured to add current joystick information corresponding to the current frame data to the historical joystick operation queue if it is determined that the current frame data includes joystick information.

[0061] Optionally, the device further includes: an adjustment module, for obtaining a direction parameter of the virtual character according to the joystick information included in the current frame data if it is determined that the current frame data includes joystick information; and adjusting the direction of the virtual character according to the direction parameter.

[0062] Optionally, the adjustment module is specifically configured to obtain a joystick direction according to the joystick information included in the current frame data;

[0063] The orientation of the virtual character is adjusted according to the current orientation of the virtual character, the joystick direction, the frame interval, and the preset turning angular velocity of the virtual character.

[0064] Optionally, the device also includes a setting module for setting the motion state of the virtual character to a moving state if it is determined that the current frame data includes joystick information; or setting the motion state of the virtual character to a stopped state if it is determined that the current frame data does not include joystick information.

[0065] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the action synchronization method in the game of the first aspect mentioned above.

[0066] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the action synchronization method in the game of the first aspect are executed.

[0067] The beneficial effects of this application are:

[0068] The action synchronization method, device, electronic device and storage medium in the game provided by the embodiments of the present application can be applied to a game client, including: obtaining target position data sent by a server, the target position data including: a sending timestamp, position information of a virtual character, and a frame interval; obtaining local position calibration parameters according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data; calibrating the current position information of the virtual character according to the local position calibration parameters, and obtaining the calibrated position information of the virtual character. By applying the embodiments of the present application, the synchronization of the virtual character position between the game client and the server can be ensured through calibration, and during the calibration process, since calibration can be performed based on the current position information of the virtual character predicted by the game client, a smooth rollback can be achieved, so that when the position of the virtual character in the game client is updated and displayed, the pulling feeling caused by synchronization can be reduced during the display process, thereby improving the player experience.

[0069] Based on the above embodiments, it can be seen that although the movement of the virtual character in the game client is carried out first, the virtual character position will be smoothly rolled back according to the target position data sent by the server, thereby ensuring the synchronization between the virtual character positions between the game client and the server and improving the gaming experience; and the action synchronization method in the game provided by the present application may not change the running logic of the game in the server, but only optimize the performance of the game client, and has the characteristic of simple implementation.

[0070] Based on the above embodiments, it can be seen that although the movement of the virtual character in the game client is carried out first, the virtual character position will be smoothly rolled back according to the target position data sent by the server, thereby ensuring the synchronization between the virtual character positions between the game client and the server and improving the gaming experience; and the action synchronization method in the game provided by the present application may not change the running logic of the game in the server, but only optimize the performance of the game client, and has the characteristic of simple implementation. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0072] Figure 1 A flowchart of an action synchronization method in a game provided by an embodiment of the present application;

[0073] Figure 2 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0074] Figure 3 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0075] Figure 4 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0076] Figure 5 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0077] Figure 6 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0078] Figure 7 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application;

[0079] Figure 8 A schematic diagram of functional modules of an action synchronization device in a game provided by an embodiment of the present application;

[0080] Fig. 9 A schematic diagram of functional modules of another action synchronization device in a game provided by an embodiment of the present application;

[0081] Fig.10A schematic diagram of functional modules of another action synchronization device in a game provided by an embodiment of the present application;

[0082] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0084] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0085] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0086] In online games, especially action-type online games, players generally have very strict requirements for instant feedback on their operations. An intuitive solution is to do client-side prediction, that is, the client goes first.

[0087] Client-first is divided into three types according to the status of the virtual character: movement-first, spell-casting-first, and settlement-first. Among them, movement-first means that the movement position of the virtual character is updated in advance on the client side without waiting for the position to be sent from the server side; spell-casting-first means that the feasibility and performance effect of the virtual character's spell casting are determined and updated in advance on the client side without waiting for the spell casting status to be sent from the server side; settlement-first means that the damage settlement caused by the virtual character's attack is predicted and simulated in advance on the client side without waiting for the damage settlement to be sent from the server side. It is understandable that although all three types of first actions are predicted in advance by the client locally, after receiving the status sent by the server, it is still necessary to reconcile the local status and the server calibration status to balance the client performance effect and the real logical status.

[0088] Generally speaking, in game development, move-first is more practically used on the client side than cast-first and settlement-first, because once cast-first and settlement-first fail to predict, it is the difference between having and not having. If the state is rolled back, the experience will be poor; while even if move-first fails to predict, it is only an error in the position of the virtual character. Therefore, a reasonable trade-off is: the client moves first, while cast and settlement rely on the judgment of the server. However, in the existing synchronization method, there is a problem of the position of the virtual character in the client and the server being out of sync.

[0089] In view of this, an embodiment of the present application provides an action synchronization method in a game, which can ensure the synchronization of the positions of virtual characters between a game client and a server, thereby improving the gaming experience.

[0090] Figure 1 The present invention provides a flowchart of an action synchronization method in a game, which can be applied to a game client, which can be installed on a game client device such as a mobile terminal, a computer, or a handheld computer. The game client device can store a game program and is used to present a graphical user interface, which includes a game screen. The game screen can present a virtual character controlled by a player, a non-player character (NPC), such as a virtual pet, a virtual elf, etc. Figure 1 As shown, the method may include:

[0091] S101. Obtain target location data sent by a server, where the target location data includes: a sending timestamp, location information of a virtual character, and a frame interval.

[0092] Among them, the game client and the server can exchange data through frame data. During the interaction, according to the player's operation in the game client, the game client can obtain the frame data in the interaction process and send it to the server. The server can send the corresponding target position data based on the frame data. The target position data may include the sending timestamp, the position information of the virtual character, and the frame interval. For the frame interval, different parameters may correspond to different application scenarios, such as 1 / 30ms, 1 / 60ms, etc., which are not limited in this application.

[0093] In some embodiments, the target position data may be position information predicted by the server based on current frame data, or may be position information predicted based on historical frame data, which is not limited here. The game client can correct the position information of the virtual character by obtaining the target position data, thereby achieving synchronization of the position of the virtual character in the game client and the server.

[0094] S102. Obtain local position calibration parameters according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is position information predicted by the game client according to the current frame data.

[0095] In some embodiments, the current frame data may include corresponding joystick information. The joystick information may be generated by the player manipulating a virtual joystick object. The virtual joystick object may be located in a graphical user interface. The player may control the steering, movement, etc. of the virtual character in the game by manipulating the virtual joystick object. Of course, the above-mentioned game client device may also be connected to other input devices, such as a keyboard, a mouse, a game controller, etc., and the joystick information may be generated by the player manipulating the keyboard, the mouse, the game controller, etc., and this application is not limited thereto.

[0096] Optionally, when the joystick information is generated by the player manipulating a virtual joystick object, the joystick information may include an offset value of the virtual joystick offset from the center of the joystick, which may be any angle value between -180° and 180°; alternatively, when the joystick information is generated by manipulating a keyboard, mouse, game controller, etc., the joystick information may include keyboard key values, mouse signals, game controller input instructions, etc., which are not limited in this application.

[0097] Among them, the current position information of the virtual character is the position information predicted by the game client based on the current frame data, so that in a high-latency network environment, the response speed of the virtual character's movement in the game client to the joystick operation can be improved, thereby improving the gaming experience.

[0098] It can be understood that when the game client obtains the target position data sent by the server, it can obtain the local position calibration parameters based on the target position data and the current position information of the virtual character. The local position calibration parameters can be used to calibrate the position of the virtual character based on the current position information of the virtual character, thereby realizing the synchronization of the virtual character position in the game client and the server.

[0099] S103: Calibrate the current position information of the virtual character according to the local position calibration parameters to obtain the calibrated position information of the virtual character.

[0100] Optionally, the local position calibration parameter may correspond to a position calibration vector. For a game client, the game client may calibrate the current position information of the virtual character according to the local position calibration parameter calculated above, that is, the calibration may be performed based on the current position information of the virtual character predicted by the game client to achieve smooth rollback. In some optional embodiments, the current position of the virtual character may be added to the position calibration vector corresponding to the local position calibration parameter to obtain the calibrated position of the virtual character, but this is not limited thereto.

[0101] For example, suppose the current position information of the virtual character is P A , the local position calibration parameter is P B In some embodiments, the position information of the virtual character after calibration can be P c =P A+ P B , but the actual update method is not limited to this. It can be flexibly set according to the actual application scenario so that the calibrated position information of the virtual character in the game client can be consistent with the position information of the virtual character calculated in the server, thereby ensuring the synchronization of the virtual character position between the game client and the server. It is understandable that, since calibration can be performed based on the current position information of the virtual character predicted by the game client, when the position of the virtual character in the game client is updated, the pulling feeling caused by synchronization can be reduced during the performance process, thereby improving the player experience.

[0102] In summary, the embodiment of the present application provides an action synchronization method in a game, which can be applied to a game client, and the method includes: obtaining target position data sent by a server, the target position data including: a sending timestamp, position information of a virtual character, and a frame interval; obtaining local position calibration parameters according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data; calibrating the current position information of the virtual character according to the local position calibration parameters, and obtaining the calibrated position information of the virtual character. By applying the embodiment of the present application, the synchronization of the virtual character position between the game client and the server can be ensured through calibration, and during the calibration process, since the calibration can be performed based on the current position information of the virtual character predicted by the game client, a smooth rollback can be achieved, so that when the position of the virtual character in the game client is updated and displayed, the pulling feeling caused by synchronization can be reduced during the performance process, thereby improving the player experience.

[0103] Based on the above embodiments, it can be seen that although the movement of the virtual character in the game client is carried out first, the virtual character position will be smoothly rolled back according to the target position data sent by the server, thereby ensuring the synchronization between the virtual character positions between the game client and the server and improving the gaming experience; and the action synchronization method in the game provided by the present application may not change the running logic of the game in the server, but only optimize the performance of the game client, and has the characteristic of simple implementation.

[0104] Optionally, the step of obtaining the target location data sent by the server includes:

[0105] Determine whether the position data corresponding to the current frame data is received; if not, use the position data most recently sent by the server as the target position data.

[0106] The game client can determine the target location data by judging whether the location information corresponding to the current frame data has been received. If not, the location data sent by the server most recently can be used as the target location data. Optionally, the location data sent by the server most recently can be the location data corresponding to the previous frame data of the current frame data, or can be the location data corresponding to any historical frame data before the current frame data, which is not limited in this application.

[0107] Figure 2 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application. Figure 2 As shown, the above method of obtaining the local position calibration parameters based on the target position data and the current position information of the virtual character includes:

[0108] S201, obtaining a historical joystick operation queue.

[0109] The joystick operation queue includes: historical joystick information in a preset historical duration, historical timestamps corresponding to the historical joystick information, and frame intervals.

[0110] Among them, the historical joystick operation queue in the game client can be used to store relevant information of historical joystick operations in a certain period of time. For example, the historical joystick operation queue may include historical joystick information in a preset historical period, historical timestamps corresponding to the historical joystick information, and frame intervals. According to the actual application scenario, the preset historical period can be: 1 minute, 2 minutes, 5 minutes, etc., which is not limited here. Of course, the number of historical joystick information in the preset historical period is not limited. Optionally, it can be 5, 10, etc., which is not limited here.

[0111] S202. Obtain deduced position information according to the historical joystick operation queue and target position data.

[0112] Optionally, when obtaining the deduced position information, the position can be deduced in chronological order based on the historical joystick operation queue and the target position data as the starting point to obtain a new position, and the position information corresponding to the new position can be recorded as the deduced position information.

[0113] For example, the historical joystick operation queue includes historical joystick information X1, historical joystick information X2, and historical joystick information X3, and their corresponding timestamps are T1, T2, and T3, respectively, and T3>T2>T1, that is, the historical joystick information X1 corresponding to T1 is stored first, and the historical joystick information X3 corresponding to T3 is the latest stored, and the target position data P1 is the position information corresponding to the historical joystick information X1, then the game client can obtain the deduced position P according to the local deduction algorithm. Optionally, the deduced position P can be expressed as P=P1+X2*preset speed+X3*preset speed. Of course, according to the actual application scenario, the deduction method is not limited to this.

[0114] S203. Obtain local position calibration parameters according to the current position information and the deduced position information of the virtual character.

[0115] Among them, the current position information of the virtual character is the position information predicted by the game client based on the current frame data, and the deduced position information is the position information obtained by the game client based on the historical joystick operation queue and the target position data. The local position calibration parameters can be obtained according to the current position information of the virtual character and the deduced position information, so that the current position of the virtual character can be smoothly transitioned to the obtained deduced position based on the local position calibration parameters, reducing the pulling feeling caused by the synchronization of the virtual character position of the game client, achieving a smooth transition, ensuring the synchronization of the virtual character position between the game client and the server, and improving the gaming experience.

[0116] Figure 3 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application is shown below. Figure 3 As shown, the local position calibration parameters are obtained according to the current position information and the deduced position information of the virtual character, including:

[0117] S301, calculating and obtaining the position difference between the current position information and the deduced position information of the virtual character.

[0118] S302: If it is determined that the position difference is greater than a first preset threshold and less than a second preset threshold, obtain a local position calibration parameter according to a first preset calibration algorithm.

[0119] S303: If it is determined that the position difference is greater than a second preset threshold, obtain local position calibration parameters according to a second preset calibration algorithm.

[0120] Among them, when calculating the local position calibration parameters, calibration can be performed based on the position difference between the current position information and the deduced position information of the virtual character. Optionally, the position difference can be compared with a first preset threshold and a second preset threshold, and whether to perform position calibration is determined based on the comparison result, and, if position calibration is performed, how to obtain the local position calibration parameters.

[0121] Optionally, the local position calibration parameters can be represented by a position calibration vector. If the position difference is less than a first preset threshold, the position calibration vector can be set to a zero vector, indicating that no position calibration is required; if the position difference is greater than the preset first preset threshold and less than the second preset threshold, the position calibration vector can be obtained according to the first preset calibration algorithm, for example, the position calibration vector = the preset moving speed v of the virtual character * frame interval dt * fixed coefficient r1; if the position difference is greater than the second preset threshold, the position calibration vector can be obtained according to the second preset calibration algorithm, for example, the position calibration vector = position difference D * fixed coefficient r2. Among them, the value of the fixed coefficient r2 can be greater than the fixed coefficient r1. In some embodiments, r1 can take any value between 0 and 0.2, so that the local position calibration parameters calculated according to the first preset calibration algorithm can be used for fine-tuning the position of the virtual character; r2 can take a larger value (for example, any value between 1 and 2), so that the local position calibration parameters calculated according to the second preset calibration algorithm can cope with special situations and realize the forced rollback of the virtual character position. The present application does not limit the values ​​of r1 and r2, and can be flexibly set according to the actual application scenario; for the preset movement speed v of the virtual character, it can be different according to different game scenarios. For example, according to the game level of the player, when the game level is high, the preset movement speed v of the virtual character can be larger, and when the game level is low, the preset movement speed v of the virtual character can be smaller, but it is not limited to this; for the frame interval, it can also be different according to different game scenarios. For example, the game frame interval of 30 frames is 1 / 30ms, which is about 33.3ms; the game frame interval of 60 frames is 1 / 60ms, which is about 16.7ms.

[0122] Optionally, the above method further includes:

[0123] If the position data corresponding to the current frame data is received, the historical joystick operation queue is updated according to the position data corresponding to the current frame data.

[0124] Among them, if the game client receives the position data corresponding to the current frame data sent by the server, the historical joystick operation queue can be updated according to the position data corresponding to the current frame data, so that the historical joystick information with an earlier historical timestamp in the historical joystick operation queue can be deleted, so that when the subsequent game client generates new joystick information, it can be stored through the historical joystick operation queue.

[0125] Figure 4 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application. Figure 4 As shown, the above updating of the historical joystick operation queue according to the position data corresponding to the current frame data includes:

[0126] S501. Obtain historical joystick information and frame intervals stored in a historical joystick operation queue.

[0127] S502: If it is determined that the amount of historical joystick information is equal to 1, the frame interval is used as the first time difference; or, if it is determined that the amount of historical joystick information is greater than 1, the minimum time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue is calculated and obtained as the first time difference.

[0128] Among them, the historical joystick information and frame interval stored in the historical joystick operation queue can be obtained, and the first time difference can be calculated in different ways according to the number of historical joystick information. Optionally, if the number of historical joystick information is equal to 1, that is, the historical joystick information only includes the current joystick information corresponding to the current frame data, then the frame interval can be used as the first time difference (that is, the time difference between the current frame data and the previous frame data); and if the number of historical joystick information is greater than 1, it means that in addition to the current joystick information corresponding to the current frame data, the historical joystick operation queue also includes other historical joystick information, then the time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue can be calculated, and the smallest time difference therebetween can be used as the first time difference.

[0129] S503: Obtain a historical timestamp corresponding to the historical joystick information in the historical joystick operation queue, and use the minimum time difference between the historical timestamp and the timestamp in the position data corresponding to the current frame data as the second time difference.

[0130] S504: Update the historical joystick operation queue according to the first time difference and the second time difference.

[0131] Among them, the time difference between the historical timestamp corresponding to each historical joystick information in the historical joystick operation queue and the timestamp in the position data corresponding to the current frame data can be calculated, and the minimum time difference can be used as the second time difference, and the historical joystick operation queue can be updated according to the above first time difference and the second time difference.

[0132] Figure 5 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application is shown below. Figure 5 As shown, the above updating the historical joystick operation queue according to the first time difference and the second time difference includes:

[0133] S601. Obtain historical joystick information corresponding to a second time difference, and record a historical timestamp corresponding to the historical joystick information as a reference timestamp.

[0134] S602: Delete the historical joystick operation information whose timestamp is less than or equal to the reference timestamp in the historical joystick operation queue, and obtain an updated historical joystick operation queue.

[0135] Among them, the historical joystick information corresponding to the second time difference, that is, the time difference between the historical timestamp corresponding to the historical joystick information and the sent timestamp corresponding to the current frame data is the smallest. For the historical joystick information, the historical timestamp corresponding to the historical joystick information can be recorded as a reference timestamp.

[0136] For example, the historical joystick operation queue includes historical joystick information X1, historical joystick information X2, and historical joystick information X3, and their corresponding timestamps are T1, T2 and T3, and T3>T2>T1, that is, the historical joystick information X1 corresponding to T1 is stored first, and the historical joystick information X3 corresponding to T3 is the latest stored, and the sending timestamp corresponding to the current frame data is TX. If it is determined by calculation that the time difference between timestamp T2 and timestamp TX is the smallest, then the timestamp T2 can be recorded as a reference timestamp, and the historical joystick information X2 is the historical joystick information corresponding to the second time difference.

[0137] Based on the above embodiment, the historical joystick information with a timestamp less than or equal to the reference timestamp in the historical joystick operation queue can be deleted. In this way, the historical joystick information with an earlier historical timestamp in the historical joystick operation queue can be deleted to obtain an updated historical joystick operation queue.

[0138] Optionally, before obtaining the target location data sent by the server, the method further includes:

[0139] If it is determined that the current frame data includes joystick information, the current joystick information corresponding to the current frame data is added to the historical joystick operation queue.

[0140] It can be understood that for the game client, the game client generates current frame data. If it is determined that the current frame data includes joystick information, the current joystick information corresponding to the current frame data can be added to the historical joystick operation queue, so that when new joystick information is generated, it can be stored through the historical joystick operation queue.

[0141] Figure 6 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application. Figure 6 As shown, the above method also includes:

[0142] S801: If it is determined that the current frame data includes joystick information, obtain the orientation parameter of the virtual character according to the joystick information included in the current frame data.

[0143] S802: Adjust the orientation of the virtual character according to the orientation parameter.

[0144] Among them, if the current frame data includes joystick information, the orientation parameters of the virtual character can be obtained according to the joystick information, and then according to the orientation parameters, the orientation of the virtual character can be adjusted to realize the advance turning of the virtual character, so that in a high-latency network environment, the response speed of the virtual character's turning to the joystick in the game client can be improved, so as to realize instant response and enhance the gaming experience.

[0145] Figure 7 A flowchart of another method for synchronizing actions in a game provided by an embodiment of the present application is shown below. Figure 7 As shown, the above adjustment of the orientation of the virtual character according to the orientation parameter includes:

[0146] S901. Obtain the joystick direction according to the joystick information included in the current frame data.

[0147] S902: Adjust the orientation of the virtual character according to the current orientation of the virtual character, the joystick direction, the frame interval, and the preset turning angular velocity of the virtual character.

[0148] Among them, the joystick direction corresponding to the joystick information can be obtained according to the joystick information included in the current frame data, and then the direction of the virtual character can be adjusted according to the joystick direction, the current direction of the virtual character, the frame interval and the preset turning angular velocity of the virtual character, and the adjusted direction of the virtual character is obtained, so that in a high-latency network environment, the response speed of the virtual character's turning to the joystick in the game client can be improved to achieve instant response. Among them, the preset turning angular velocity (i.e., turning rate) of the virtual character can be different according to different application scenarios.

[0149] Optionally, the adjustment can be made in the following manner, wherein the joystick direction is OT and the current orientation of the virtual character is OS, then the orientation of the adjusted virtual character can be min(OT-OS, the virtual character's preset turning angular velocity w*this frame time interval dt), that is, it can be the minimum value between the two; in addition, it should be noted that if the current frame data does not include joystick information, then the value of OT can be the joystick direction corresponding to the most recent joystick information of the game client, and the same calculation process as above can be used to obtain the adjusted orientation of the virtual character. Of course, the actual calculation method is not limited to this.

[0150] Optionally, the above method further includes:

[0151] If it is determined that the current frame data includes joystick information, the motion state of the virtual character is set to a moving state; or, if it is determined that the current frame data does not include joystick information, the motion state of the virtual character is set to a stopped state.

[0152] It is understandable that if the current frame data includes joystick information, it indicates that the player has manipulated the virtual joystick object, keyboard, mouse, game controller, etc. Therefore, if it is determined that the current frame data includes joystick information, the motion state of the virtual character can be set to the moving state; and if the current frame data does not include joystick information, it indicates that the player has not manipulated the virtual joystick object, keyboard, mouse, game controller, etc. (for example, the movement has just stopped or the movement has not yet started), therefore, the motion state of the virtual character can be set to the stopped state. Through the above settings, the virtual character movement animation can be realized in advance, and instant response can be achieved to prepare for controlling the next step of the virtual character's movement. In addition, in a high-latency network environment, the player's joystick operation can be responded to in a timely manner, improving the player's game operation feel.

[0153] Among them, regarding the moving state and the stopped state, it should be noted that the moving state may correspond to a basic moving action, such as walking in place; the stopped state may correspond to an action without any movement, such as standing still in place, but is not limited to this.

[0154] Figure 8 This is a functional module diagram of an action synchronization device in a game provided by an embodiment of the present application. The device can be applied to a game client. The basic principle and technical effects of the device are the same as those of the corresponding method embodiment described above. For the sake of brief description, the parts not mentioned in this embodiment can be referred to the corresponding contents in the method embodiment. Figure 8 As shown, the action synchronization device 100 in the game includes: a first acquisition module 110 , a second acquisition module 120 and a calibration module 130 .

[0155] The first acquisition module 110 is used to acquire the target location data sent by the server, the target location data including: a sending timestamp, location information of the virtual character, and a frame interval;

[0156] A second acquisition module 120 is used to acquire a local position calibration parameter according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data;

[0157] The calibration module 130 is used to calibrate the current position information of the virtual character according to the local position calibration parameters, and obtain the calibrated position information of the virtual character.

[0158] Optionally, the first acquisition module 110 is specifically configured to determine whether the position data corresponding to the current frame data is received; if not, the position data most recently sent by the server is used as the target position data.

[0159] Optionally, the second acquisition module 120 is specifically used to acquire a historical joystick operation queue, where the joystick operation queue includes: historical joystick information in a preset historical duration, historical timestamps corresponding to the historical joystick information, and frame intervals;

[0160] Obtain the deduced position information based on the historical joystick operation queue and target position data;

[0161] According to the current position information and deduced position information of the virtual character, the local position calibration parameters are obtained.

[0162] Optionally, the second acquisition module 120 is specifically used to calculate and obtain a position difference between the current position information of the virtual character and the deduced position information;

[0163] If it is determined that the position difference is greater than a preset first threshold and less than a second preset threshold, obtaining the local position calibration parameter according to a first preset calibration algorithm;

[0164] If it is determined that the position difference is greater than a second preset threshold, the local position calibration parameters are obtained according to a second preset calibration algorithm.

[0165] Fig. 9 This is a functional module diagram of another action synchronization device in a game provided by an embodiment of the present application. Fig. 9 As shown, the action synchronization device 100 in the game further includes: an updating module 140, which is used to update the historical joystick operation queue according to the position data corresponding to the current frame data if the position data corresponding to the current frame data is received.

[0166] Optionally, the updating module 140 is specifically configured to obtain historical joystick information and frame intervals stored in the historical joystick operation queue;

[0167] If it is determined that the number of the historical joystick information is equal to 1, the frame interval is used as the first time difference; or, if it is determined that the number of the historical joystick information is greater than 1, the minimum time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue is calculated and obtained as the first time difference;

[0168] Obtaining a historical timestamp corresponding to the historical joystick information in the historical joystick operation queue and taking the minimum time difference between the timestamp in the position data corresponding to the current frame data as a second time difference;

[0169] The historical joystick operation queue is updated according to the first time difference and the second time difference. Optionally, the updating module is specifically configured to obtain historical joystick information corresponding to the second time difference, and record the historical timestamp corresponding to the historical joystick information as a reference timestamp;

[0170] The historical joystick operation queue is deleted, and the historical joystick operation queue after the update is obtained.

[0171] Fig.10 This is a functional module diagram of another action synchronization device in a game provided by an embodiment of the present application. Fig.10 As shown, the action synchronization device 100 in the game further includes: an adding module 160, which is used to add the current joystick information corresponding to the current frame data to the historical joystick operation queue if it is determined that the current frame data includes joystick information.

[0172] Alternatively, if Fig.10 As shown, the action synchronization device 100 in the game also includes: an adjustment module 180, which is used to obtain the orientation parameters of the virtual character according to the joystick information included in the current frame data if it is determined that the current frame data includes joystick information; and adjust the orientation of the virtual character according to the orientation parameters.

[0173] Optionally, the adjustment module is specifically configured to obtain a joystick direction according to the joystick information included in the current frame data;

[0174] The orientation of the virtual character is adjusted according to the current orientation of the virtual character, the joystick direction, the frame interval, and the preset turning angular velocity of the virtual character.

[0175] Optionally, the device also includes a setting module for setting the motion state of the virtual character to a moving state if it is determined that the current frame data includes joystick information; or setting the motion state of the virtual character to a stopped state if it is determined that the current frame data does not include joystick information.

[0176] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0177] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0178] Fig.11 This is a schematic diagram of an electronic device structure provided in an embodiment of the present application. Fig.11 As shown, the electronic device may include: a processor 210, a storage medium 220 and a bus 230, the storage medium 220 stores machine-readable instructions executable by the processor 210, when the electronic device is running, the processor 210 and the storage medium 220 communicate through the bus 230, and the processor 210 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0179] Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method embodiment are executed. The specific implementation method and technical effect are similar and will not be repeated here.

[0180] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0181] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0182] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0183] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0184] It should be noted that, in this article, relational terms such as "first" and "second" 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 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 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 device including the elements.

[0185] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for synchronizing actions in a game, characterized in that: Applied to a game client, the method includes: Obtaining target location data sent by the server, the target location data including: a sending timestamp, location information of the virtual character, and a frame interval; Acquire local position calibration parameters according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is position information predicted by the game client according to the current frame data; Calibrate the current position information of the virtual character according to the local position calibration parameters to obtain the calibrated position information of the virtual character; The step of obtaining a local position calibration parameter according to the target position data and the current position information of the virtual character includes: Acquire a historical joystick operation queue, wherein the historical joystick operation queue includes: historical joystick information in a preset historical duration, a historical timestamp corresponding to the historical joystick information, and a frame interval; Acquire deduced position information according to the historical joystick operation queue and the target position data; Calculating and obtaining a position difference between the current position information of the virtual character and the deduced position information; If it is determined that the position difference is greater than a preset first threshold and less than a second preset threshold, the local position calibration parameters are obtained according to a first preset calibration algorithm; if it is determined that the position difference is greater than a second preset threshold, the local position calibration parameters are obtained according to a second preset calibration algorithm.

2. The method according to claim 1, characterized in that The step of obtaining the target location data sent by the server includes: Determining whether the position data corresponding to the current frame data is received; If not, the location data most recently sent by the server is used as the target location data.

3. The method according to claim 2, characterized in that The method further comprises: If the position data corresponding to the current frame data is received, the historical joystick operation queue is updated according to the position data corresponding to the current frame data.

4. The method according to claim 3, characterized in that The updating of the historical joystick operation queue according to the position data corresponding to the current frame data includes: Acquire historical joystick information and frame intervals stored in the historical joystick operation queue; If it is determined that the number of the historical joystick information is equal to 1, the frame interval is used as the first time difference; or, if it is determined that the number of the historical joystick information is greater than 1, the minimum time difference between the historical timestamps corresponding to two consecutive historical joystick information in the historical joystick operation queue is calculated and obtained as the first time difference; Obtaining a historical timestamp corresponding to the historical joystick information in the historical joystick operation queue and a minimum time difference between the timestamp in the position data corresponding to the current frame data and the timestamp as a second time difference; The historical joystick operation queue is updated according to the first time difference and the second time difference.

5. The method according to claim 4, characterized in that The updating of the historical joystick operation queue according to the first time difference and the second time difference includes: Acquire historical joystick information corresponding to the second time difference, and record the historical timestamp corresponding to the historical joystick information as a reference timestamp; The historical joystick operation queue is deleted, and the historical joystick operation queue after the update is obtained.

6. The method according to any one of claims 1 to 5, characterized in that: Before obtaining the target location data sent by the server, the method further includes: If it is determined that the current frame data includes joystick information, the current joystick information corresponding to the current frame data is added to the historical joystick operation queue.

7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: If it is determined that the current frame data includes joystick information, obtaining a direction parameter of the virtual character according to the joystick information included in the current frame data; The orientation of the virtual character is adjusted according to the orientation parameter.

8. The method according to claim 7, characterized in that The adjusting the orientation of the virtual character according to the orientation parameter includes: Obtaining a joystick direction according to the joystick information included in the current frame data; The orientation of the virtual character is adjusted according to the current orientation of the virtual character, the joystick direction, the frame interval, and the preset turning angular velocity of the virtual character.

9. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: If it is determined that the current frame data includes joystick information, the motion state of the virtual character is set to a moving state; or if it is determined that the current frame data does not include joystick information, the motion state of the virtual character is set to a stopped state.

10. An action synchronization device in a game, characterized in that: Applied to a game client, the device comprises: a first acquisition module, a second acquisition module and a calibration module; The first acquisition module is used to acquire the target location data sent by the server, and the target location data includes: a sending timestamp, location information of the virtual character, and a frame interval; The second acquisition module is used to acquire the local position calibration parameter according to the target position data and the current position information of the virtual character, wherein the current position information of the virtual character is the position information predicted by the game client according to the current frame data; The calibration module is used to calibrate the current position information of the virtual character according to the local position calibration parameters, and obtain the calibrated position information of the virtual character; The second acquisition module is specifically used to acquire a historical joystick operation queue, wherein the historical joystick operation queue includes: historical joystick information in a preset historical duration, a historical timestamp corresponding to the historical joystick information, and a frame interval; Acquire deduced position information according to the historical joystick operation queue and the target position data; Calculating and obtaining a position difference between the current position information of the virtual character and the deduced position information; If it is determined that the position difference is greater than a preset first threshold and less than a second preset threshold, the local position calibration parameters are obtained according to a first preset calibration algorithm; if it is determined that the position difference is greater than a second preset threshold, the local position calibration parameters are obtained according to a second preset calibration algorithm.

11. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the action synchronization method in the game as described in any one of claims 1-9.

12. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the action synchronization method in the game as described in any one of claims 1 to 9 are executed.