Game character control method and device, server and computer readable storage medium
By smoothing the motion model data and position information of game characters in combat and movement states, the problems of motion delay and stuttering of game characters have been solved, improving the smoothness of player operation and the playability of the game.
Patent Information
- Application Number
- CN202411924031.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-12-25
AI Technical Summary
Delays, stutters, or unnatural movements of game characters during movement and attacks reduce the smoothness of player controls and the game's playability.
When a game character is in combat or moving, the motion model data and position information are smoothed to ensure the smoothness of skill release and movement. The character's status is obtained from the server and the smoothed data is sent to the client.
It improves the smoothness of player controls and the game's playability, ensuring that the character's skill release actions while moving are more natural and fluid.
Smart Images

Figure CN119701356B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and more specifically, to a game character control method, device, server, and computer-readable storage medium. Background Technology
[0002] In modern video games, character movement and attack actions are a core part of player interaction, and the smoothness and responsiveness of these actions directly affect player immersion and the overall quality of the game. However, game character actions may exhibit delays, stutters, or unnaturalness during execution, especially when the character is moving and attacking simultaneously, which reduces the fluidity of player controls and the game's playability. Summary of the Invention
[0003] The purpose of this invention is to provide a game character control method, device, server, and computer-readable storage medium to solve the problems of reduced player operation smoothness and game playability.
[0004] In a first aspect, the present invention provides a game character control method, applied to a server, wherein the server is communicatively connected to a client, the method comprising:
[0005] Obtain the state of the game character from the client;
[0006] When the game character is simultaneously in combat and moving states, the motion model data of the game character is smoothed, and the current position information of the game character is also smoothed to obtain the position information that the game character needs to reach in the next moment. The smoothed motion model data and the position information to be reached in the next moment are both sent to the client so that the client can control the game character to release skills according to the smoothed motion model data, and control the game character to move according to the position information to be reached in the next moment.
[0007] In an optional implementation, the method further includes:
[0008] When the game character is in the combat state but not in the movement state, the motion model data is smoothed, and the smoothed motion model data is sent to the client so that the client can control the game character to release skills according to the smoothed motion model data;
[0009] When the game character is in the moving state and not in the combat state, the current position information is smoothed to obtain the position information that the game character needs to reach in the next moment. The position information that the game character needs to reach in the next moment is sent to the client so that the client can control the movement of the game character according to the position information that the game character needs to reach in the next moment.
[0010] In an optional implementation, the smoothing process for the motion model data of the game character includes:
[0011] Based on the skill release command sent by the client, the motion model data is obtained; the motion model data includes the position information of multiple vertices;
[0012] Calculate the normal vector of each vertex based on its position information;
[0013] The smoothing weight of each vertex is obtained based on the normal vector of each vertex and the normal vectors of the vertex's neighboring vertices;
[0014] Based on the smoothing weight of each vertex and the position information of the adjacent vertices of each vertex, new position information of each vertex is obtained;
[0015] Add the new position information of all the vertices to the motion model data.
[0016] In an optional implementation, calculating the normal vector of each vertex based on its position information includes:
[0017] Calculate the normal vector of the plane containing any three vertices based on their position information;
[0018] For each vertex, the sum of the normal vectors of the planes containing the vertex is calculated to obtain the accumulated normal vector;
[0019] The accumulated normal vectors are normalized to obtain the normal vector for each vertex.
[0020] In an optional implementation, the smoothing process of the game character's current position information to obtain the position information that the game character needs to reach in the next moment includes:
[0021] Obtain the current location information of the game character;
[0022] Interpolation parameters are obtained based on the movement speed and movement time of the game character; the movement speed is obtained based on the movement control command sent by the client; the movement time is the time difference between the time the movement control command is received and the current time.
[0023] Based on the interpolation parameters, the current position information, and the target position information that the game character needs to reach, the position information that the game character needs to reach in the next moment is obtained until the game character reaches the target position information; the target position information is obtained according to the movement control command.
[0024] In an optional implementation, before obtaining the game character's state from the client, the method further includes:
[0025] When a movement control command is received from the client and the game character is in the combat state, a skill release command is generated without interruption.
[0026] The uninterrupted skill release command is sent to the client, so that the client can control the game character to move while controlling the game character to release the skill, and set the state of the game character to the moving state.
[0027] Secondly, the present invention provides a game character control device applied to a server, wherein the server is communicatively connected to a client, and the device includes:
[0028] A status acquisition module is used to acquire the status of the game character from the client.
[0029] The smoothing module is used to smooth the motion model data of the game character when the game character is simultaneously in combat and movement states, and to smooth the current position information of the game character to obtain the position information that the game character needs to reach in the next moment. The smoothed motion model data and the position information to be reached in the next moment are sent to the client so that the client can control the game character to release skills according to the smoothed motion model data, and control the game character to move according to the position information to be reached in the next moment.
[0030] In an optional implementation, the smoothing module is further configured to smooth the motion model data when the game character is in the combat state and not in the movement state, and send the smoothed motion model data to the client so that the client can control the game character to release skills according to the smoothed motion model data.
[0031] The smoothing module is further configured to, when the game character is in the moving state and not in the combat state, smooth the current position information to obtain the position information that the game character needs to reach in the next moment, and send the position information to be reached in the next moment to the client so that the client can control the movement of the game character according to the position information to be reached in the next moment.
[0032] Thirdly, the present invention provides a server including a processor and a memory, the memory storing a computer program executable by the processor, the processor executing the computer program to implement the game character control method described in any of the foregoing embodiments.
[0033] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the game character control method as described in any of the foregoing embodiments.
[0034] This invention provides a game character control method, device, server, and computer-readable storage medium. The method includes: obtaining the state of a game character from a client; when the game character is simultaneously in a combat state and a movement state, smoothing the game character's motion model data and smoothing the game character's current position information to obtain the position information the game character needs to reach in the next moment; sending both the smoothed motion model data and the position information to be reached in the next moment to the client, so that the client can control the game character to release skills based on the smoothed motion model data and control the game character to move based on the position information to be reached in the next moment. By simultaneously smoothing the motion model data and position information, the action of releasing skills while moving is ensured to be smoother, thereby improving the smoothness of player operation and the playability of the game. Attached Figure Description
[0035] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This diagram illustrates an application environment of the game character control method provided in an embodiment of the present invention.
[0037] Figure 2 This invention provides a schematic flowchart of a game character control method according to an embodiment of the invention.
[0038] Figure 3 This illustration shows another flowchart of the game character control method provided in an embodiment of the present invention;
[0039] Figure 4 This illustration shows another flowchart of the game character control method provided in an embodiment of the present invention;
[0040] Figure 5 This illustration shows another flowchart of the game character control method provided in an embodiment of the present invention;
[0041] Figure 6 This illustration shows another flowchart of the game character control method provided in an embodiment of the present invention;
[0042] Figure 7 A block diagram of a game character control device provided in an embodiment of the present invention is shown;
[0043] Figure 8 A block diagram of a server provided in an embodiment of the present invention is shown.
[0044] Icons: 100-Server; 110-Memory; 120-Processor; 130-Communication Module; 200-Client; 300-Game Character Control Device; 310-Status Acquisition Module; 320-Smoothing Processing Module. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0047] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0048] Please see Figure 1 , Figure 1 This diagram illustrates an application environment for the game character control method provided in this embodiment of the invention. Server 100 and client 200 are located on a network, and server 100 can communicate with client 200 to enable data interaction between them. Alternatively, server 100 and client 200 can connect via WIFI, ZigBee, or 2G / 3G / 4G / 5G, and this is not limited to any particular method.
[0049] The client 200 has a game program deployed on it, and the client 200 can run the game program. The game program can include MMORPG (Massively Multiplayer Online Role-Playing Game), ARPG (Action Role-Playing Game), etc., and is not limited here.
[0050] Please see Figure 2 , Figure 2 This diagram illustrates a flowchart of a game character control method provided by an embodiment of the present invention. This game character control method can be applied to a server; the specific flow of this embodiment is described below using a server as an example. The following section addresses... Figure 2 The process shown will be explained in detail. The game character control method may specifically include the following steps:
[0051] Step 130: Obtain the status of the game character from the client.
[0052] The game character's state can include combat and movement states, among others, and is not limited here. When a game character is in combat, it means that the character is engaged in a battle. When a game character is in movement, it means that the character is moving from one location to another.
[0053] In some implementations, the client monitors and records the state of game characters in the running game, and stores the state of the game characters. The client can store the identification information of the game characters and the state corresponding to each identification information in memory or a local database.
[0054] In some implementations, the client can generate status update information when the state of the game character changes, and send the status update information to the server. The server can obtain the game character's identification information based on the status update information, and obtain the game character's state from the client based on the identification information.
[0055] Step 140A: When the game character is simultaneously in combat and movement, smooth the game character's motion model data and smooth the game character's current position information to obtain the position information that the game character needs to reach in the next moment. Send both the smoothed motion model data and the position information to be reached in the next moment to the client so that the client can control the game character to release skills based on the smoothed motion model data and control the game character to move based on the position information to be reached in the next moment.
[0056] Action Model Data is a dataset that describes the details and changes of a game character's actions when releasing skills. It includes key parameters of a multi-dimensional model of the game character's actions throughout the entire process, from preparation to execution and recovery.
[0057] The game character control method provided in this invention obtains the game character's state from the client. When the game character is simultaneously in combat and movement states, the method smooths the game character's motion model data and current position information to obtain the next position the game character needs to reach. Both the smoothed motion model data and the next position information are sent to the client, allowing the client to control the game character to release skills based on the smoothed motion model data and move based on the next position information. By simultaneously smoothing both the motion model data and position information, the method ensures smoother skill release actions during movement, thereby improving player control fluidity and game playability.
[0058] In order to control the movement of game characters without interrupting their skill casting, such as... Figure 3 As shown, the steps preceding step 110 specifically include the following:
[0059] Step 110: When a movement control command is received from the client and the game character is in combat, generate a skill release command that does not interrupt the action.
[0060] The movement control commands may include command type, game character identification information, target location information, and movement speed, etc., which are not limited here.
[0061] In some implementations, the server can analyze the movement control command to determine the type of the command and obtain the game character's identification information, target location information, and movement speed. The server can obtain the game character's status from the client based on the game character's identification information. If the game character is in combat, the server generates a skill release command without interruption.
[0062] Step 120: Send the uninterrupted skill release command to the client so that the client can control the game character to move while controlling the game character to release the skill, and set the game character's state to the moving state.
[0063] Understandably, allowing players to continue controlling their character's movement while casting skills makes the gameplay smoother and more natural, increasing player freedom of action. It also allows for more flexible movement during combat, increasing tactical possibilities, such as casting skills while moving or dodging enemy attacks while casting skills, thus enhancing the game's strategy and challenge.
[0064] To enhance the smoothness of game character movements across different states, when the character is only in combat or only moving, the motion model data or current position information is smoothed, such as... Figure 4 As shown, the game character control method also includes the following steps:
[0065] Step 140B: When the game character is in combat but not moving, smooth the motion model data and send the smoothed motion model data to the client so that the client can control the game character to release skills based on the smoothed motion model data.
[0066] Step 140C: When the game character is in a moving state and not in a combat state, smooth the current position information and send the smoothed current position information to the client so that the client can control the movement of the game character based on the smoothed current position information.
[0067] like Figure 5 As shown, the specific steps for smoothing the motion model data in steps 140A and 140B above are as follows:
[0068] Step 210: Obtain motion model data based on the skill release command sent by the client.
[0069] The motion model data includes the positional information of multiple vertices. The skill release command includes the identification information of the game character and the identification information of the skill.
[0070] In some implementations, the server stores motion model data corresponding to the identification information of each skill. When a player selects a skill on the client and triggers its release, the client generates a skill release command, which includes the skill's identification information. The client sends the skill release command to the server, which can parse the skill release command, obtain the skill's identification information, and obtain the motion model data corresponding to that identification information.
[0071] Step 220: Calculate the normal vector of each vertex based on its position information.
[0072] In some implementations, the server can calculate the normal vectors of the planes containing any three vertices based on their position information. For each vertex, the server can calculate the sum of the normal vectors of the planes containing the vertex to obtain the cumulative normal vector. The cumulative normal vector can then be normalized to obtain the normal vector of each vertex.
[0073] In some implementations, the server can obtain the normal vector of the plane containing the three vertices by calculating the cross product of the vectors of the two edges including the vertex.
[0074] For example, the procedure for obtaining the normal vector of the plane containing the three vertices by calculating the cross product of the vectors containing the two edges of the vertex is as follows:
[0075] vec3 calculateNormal(const Vertex&v1,const Vertex&v2,const Vertex&v3){
[0076] glm::vec3 edge1 = v2.position - v1.position; / / edge1 is the first edge formed by the first vertex and the second vertex;
[0077] glm::vec3 edge2 = v3.position - v1.position; / / edge1 is the second edge formed by the first vertex and the third vertex;
[0078] return glm::normalize(glm::cross(edge1,edge2)); / / Calculate the cross product of the first and second edges.
[0079] For example, the procedure for calculating the sum of the normal vectors of the planes containing the vertex and obtaining the accumulated normal vector is as follows:
[0080] for(const auto&tri:triangles){
[0081] glm::vec3 normal=calculateNormal(vertices[tri.indices[0]],
[0082] vertices[tri.indices[1]],vertices[tri.indices[2]]); / / Find the normal vectors of the planes containing the vertices.
[0083]
[0084] Step 230: Obtain the smoothing weight of each vertex based on the normal vector of each vertex and the normal vectors of the vertex's neighboring vertices.
[0085] In some implementations, the server can calculate the cosine of the angle between a vertex and the edge formed by the vertex and its adjacent vertices, and the normal vector of the vertex, and determine the cosine value as the normal vector of the vertex.
[0086] Step 240: Obtain the new position information of each vertex based on the smoothing weight of each vertex and the position information of the vertex's neighboring vertices.
[0087] In some implementations, the server can calculate the new position information for each vertex according to the following formula:
[0088] V′ i =w i ×V i +∑ j∈N(i) w j ×V j
[0089] Among them, V′ i w represents the new position information of the i-th vertex. i w represents the smoothing weight of the i-th vertex. j V represents the smoothing weight of the j-th adjacent vertex of the i-th vertex. j Let N(i) represent the position information of the j-th adjacent vertex of the i-th vertex, and let N(i) represent the set of adjacent vertices of the i-th vertex.
[0090] Step 250: Add the new position information of all vertices to the motion model data.
[0091] In some implementations, the server can iterate the smoothing process of motion model data multiple times. After each iteration, the position information of each vertex in the motion model data is updated until the desired smoothing effect is achieved or the preset number of iterations is reached.
[0092] In some implementations, the server can add the new position information of all vertices to the motion model data to form a smoothed new motion model data. The server can then send this new motion model data to the client, which can then control the game character to release skills based on the new motion model data.
[0093] like Figure 6 As shown, the specific steps for smoothing the motion model data in steps 140A and 140C above are as follows:
[0094] Step 310: Obtain the current location information of the game character.
[0095] In some implementations, the server maintains location information corresponding to the identification information of each game character. The server can obtain the identification information of the game character based on the movement control commands sent by the client, and then obtain the current location information of the game character based on the identification information.
[0096] Step 320: Obtain interpolation parameters based on the game character's movement speed and movement time.
[0097] The movement speed is obtained based on the movement control command sent by the client; the movement time is the time difference between the time the movement control command is received and the current time.
[0098] In some implementations, the interpolation parameter is equal to the product of the movement speed and the movement time, and the range of the interpolation parameter is [0, 1]. It can be understood that the movement time is the time difference between the time when the movement control command is received and the current time. As time goes by, the movement time will change continuously, and correspondingly, the interpolation parameter will also change. This process will continue until the interpolation parameter reaches its maximum value of 1, marking the completion of the game character's movement process.
[0099] In some implementations, the server can use the Mathf.Clamp01 function to ensure that the interpolation parameter values are in the range [0, 1].
[0100] Step 330: Based on the interpolation parameters, current position information, and target position information that the game character needs to reach, obtain the position information that the game character needs to reach in the next moment, until the game character reaches the target position information.
[0101] The target location information is obtained based on the movement control command.
[0102] For example, the program to obtain the next position information of the game character based on the interpolation parameters, the current position information, and the target position information that the game character needs to reach is as follows:
[0103] public class:MonoBehaviour
[0104] {
[0105] public Transform target; / / Target location information
[0106] public float speed = 5.0f; / / Movement speed
[0107] void Update()
[0108] {
[0109] float t = Time.deltaTime * speed; / / Calculate the interpolation parameter (t), which varies according to the travel time (Time.deltaTime).
[0110] t = Mathf.Clamp01(t); / / Ensure the interpolation parameter (t) is between 0 and 1
[0111] transform.position=Vector3.Lerp(transform.position,target.position,t);
[0112] / / Perform linear interpolation to obtain the position information that the game character needs to reach in the next moment.
[0113] To prevent players from using skills too frequently, which would put too much pressure on the server's information transmission, a cooldown time can be configured for each skill on the server. This would avoid network latency caused by players using skills too frequently, thus improving the smoothness of player operation.
[0114] To enhance the player experience of unleashing skills while moving, players can customize their character's combo skills. For example, they can combine skills A, B, and C into a single combo skill for character A. This gives players more time to move or prepare for the next skill, and also increases the diversity of combat strategies.
[0115] Specifically, the server can store the combo skills of each game character. The combo skills are configured with a trigger order. The combo skills take effect when the player does not actively release the skills. That is, when the player does not actively release the skills, the electronic device will obtain the action model data of the skills from the server in sequence and release the skills in the order of triggering. However, at this time, the priority of manually releasing the skills by the player is higher than the skills in the automatic skill bar (combo skills). This can ensure the player's freedom of operation and maintain the continuity and smoothness of the battle.
[0116] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a game character control device is given below. Further, please refer to... Figure 7 The figure shows a functional block diagram of a game character control device provided in an embodiment of the present invention. It should be noted that the game character control device provided in this embodiment has the same basic principle and technical effects as the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The game character control device 300 includes: a status acquisition module 310 and a smoothing processing module 320, wherein:
[0117] The status acquisition module 310 is used to acquire the status of the game character from the client;
[0118] The smoothing module 320 is used to smooth the motion model data of the game character when the game character is simultaneously in combat and movement. It also smooths the current position information of the game character to obtain the position information that the game character needs to reach in the next moment. The smoothed motion model data and the position information to be reached in the next moment are sent to the client so that the client can control the game character to release skills according to the smoothed motion model data and control the game character to move according to the position information to be reached in the next moment.
[0119] Optionally, the smoothing module 320 is further used to smooth the motion model data when the game character is in a combat state and not in a moving state, and send the smoothed motion model data to the client so that the client can control the game character to release skills according to the smoothed motion model data.
[0120] The smoothing module 320 is also used to smooth the current position information when the game character is in a moving state and not in a combat state, to obtain the position information that the game character needs to reach in the next moment, and to send the position information to be reached in the next moment to the client so that the client can control the movement of the game character according to the position information to be reached in the next moment.
[0121] Optionally, the smoothing module 320 is further configured to obtain motion model data based on the skill release command sent by the client; the motion model data includes the position information of multiple vertices; calculate the normal vector of each vertex based on the position information of each vertex; obtain the smoothing weight of each vertex based on the normal vector of each vertex and the normal vectors of the vertex's neighboring vertices; obtain the new position information of each vertex based on the smoothing weight of each vertex and the position information of the vertex's neighboring vertices; and add the new position information of all vertices to the motion model data.
[0122] Optionally, the smoothing module 320 is further configured to calculate the normal vectors of the planes containing the three vertices based on the position information of any three vertices; for each vertex, calculate the sum of the normal vectors of the planes containing the vertex to obtain the accumulated normal vector; and normalize the accumulated normal vector to obtain the normal vector of each vertex.
[0123] Optionally, the smoothing module 320 is further used to obtain the current position information of the game character; obtain interpolation parameters based on the movement speed and movement time of the game character; the movement speed is obtained based on the movement control command sent by the client; the movement time is the time difference between the time of receiving the movement control command and the current time; obtain the position information that the game character needs to reach in the next moment based on the interpolation parameters, the current position information, and the target position information that the game character needs to reach, until the game character reaches the target position information; the target position information is obtained based on the movement control command.
[0124] Optionally, the game character control device 300 further includes: a skill release command generation module that does not interrupt skill release, wherein:
[0125] The uninterrupted skill release command generation module is used to generate uninterrupted skill release commands when the game character is in combat, after receiving a movement control command from the client and before obtaining the game character's status from the client. The uninterrupted skill release command is then sent to the client so that the client can control the game character to move while releasing skills, and set the game character's status to the moving state.
[0126] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0127] In several embodiments provided by the present invention, the coupling between modules can be electrical, mechanical or other forms of coupling.
[0128] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0129] Please refer to Figure 8This is a block diagram of a server 100 provided in an embodiment of the present invention. The server 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, processor 120, and communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0130] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0131] The processor 120 is used to read / write data or programs stored in the memory and perform corresponding functions. For example, when a computer program stored in the memory 110 is executed by the processor 120, the game character control method disclosed in the above embodiments can be implemented.
[0132] The communication module 130 is used to establish a communication connection between the server 100 and the client via the network, and to send and receive data via the network.
[0133] It should be understood that, Figure 8 The structure shown is only a schematic diagram of the server structure; the server may also include components such as... Figure 8 The number of components shown may be more or less. Figure 8 The components shown can be implemented using hardware, software, or a combination thereof.
[0134] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the game character control method described in the above method embodiments.
[0135] Computer-readable storage media can be electronic storage devices such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, computer-readable storage media includes non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for program code that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code can be compressed, for example, in a suitable form.
[0136] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0137] If the functionality is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0138] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for controlling a game character, characterized in that, Applied to a server, wherein the server communicates with a client, the method includes: Obtain the state of the game character from the client; When the game character is simultaneously in combat and movement, the motion model data of the game character is smoothed, and the current position information of the game character is also smoothed to obtain the position information that the game character needs to reach in the next moment. The smoothed motion model data and the position information to be reached in the next moment are both sent to the client so that the client can control the game character to release skills according to the smoothed motion model data, and control the game character to move according to the position information to be reached in the next moment. The smoothing process for the motion model data of the game character includes: Based on the skill release command sent by the client, the motion model data is obtained; the motion model data includes the position information of multiple vertices; Calculate the normal vector of each vertex based on its position information; The smoothing weight of each vertex is obtained based on the normal vector of each vertex and the normal vectors of the vertex's neighboring vertices; Based on the smoothing weight of each vertex and the position information of the adjacent vertices of each vertex, new position information of each vertex is obtained; Add the new position information of all the vertices to the motion model data.
2. The method according to claim 1, characterized in that, The method further includes: When the game character is in the combat state but not in the movement state, the motion model data is smoothed, and the smoothed motion model data is sent to the client so that the client can control the game character to release skills according to the smoothed motion model data; When the game character is in the moving state and not in the combat state, the current position information is smoothed to obtain the position information that the game character needs to reach in the next moment. The position information that the game character needs to reach in the next moment is sent to the client so that the client can control the movement of the game character according to the position information that the game character needs to reach in the next moment.
3. The method according to claim 1, characterized in that, The step of calculating the normal vector of each vertex based on its position information includes: Calculate the normal vector of the plane containing any three vertices based on their position information; For each vertex, the sum of the normal vectors of the planes containing the vertex is calculated to obtain the accumulated normal vector; The accumulated normal vectors are normalized to obtain the normal vector for each vertex.
4. The method according to claim 1 or 2, characterized in that, The process of smoothing the current position information of the game character to obtain the position information that the game character needs to reach in the next moment includes: Obtain the current location information of the game character; Interpolation parameters are obtained based on the movement speed and movement time of the game character; the movement speed is obtained based on the movement control command sent by the client; the movement time is the time difference between the time the movement control command is received and the current time. Based on the interpolation parameters, the current position information, and the target position information that the game character needs to reach, the position information that the game character needs to reach in the next moment is obtained until the game character reaches the target position information; the target position information is obtained according to the movement control command.
5. The method according to claim 1, characterized in that, Before obtaining the game character's state from the client, the method further includes: When a movement control command is received from the client and the game character is in the combat state, a skill release command is generated without interruption. The uninterrupted skill release command is sent to the client, so that the client can control the game character to move while controlling the game character to release the skill, and set the state of the game character to the moving state.
6. A game character control device, characterized in that, Applied to a server, wherein the server communicates with a client, the device includes: A status acquisition module is used to acquire the status of the game character from the client. The smoothing module is used to smooth the motion model data of the game character when the game character is simultaneously in combat and movement states, and to smooth the current position information of the game character to obtain the position information that the game character needs to reach in the next moment. The smoothed motion model data and the position information to be reached in the next moment are sent to the client so that the client can control the game character to release skills according to the smoothed motion model data, and control the game character to move according to the position information to be reached in the next moment. When the smoothing module is used to smooth the motion model data of the game character, it is specifically used for: Based on the skill release command sent by the client, the motion model data is obtained; the motion model data includes the position information of multiple vertices; based on the position information of each vertex, the normal vector of each vertex is calculated; based on the normal vector of each vertex and the normal vectors of its neighboring vertices, the smoothing weight of each vertex is obtained; based on the smoothing weight of each vertex and the position information of its neighboring vertices, the new position information of each vertex is obtained; and the new position information of all vertices is added to the motion model data.
7. The apparatus according to claim 6, characterized in that, The smoothing module is also used to smooth the motion model data when the game character is in the combat state and not in the movement state, and send the smoothed motion model data to the client so that the client can control the game character to release skills according to the smoothed motion model data. The smoothing module is further configured to, when the game character is in the moving state and not in the combat state, smooth the current position information to obtain the position information that the game character needs to reach in the next moment, and send the position information to be reached in the next moment to the client so that the client can control the movement of the game character according to the position information to be reached in the next moment.
8. A server, characterized in that, It includes a processor and a memory, the memory storing a computer program executable by the processor, the processor executing the computer program to implement the game character control method according to any one of claims 1-5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the game character control method as described in any one of claims 1-5.
Citation Information
Patent Citations
Game role control method, device and system, and game client
CN107835148A
Motion data processing method and device, product, equipment and medium
CN116977511A