Virtual object position synchronization method, device and electronic device applied to server

By obtaining the client animation drive path and data, the server synchronizes the position of the virtual object in real time, solves the problem of NPC position deviation, realizes the consistency of the client and server position, and enhances the gaming experience.

CN114210066BActive Publication Date: 2025-01-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111495439.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2025-01-24
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

In the game, due to the influence of the network environment or the virtual object logic provided by the client, the NPC position in the server is deviated from the NPC position in the client, resulting in the NPC position being pulled and affecting the player's experience.

Method used

By obtaining the animation drive path and animation data in the client, the server obtains the displacement information of the virtual object on the animation drive path in real time, and synchronizes the location of the virtual object in the server with the position of the virtual object in the client.

Benefits of technology

It achieves real-time consistency in the positions of virtual objects on the client and server, avoids position pulling, and improves the player's gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114210066B_ABST
    Figure CN114210066B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and electronic device for synchronizing the position of a virtual object applied to a server, the method comprising: obtaining an animation driving path through which the virtual object moves when the client uses animation to drive the virtual object to move; obtaining animation data used by the client to drive the virtual object to move; based on the animation data, obtaining displacement information of the virtual object on the animation driving path; based on the displacement information, synchronizing the position of the virtual object in the server with the position of the virtual object in the client. The embodiments of the present application can improve the consistency of the virtual object position of the client and the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of games, and in particular to a method, device and electronic device for synchronizing the position of a virtual object applied to a server. Background Art

[0002] In the gaming field, NPCs (non-player characters) that are not controlled by players are usually controlled by servers. The server usually drives the NPC to move frame by frame, and then synchronizes it to the client, so that the NPC position in the client is consistent with the NPC position in the server. Due to the influence of the network environment or the influence of the virtual object logic of the client, sometimes the position of the NPC in the server deviates from the position of the NPC in the client, resulting in a pull in the position of the NPC in the client, which has a negative impact on the player's experience. Summary of the invention

[0003] One purpose of the present application is to provide a method, device and electronic device for synchronizing the position of a virtual object applied to a server, which can improve the consistency of the virtual object position between a client and a server.

[0004] According to one aspect of an embodiment of the present application, a virtual object position synchronization method applied to a server is disclosed, the method comprising:

[0005] Acquire the animation driving path along which the virtual object moves when the client uses animation to drive the virtual object to move;

[0006] Acquiring animation data used by the client to drive the movement of the virtual object;

[0007] Based on the animation data, obtaining displacement information of the virtual object on the animation driving path;

[0008] Based on the displacement information, the position of the virtual object in the server is synchronized with the position of the virtual object in the client.

[0009] According to one aspect of an embodiment of the present application, a virtual object position synchronization device applied to a server is disclosed, the device comprising:

[0010] A path acquisition module, configured to acquire an animation driven path along which the virtual object moves when the client uses animation to drive the virtual object to move;

[0011] An animation acquisition module, configured to acquire animation data used by the client to drive the virtual object to move;

[0012] A displacement acquisition module, configured to acquire displacement information of the virtual object on the animation driving path based on the animation data;

[0013] The position synchronization module is configured to synchronize the position of the virtual object in the server with the position of the virtual object in the client based on the displacement information.

[0014] In an exemplary embodiment of the present application, the device is configured as follows:

[0015] Obtaining a target moving starting point and a target moving end point of the virtual object;

[0016] Based on the target movement starting point and the target movement end point, pathfinding is performed in the map where the virtual object is located to obtain the target movement path of the virtual object;

[0017] The path points in the target moving path are corrected to obtain animation driving path points for identifying the animation starting point or the animation ending point, and the animation driving path is obtained by connecting the animation driving path points.

[0018] In an exemplary embodiment of the present application, the device is configured as follows:

[0019] Acquire terrain information of the area passed by the target moving path;

[0020] Based on the terrain information, the area used to trigger the virtual object to interact with the virtual object is used as the animation driving area, and the path points at both ends of the animation driving area are corrected as the animation driving path points.

[0021] In an exemplary embodiment of the present application, the device is configured as follows:

[0022] If the path distance between the path point corresponding to the target movement starting point and its next path point is greater than or equal to the execution distance of the starting animation, the path point corresponding to the target movement starting point is corrected to an animation-driven path point for identifying the starting point of the starting animation, and an animation-driven path point for identifying the end point of the acceleration starting animation is set based on the execution distance of the starting animation.

[0023] In an exemplary embodiment of the present application, the device is configured as follows:

[0024] If the path distance between the path point corresponding to the target movement starting point and its next path point is less than the execution distance of the starting animation, the path point corresponding to the target movement starting point is refused to be corrected to the animation-driven path point for identifying the starting animation starting point.

[0025] In an exemplary embodiment of the present application, the device is configured as follows:

[0026] If the movement speed of the virtual object at the target movement starting point is greater than 0, the path point corresponding to the target movement starting point is rejected to be corrected as an animation driving path point for identifying the starting point of the starting animation.

[0027] In an exemplary embodiment of the present application, the device is configured as follows:

[0028] If the path distance between the path point corresponding to the target moving end point and its previous path point is greater than or equal to the execution distance of the braking animation, the path point corresponding to the target moving end point is corrected to an animation-driven path point for identifying the end point of the braking animation, and an animation-driven path point for identifying the starting point of the braking animation is added based on the execution distance of the braking animation.

[0029] In an exemplary embodiment of the present application, the device is configured as follows:

[0030] If the path distance between the path point corresponding to the target moving end point and its previous path point is less than the execution distance of the braking animation, the path point corresponding to the target moving end point is rejected to be corrected to the animation driven path point for marking the starting point of the braking animation.

[0031] According to one aspect of an embodiment of the present application, an electronic device is disclosed, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements any one of the above embodiments.

[0032] According to one aspect of an embodiment of the present application, a computer program medium is disclosed, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute any one of the above embodiments.

[0033] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above various optional implementations.

[0034] In an embodiment of the present application, the server can read the animation data used by the client to drive the movement of the virtual object to obtain the displacement information of the virtual object on the animation driving path, so as to reflect the position of the virtual object driven by the animation in the client in real time and accurately. On this basis, the server's simulation of the subsequent position of the virtual object can maintain smooth docking with the client, avoid the occurrence of pulling, and thus improve the consistency of the virtual object position between the client and the server.

[0035] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0036] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The above and other objects, features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.

[0038] Figure 1 A schematic diagram of an exemplary system architecture according to an embodiment of the present application is shown.

[0039] Figure 2 A flowchart of a virtual object position synchronization method applied to a server according to an embodiment of the present application is shown.

[0040] Figure 3 A schematic diagram showing a starting action of a virtual object according to an embodiment of the present application is shown.

[0041] Figure 4 A schematic diagram of a virtual object's uniform running action according to an embodiment of the present application is shown.

[0042] Figure 5 A schematic diagram showing a braking action of a virtual object according to an embodiment of the present application is shown.

[0043] Figure 6 A schematic diagram showing a jumping action of a virtual object according to an embodiment of the present application is shown.

[0044] Figure 7 A schematic diagram showing a climbing action of a virtual object according to an embodiment of the present application is shown.

[0045] Figure 8 A schematic diagram showing a cover-entering action of a virtual object according to an embodiment of the present application is shown.

[0046] Fig. 9 A schematic diagram of a target moving path according to an embodiment of the present application is shown.

[0047] Fig.10 A schematic diagram of a target moving path according to an embodiment of the present application is shown.

[0048] Fig.11 A flowchart of a virtual object position synchronization method applied to a server according to an embodiment of the present application is shown.

[0049] Fig.12A block diagram of a virtual object position synchronization device applied to a server according to an embodiment of the present application is shown.

[0050] Fig.13 A hardware diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0051] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present application will be more comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0052] In addition, the described features, structures or characteristics may be combined in one or more example embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the example embodiments of the present application. However, those skilled in the art will appreciate that the technical solution of the present application may be practiced while omitting one or more of the specific details, or other methods, components, steps, etc. may be adopted. In other cases, known structures, methods, implementations or operations are not shown or described in detail to avoid obscuring the present application and making the various aspects of the present application obscure.

[0053] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0054] Figure 1 A schematic diagram showing an exemplary system architecture of an embodiment of the present application is shown.

[0055] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a network 104 and a server 105. The network 104 is a medium for providing a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc. The server 105 is an exemplary execution subject of the technical solution of the present application.

[0056] It should be understood that Figure 1The number of terminal devices, networks and servers in the example is only illustrative. Any number of terminal devices, networks and servers may be provided as required. For example, server 105 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0057] It should be noted that this embodiment is only an exemplary display of the system architecture to which the present application can be applied, and should not limit the functions and scope of use of the present application.

[0058] Before describing the specific implementation process of the present application in detail, some concepts involved in the present application are first briefly explained.

[0059] In the embodiment of the present application, synchronizing the position of the virtual object refers to synchronizing the position of the virtual object in the client with the position of the virtual object in the server. For example, the server calculates the movement distance of the NPC in a certain time period by the speed of the NPC in the time period, obtains the position of the NPC, and then broadcasts the mobile synchronization packet containing the position information to the client. After receiving the mobile synchronization packet, the client drives the NPC to move according to the position information, so that the position of the NPC in the server is consistent with the position of the NCP in the client, so that the judgment made by the server on the NPC can be synchronized with the visual performance presented by the NPC in the client in real time and accurately.

[0060] In the embodiment of the present application, the animation driven path refers to the path that the virtual object moves through during the period when the client uses animation to drive the virtual object to move. For example, when the virtual object moves from the starting point to the end point, the first and last paths are driven by the client using animation, and the other paths are driven by non-animation methods (for example, uniform motion formula, uniform acceleration motion formula, uniform deceleration motion formula, etc.), then the animation driven path is the first and last paths.

[0061] The specific implementation process of this application is briefly described below.

[0062] The present application provides a virtual object position synchronization method applied to a server, which is mainly used in the field of games. Figure 2 A flow chart of the method is shown, the method comprising:

[0063] Step S210, obtaining the animation driving path along which the virtual object moves when the client uses animation to drive the virtual object to move;

[0064] Step S220: Obtain animation data used by the client to drive the movement of the virtual object;

[0065] Step S230: based on the animation data, obtaining the displacement information of the virtual object on the animation driving path;

[0066] Step S240: Based on the displacement information, synchronize the position of the virtual object in the server with the position of the virtual object in the client.

[0067] In the embodiment of the present application, the client can use animation to drive the virtual object to show a realistic motion effect. Specifically, the virtual object driven by the starting animation can be executed as follows: Figure 3 The virtual object driven by the uniform running animation can perform the following Figure 4 The virtual object driven by the braking animation can perform the following operations: Figure 5 The braking action shown in the figure; the virtual object driven by the jumping animation can perform the following Figure 6 The jumping action shown in FIG. 1 is a virtual object driven by a climbing animation, which can perform the following operations: Figure 7 The climbing action shown in FIG. 1 is a virtual object driven by an animation of entering a cover, and can perform the following operations: Figure 8 The cover action shown.

[0068] When the client uses animation to drive the virtual object, the movement pattern of the virtual object is usually more complex and even irregular. In this case, if the server uses the uniform motion formula, uniform acceleration motion formula or uniform deceleration motion formula to calculate the position of the virtual object, it will cause the position of the virtual object in the server to deviate from the position of the virtual object in the client, resulting in inaccurate position synchronization between the two.

[0069] For virtual objects driven by animation, in order to synchronize the position of the virtual object in the server with the position of the virtual object in the client in real time and accurately, in the embodiment of the present application, the server obtains the animation driving path and the animation data used by the client to drive the movement of the virtual object. Then, based on the animation data, the displacement information of the virtual object on the animation driving path is obtained, and then on this basis, the position of the virtual object in the server is synchronized with the position of the virtual object in the client.

[0070] It can be seen that in the embodiment of the present application, the server can reflect the position of the virtual object driven by the animation in the client in real time and accurately by reading the displacement information of the virtual object on the animation driving path obtained by the animation data used by the client to drive the movement of the virtual object. On this basis, the server's simulation of the subsequent position of the virtual object can maintain smooth docking with the client, avoiding the occurrence of pulling, thereby improving the consistency of the virtual object position between the client and the server.

[0071] It should be noted that the virtual object in the present application can be either an NPC controlled by a non-player or a player character controlled by a player.

[0072] The specific implementation process of each embodiment of the present application is described in detail below.

[0073] In one embodiment, the server and the client pre-agreed to configure several segments of paths at fixed positions in the system as animation-driven types. When the virtual object moves to the animation-driven path, the client drives the virtual object in the client to move using animation. In this case, the server can directly use the animation-driven path as the animation-driven path according to the agreed content.

[0074] In one embodiment, a target moving start point and a target moving end point of a virtual object are obtained. Then, based on the target moving start point and the target moving end point, a path is searched in a map where the virtual object is located to obtain a target moving path of the virtual object. Then, the path points in the target moving path are corrected to obtain animation driving path points for identifying an animation starting point or an animation end point, and the animation driving path is obtained by connecting the animation driving path points.

[0075] In this embodiment, when the virtual object is an NPC, the virtual object is mainly driven by the server. Therefore, in this case, the server can directly obtain the target moving path of the virtual object.

[0076] When the virtual object is a player character, it is mainly driven by the player through the client. Therefore, in this case, the server can obtain the movement instruction for the virtual object by communicating with the client, and then determine the target movement starting point and target movement end point of the virtual object according to the movement instruction. For example: the user sends the movement instruction "move from point A to point X" to the virtual object through the client. After receiving this movement instruction, the client reports the movement instruction to the server, so that the server can determine the target movement starting point of the virtual object as point A and the target movement end point as point X according to the movement instruction.

[0077] Then, based on the target moving starting point and the target moving end point, the server searches for a path in the map where the virtual object is located to obtain the target moving path of the virtual object. The target moving path includes multiple path points, which can be maintained in an array, and each point in the array represents a corresponding path point. The path between adjacent path points is usually a straight line. For example: Fig. 9The target moving path diagram is shown in Figure 1. The starting point of the target moving of the virtual object is point A, and the end point of the target moving is point X. There is a pool area between points A and X where no path can be found, and there is a wall terrain above the pool area. After the server uses the Recast Navigation pathfinding component to find the path, the following is obtained: Fig. 9 The target moving path shown in the figure. The path points in the target moving path are point A, point B, point C, point D, point E and point X in sequence.

[0078] Among them, when the virtual object is a player character, the path-finding logic used by the server is consistent with the path-finding logic used by the client to ensure that the target movement path determined by the server is consistent with the target movement path obtained by the actual movement of the virtual object in the client.

[0079] Then the server corrects the path points in the target moving path to obtain the animation driving path points for marking the animation starting point or the animation ending point, and then obtains the corresponding animation driving path by sequentially connecting the animation starting point and the animation ending point.

[0080] The advantage of this embodiment is that the target moving path is obtained by path finding, and then the path points are corrected, which can flexibly meet the various movement modes of the virtual object.

[0081] In one embodiment, the terrain information of the area through which the target moving path passes is obtained. Based on the terrain information, the area used to trigger the virtual object to interact with it is used as the animation driving area, and the path points at both ends of the animation driving area are corrected as animation driving path points.

[0082] In this embodiment, the area through which the virtual object passes during movement has corresponding terrain, and some terrains may trigger the virtual object to interact with the area, and such interaction is usually achieved by the client using specific animations to drive the virtual object.

[0083] Therefore, based on the terrain information of the area through which the target moving path passes, the server detects the area that will trigger the virtual object to interact with it, and uses these areas that will trigger the interaction as the animation driving area. The path points at both ends of the animation driving area are corrected, one as an animation driving path point for marking the starting point of the animation, and the other as an animation driving path point for marking the end point of the animation, so that the animation driving path passing through the animation driving area can be obtained.

[0084] For example: Fig.10 Shown in Fig. 9 Based on , the target moving path is obtained after the path points of the target moving path are corrected. Fig.10Schematic diagram of the target movement path shown. The target movement path of the virtual object has path points C and D at both ends of a certain area. When the virtual object passes through the area, the client will use a jumping animation to drive the virtual object to perform a jumping action to interact with the wall terrain in the area. The server corrects point C to an animation-driven path point for identifying the starting point of the animation, and corrects point D to an animation-driven path point for identifying the end point of the animation, so that the path "from point C to point D" can be used as the animation-driven path corresponding to the jumping animation.

[0085] In one embodiment, if the path distance between the path point corresponding to the target movement starting point and its next path point is greater than or equal to the execution distance of the starting animation, the path point corresponding to the target movement starting point is corrected to an animation-driven path point for identifying the starting point of the starting animation, and an animation-driven path point for identifying the end point of the acceleration starting animation is set based on the execution distance of the starting animation.

[0086] In this embodiment, the starting animation is used to show the starting action of the virtual object. If the path distance between the path point corresponding to the target moving starting point and the next path point is greater than or equal to the execution distance of the starting animation, it means that the starting animation can be played completely between the path point corresponding to the target moving starting point and the next path point, which further means that the client will use the starting animation to drive the virtual object to perform the starting action from the path point corresponding to the target moving starting point.

[0087] Therefore, the server can correct the type of the path point corresponding to the target moving starting point to "starting animation starting point", and set the type of the path point to "starting animation end point" based on the execution distance of the starting animation.

[0088] Specifically, refer to Fig.10 The schematic diagram of the target moving path is shown. The path point corresponding to the starting point of the target movement is point A, the next path point of point A is point B, the path distance between point A and point B is |AB|, and the execution distance of the starting animation is S1. When |AB| is greater than S1, a new path point A1 is added between point A and point B, and the path distance between point A and point A1 is S1. The type of point A is corrected to "starting animation starting point", and the type of point A1 is set to "starting animation end point"; when |AB| is equal to S1, the type of point A is corrected to "starting animation starting point", and there is no need to add a new path point, and the type of point B is directly corrected to "starting animation end point".

[0089] The advantage of this embodiment is that by identifying the animation driving path points based on the execution distance of the starting animation, it is ensured that the client uses the starting animation to drive the virtual object accurately.

[0090] In one embodiment, if the path distance between the path point corresponding to the target movement starting point and its next path point is less than the execution distance of the starting animation, the path point corresponding to the target movement starting point is refused to be corrected to the animation-driven path point for identifying the starting animation starting point.

[0091] In this embodiment, if the path distance between the path point corresponding to the target movement starting point and its next path point is less than the execution distance of the starting animation, it means that the starting animation cannot be fully played between the path point corresponding to the target movement starting point and its next path point, which further indicates that the client will not use the starting animation to drive the virtual object to perform the starting action from the path point corresponding to the target movement starting point.

[0092] Therefore, the server refuses to correct the path point corresponding to the target moving starting point to the animation driving path point used to mark the starting point of the starting animation.

[0093] In one embodiment, if the movement speed of the virtual object at the target movement starting point is greater than 0, the path point corresponding to the target movement starting point is rejected to be corrected to the animation driving path point for identifying the starting point of the starting animation.

[0094] In this embodiment, the starting animation simulates the process of the virtual object accelerating synchronously from a stationary state. Therefore, if the movement speed of the virtual object at the target moving starting point is greater than 0, it means that the path point corresponding to the target moving starting point cannot be used as the starting point for playing the starting animation.

[0095] Therefore, the server refuses to correct the path point corresponding to the target moving starting point to the animation driving path point used to mark the starting point of the starting animation.

[0096] In one embodiment, if the path distance between the path point corresponding to the target moving end point and its previous path point is greater than or equal to the execution distance of the braking animation, the path point corresponding to the target moving end point is corrected to an animation-driven path point for identifying the end point of the braking animation, and an animation-driven path point for identifying the starting point of the braking animation is added based on the execution distance of the braking animation.

[0097] In this embodiment, the braking animation is used to display the braking action of the virtual object. If the path distance between the path point corresponding to the target moving end point and its previous path point is greater than or equal to the execution distance of the braking animation, it means that the braking animation can be fully played between the path point corresponding to the target moving end point and its previous path point, and further means that the client will use the braking animation to drive the virtual object to brake to the path point corresponding to the target moving end point and stop.

[0098] Therefore, the server may modify the type of the path point corresponding to the target moving end point to be "braking animation end point", and set a path point of type "braking animation starting point" based on the execution distance of the braking animation.

[0099] Specifically, refer to Fig.10 The schematic diagram of the target moving path is shown. The path point corresponding to the target moving end point is X, the previous path point of X point is E point, the path distance between X point and E point is |EX|, and the execution distance of the brake animation is S2. When |EX| is greater than S2, a new path point X1 is added between E point and X point, and the path distance between E point and X1 point is |EX|. The type of X point is corrected to "brake animation end point", and the type of X1 point is set to "brake animation start point"; when |EX| is equal to S2, the type of X point is corrected to "brake animation end point", and there is no need to add a new path point, and the type of X1 point is directly set to "brake animation start point".

[0100] The advantage of this embodiment is that by marking the animation driving path points based on the execution distance of the braking animation, it is ensured that the client uses the braking animation to drive the virtual object accurately.

[0101] In one embodiment, if the path distance between the path point corresponding to the target moving end point and its previous path point is less than the execution distance of the braking animation, the path point corresponding to the target moving end point is refused to be corrected to the animation driven path point for marking the starting point of the braking animation.

[0102] In this embodiment, if the path distance between the path point corresponding to the target moving end point and its previous path point is less than the execution distance of the braking animation, it means that the braking animation cannot be fully played between the path point corresponding to the target moving end point and its previous path point, which further indicates that the client will not use the braking animation to drive the virtual object to brake to the path point corresponding to the target moving end point and stop.

[0103] Therefore, the server refuses to correct the path point corresponding to the target moving end point to the animation driven path point used to mark the end point of the braking animation.

[0104] In the embodiment of the present application, the types of animations that can be used by the client are limited, so the server can pre-export the animation data of various types of animations that can be used by the client. Then, during the position synchronization process, the corresponding animation data is selected according to the animation type currently used by the client, and then the displacement information of the virtual object on the animation driving path is obtained based on the selected animation data.

[0105] The animation data read by the server can contain the following types of information: key, representing the key value of the animation, different virtual objects have different corresponding keys; anim_name, representing the name of the animation (for example: starting animation, braking animation), different animations have different corresponding names; duration, representing the duration of the animation, the unit is usually milliseconds; seq_rate, representing the frame rate of the animation, the higher the frame rate, the more accurate the animation data, but the larger the data volume; avg_velocity, representing the average speed of the animation; max_velocity, representing the maximum speed of the animation; move_seqs, representing the action sequence of the animation, usually including displacement information pos and orientation rot, etc.

[0106] In one embodiment, the animation frame number of the virtual object at the current moment is estimated based on the animation data, and then the displacement information of the virtual object on the animation driving path at the current moment is extracted from the animation data of the animation frame number of the virtual object at the current moment.

[0107] In this embodiment, the server estimates the animation frame number of the virtual object at the current moment based on the parameters contained in the animation data, and then directly extracts the displacement information at the current moment from the animation frame number at the current moment, and then synchronizes the position of the virtual object with the position of the virtual object on this basis.

[0108] In one embodiment, after the server reads the frame rate of the animation, it can calculate the number of animation frames of the virtual object at the current moment in combination with the current moment.

[0109] Fig.11 A flow chart of a virtual object position synchronization method applied to a server according to an embodiment of the present application is shown.

[0110] refer to Fig.11 As shown, in this embodiment, the server uses a pathfinding component to find the path and obtain the target moving path of the virtual object. Then, a starting correction is made according to the target moving starting point, a braking correction is made according to the target moving end point, and a special correction is made according to the special terrain (for example, the path points used to mark the starting point and end point of the climbing animation are obtained according to the terrain correction required to climb). Then, the position of the virtual object is synchronized according to the corrected target moving path.

[0111] During the position synchronization process, it is determined whether the virtual object has reached the target path end point. If it has reached the target path end point, the virtual object movement ends, and the server notifies the client that the virtual object stops moving; if it has not reached the target path end point, the server takes the current path point from the array and synchronizes the current displacement information of the virtual object to the client.

[0112] The position of the virtual object continues to change along the target moving path. When the next path point has not yet been reached, it is determined whether the virtual object is driven by animation in the current path segment. If it is driven by animation, the server reads the animation data, and then calculates the displacement information of the virtual object at the current moment based on this, and then updates the position of the virtual object based on this; if it is not driven by animation, the server calculates the displacement information of the virtual object at the current moment according to the motion formula, and then updates the position of the virtual object based on this.

[0113] Among them, when the server drives the virtual object to move, when the virtual object moves to a new path segment, the server will first broadcast the information of the path segment to the client, so that the client can drive the virtual object according to the information of the path segment. The server is usually driven at a frequency of 10 frames per second, and the client is usually driven at a frequency of 60 frames per second. In this way, under normal circumstances, the positions of the virtual objects simulated by the server and the client are consistent in each path segment, thereby avoiding pulling. If the positions are inconsistent, the position of the virtual object will be based on the position of the virtual object, and the client will smoothly or directly pull the virtual object to the corresponding position. This situation often occurs when the network fluctuates. However, according to the technical solution provided in the present application, under normal circumstances, the virtual objects simulated by the server and the client basically always maintain the same position.

[0114] Fig.12 A virtual object position synchronization device applied to a server according to an embodiment of the present application is shown, the device comprising:

[0115] The path acquisition module 310 is configured to acquire the animation driven path along which the virtual object moves when the client uses animation to drive the virtual object to move;

[0116] An animation acquisition module 320, configured to acquire animation data used by the client to drive the virtual object to move;

[0117] A displacement acquisition module 330, configured to acquire displacement information of the virtual object on the animation driving path based on the animation data;

[0118] The position synchronization module 340 is configured to synchronize the position of the virtual object in the server with the position of the virtual object in the client based on the displacement information.

[0119] In an exemplary embodiment of the present application, the device is configured as follows:

[0120] Obtaining a target moving starting point and a target moving end point of the virtual object;

[0121] Based on the target movement starting point and the target movement end point, pathfinding is performed in the map where the virtual object is located to obtain the target movement path of the virtual object;

[0122] The path points in the target moving path are corrected to obtain animation driving path points for identifying the animation starting point or the animation ending point, and the animation driving path is obtained by connecting the animation driving path points.

[0123] In an exemplary embodiment of the present application, the device is configured as follows:

[0124] Acquire terrain information of the area passed by the target moving path;

[0125] Based on the terrain information, the area used to trigger the virtual object to interact with the virtual object is used as the animation driving area, and the path points at both ends of the animation driving area are corrected as the animation driving path points.

[0126] In an exemplary embodiment of the present application, the device is configured as follows:

[0127] If the path distance between the path point corresponding to the target movement starting point and its next path point is greater than or equal to the execution distance of the starting animation, the path point corresponding to the target movement starting point is corrected to an animation-driven path point for identifying the starting point of the starting animation, and an animation-driven path point for identifying the end point of the acceleration starting animation is set based on the execution distance of the starting animation.

[0128] In an exemplary embodiment of the present application, the device is configured as follows:

[0129] If the path distance between the path point corresponding to the target movement starting point and its next path point is less than the execution distance of the starting animation, the path point corresponding to the target movement starting point is refused to be corrected to the animation-driven path point for identifying the starting animation starting point.

[0130] In an exemplary embodiment of the present application, the device is configured as follows:

[0131] If the movement speed of the virtual object at the target movement starting point is greater than 0, the path point corresponding to the target movement starting point is rejected to be corrected as an animation driving path point for identifying the starting point of the starting animation.

[0132] In an exemplary embodiment of the present application, the device is configured as follows:

[0133] If the path distance between the path point corresponding to the target moving end point and its previous path point is greater than or equal to the execution distance of the braking animation, the path point corresponding to the target moving end point is corrected to an animation-driven path point for identifying the end point of the braking animation, and an animation-driven path point for identifying the starting point of the braking animation is added based on the execution distance of the braking animation.

[0134] In an exemplary embodiment of the present application, the device is configured as follows:

[0135] If the path distance between the path point corresponding to the target moving end point and its previous path point is less than the execution distance of the braking animation, the path point corresponding to the target moving end point is rejected to be corrected to the animation driven path point for marking the starting point of the braking animation.

[0136] Reference below Fig.13 The electronic device 40 according to an embodiment of the present application is described. Fig.13 The electronic device 40 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0137] like Fig.13 As shown, the electronic device 40 is in the form of a general computing device. The components of the electronic device 40 may include but are not limited to: at least one processing unit 410, at least one storage unit 420, and a bus 430 connecting different system components (including the storage unit 420 and the processing unit 410).

[0138] The storage unit stores program codes, which can be executed by the processing unit 410, so that the processing unit 410 performs the steps according to various exemplary embodiments of the present invention described in the description of the exemplary method described above in this specification. For example, the processing unit 410 can perform the following steps: Figure 2 The steps shown in .

[0139] The storage unit 420 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 4201 and / or a cache storage unit 4202 , and may further include a read-only storage unit (ROM) 4203 .

[0140] The storage unit 420 may also include a program / utility 4204 having a set (at least one) of program modules 4205, such program modules 4205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0141] Bus 430 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0142] The electronic device 40 may also communicate with one or more external devices 500 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 40, and / or communicate with any device that enables the electronic device 40 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 450. The input / output (I / O) interface 450 is connected to a display unit 440. In addition, the electronic device 40 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 460. As shown, the network adapter 460 communicates with other modules of the electronic device 40 via a bus 430. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 40, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0143] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0144] In an exemplary embodiment of the present application, a computer-readable storage medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the method described in the above method embodiment.

[0145] According to one embodiment of the present application, a program product for implementing the method in the above method embodiment is also provided, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0146] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0147] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0148] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0149] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as JAVA, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0150] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0151] In addition, although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0152] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0153] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the appended claims.

Claims

1. A virtual object position synchronization method applied to a server, characterized in that: The method comprises: Acquire the animation driving path along which the virtual object moves when the client uses animation to drive the virtual object to move; Acquiring animation data used by the client to drive the movement of the virtual object; Based on the animation data, obtaining displacement information of the virtual object on the animation driving path; Based on the displacement information, the position of the virtual object in the server is synchronized with the position of the virtual object in the client.

2. The method according to claim 1, characterized in that Acquiring an animation driving path through which the virtual object moves when the client uses animation to drive the virtual object in the client, including: Obtaining a target moving starting point and a target moving end point of the virtual object; Based on the target movement starting point and the target movement end point, pathfinding is performed in the map where the virtual object is located to obtain the target movement path of the virtual object; The path points in the target moving path are corrected to obtain animation driving path points for identifying the animation starting point or the animation ending point, and the animation driving path is obtained by connecting the animation driving path points.

3. The method according to claim 2, characterized in that Correcting the path points in the target moving path to obtain animation driving path points for marking the animation starting point or the animation ending point includes: Acquire terrain information of the area passed by the target moving path; Based on the terrain information, the area used to trigger the virtual object to interact with the virtual object is used as the animation driving area, and the path points at both ends of the animation driving area are corrected as the animation driving path points.

4. The method according to claim 2, characterized in that: Correcting the path points in the target moving path to obtain animation driving path points for marking the animation starting point or the animation ending point includes: If the path distance between the path point corresponding to the target movement starting point and its next path point is greater than or equal to the execution distance of the starting animation, the path point corresponding to the target movement starting point is corrected to an animation-driven path point for identifying the starting point of the starting animation, and an animation-driven path point for identifying the end point of the acceleration starting animation is set based on the execution distance of the starting animation.

5. The method according to claim 4, characterized in that The method further comprises: If the path distance between the path point corresponding to the target movement starting point and its next path point is less than the execution distance of the starting animation, the path point corresponding to the target movement starting point is refused to be corrected to the animation-driven path point for identifying the starting animation starting point.

6. The method according to claim 4, characterized in that The method further comprises: If the movement speed of the virtual object at the target movement starting point is greater than 0, the path point corresponding to the target movement starting point is rejected to be corrected as an animation driving path point for identifying the starting point of the starting animation.

7. The method according to claim 2, characterized in that Correcting the path points in the target moving path to obtain animation driving path points for marking the animation starting point or the animation ending point includes: If the path distance between the path point corresponding to the target moving end point and its previous path point is greater than or equal to the execution distance of the braking animation, the path point corresponding to the target moving end point is corrected to an animation-driven path point for identifying the end point of the braking animation, and an animation-driven path point for identifying the starting point of the braking animation is added based on the execution distance of the braking animation.

8. The method according to claim 7, characterized in that The method further comprises: If the path distance between the path point corresponding to the target moving end point and its previous path point is less than the execution distance of the braking animation, the path point corresponding to the target moving end point is rejected to be corrected to the animation driven path point for marking the starting point of the braking animation.

9. The method according to claim 1, characterized in that: Based on the animation data, obtaining displacement information of the virtual object on the animation driving path includes: Based on the animation data, estimating the animation frame number of the virtual object at the current moment; The displacement information of the virtual object on the animation driving path at the current moment is extracted from the animation data of the animation frame number at which the virtual object is located at the current moment.

10. A virtual object position synchronization device applied to a server, characterized in that: The device comprises: A path acquisition module, configured to acquire an animation driven path along which the virtual object moves when the client uses animation to drive the virtual object to move; An animation acquisition module, configured to acquire animation data used by the client to drive the virtual object to move; A displacement acquisition module, configured to acquire displacement information of the virtual object on the animation driving path based on the animation data; The position synchronization module is configured to synchronize the position of the virtual object in the server with the position of the virtual object in the client based on the displacement information.

11. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data processing method based on frame synchronization, server and client

    CN106559426A

  • Information processing method and device as well as server

    CN106657127A