Action control method and device for virtual character in game and electronic equipment
Through a pre-established action database, matching the target alternative actions based on the current state and posture of the virtual character, the complexity of the state machine network is solved, efficient action control and smooth animation playback are achieved, and game quality and player experience are improved.
Patent Information
- Application Number
- CN202410199877.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-22
- Publication Date
- 2025-08-22
AI Technical Summary
When using state machines to perform animation selection and playback in existing games, as the number of animations increases, the state machine network becomes complex and difficult to manage, and the action connection is poor, affecting the game quality and player experience.
Through a pre-established action database, independent alternative actions are determined based on the current state and target state of the virtual character, and target alternative actions are matched according to the current posture. There is no need for a state machine, and there is no limit on the number of animation resources in the action database.
It improves the action connection effect and smoothness of virtual characters, and improves the game quality and player's game experience.
Smart Images

Figure CN120515089A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of game technology, and in particular to a method, device, and electronic device for controlling the actions of a virtual character in a game. Background Art
[0002] Current games often use state machines to select and play character animations. This allows for relatively fast animation playback when the number of animations is small. However, as the number of animations increases, the state machine network becomes increasingly complex. Each additional animation requires additional relationships with other animations, and the number of relationship chains in the state machine network multiplies, making the state machine network difficult to manage and maintain. Furthermore, when state machines are used to select and play animations, the flow of movement is poor, resulting in choppy character movements, impacting game quality and the player experience. Summary of the Invention
[0003] In view of this, the purpose of the present disclosure is to provide a method, device and electronic device for controlling the actions of virtual characters in games. There is no need to implement action selection and playback through a state machine. Through a pre-established action database, the virtual character can be controlled to perform target alternative actions that match the current posture. The actions in the action database are independent of each other. There is no limit on the number of animation resources in the action database. Even if a large number of action resources are added, it can still run efficiently without the problem of difficult maintenance. At the same time, the action connection effect and action smoothness of the virtual character are improved, thereby improving the game quality and the player's gaming experience.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for controlling the actions of a virtual character in a game, wherein a graphical user interface is provided through a terminal device, and the graphical user interface includes a virtual character. The method comprises: determining a target state of the virtual character according to a current state of the virtual character; determining at least one alternative action from a pre-established action database according to the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; and determining a target alternative action that matches the current posture from at least one alternative action according to the current posture of the virtual character, and controlling the virtual character to perform the target alternative action.
[0005] In a second aspect, an embodiment of the present disclosure provides a motion control device for a virtual character in a game, which provides a graphical user interface through a terminal device, and the graphical user interface includes a virtual character. The device includes: a target state determination module, which is used to determine the target state of the virtual character according to the current state of the virtual character; an alternative action determination module, which is used to determine at least one alternative action from a pre-established action database according to the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; a target alternative action execution module, which is used to determine the target alternative action from at least one alternative action according to the current posture of the virtual character, and control the virtual character to execute the target alternative action.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for controlling the actions of a virtual character in a game according to any one of the first aspects.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for controlling the action of a virtual character in a game according to any one of the first aspects.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a method, device, and electronic device for controlling the actions of a virtual character in a game. The method comprises determining a target state of the virtual character based on the current state of the virtual character; determining at least one alternative action from a pre-established action database based on the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; and determining a target alternative action that matches the current posture from at least one alternative action based on the current posture of the virtual character, and controlling the virtual character to execute the target alternative action. In this method, there is no need to implement action selection and playback through a state machine. Instead, the pre-established action database is used to determine the alternative actions that the virtual character may need to execute, and then the virtual character is controlled to execute the target alternative action that matches the current posture. The actions in the action database are independent of each other, and there is no limit on the number of animation resources in the action database. Even if a large number of action resources are added, the virtual character can still run efficiently without difficulty in maintenance, thereby improving the action connection effect and action fluency of the virtual character, thereby improving the game quality and the player's gaming experience.
[0010] Other features and advantages of the present disclosure will be described in the following description, and in part will become apparent from the description, or understood by practicing the present disclosure. The objectives and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 This is a flow chart of a method for controlling the actions of a virtual character in a game provided by an embodiment of the present disclosure;
[0014] Figure 2 A schematic diagram of a current posture provided by an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of multiple action postures provided in an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of a process for determining target alternative actions provided by an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of an action notification and an action status in an action sequence provided in an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of the structure of a motion control device for a virtual character in a game provided by an embodiment of the present disclosure;
[0019] Figure 7 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present disclosure, not all of them. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0021] Different types of games require different technologies and development challenges. For example, realistic 3D sports games attract players with realistic graphics and rich, smooth action. However, if the game has few animations, the character's movements will be monotonous and repetitive. If the action playback isn't done properly, the game will appear inconsistent with the player's perception. Developers of these types of games face a large number of action animations during development. The key technical challenge in developing these games is organizing these animations and ensuring they play smoothly and realistically, simulating rich, realistic game scenes.
[0022] A state machine approach is often used to select and play character animations in games. This approach uses states as a basic unit, with different actions representing different states. Developers then edit the relationships between states using an editor, creating a state machine network. When a state machine state meets the conditions to jump to another state, the animation in that state plays immediately.
[0023] By implementing animation selection and playback in a state machine manner, when the number of animations is small, the animation playback of characters in the game can be achieved relatively quickly. However, there are the following problems: as the number of animations increases, the state machine network will become more and more complex. Every time an animation is added, the relationship with other animations needs to be increased, and the relationship chain will increase exponentially. When the number of animations reaches hundreds or thousands, the state machine network will become almost difficult to manage and maintain. In addition, it is difficult to consider the different animation connection postures when playing animations, so that when a new animation is played, the character's posture will change instantly, and the character's movement will appear unsmooth, affecting the quality of the game and the player's gaming experience. Based on this, the embodiments of the present disclosure provide a method, device and electronic device for controlling the movements of virtual characters in games. This technology can be applied to mobile phones, notebooks, tablets, computers and other devices.
[0024] In one embodiment of the present disclosure, the method for controlling the motion of a virtual character in a game can be run on a local terminal device or a server. When the method for controlling the motion of a virtual character in a game is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0025] In an optional embodiment, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud games as an example, cloud games refer to a gaming method based on cloud computing. In the cloud gaming operation mode, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the action control method of the virtual character in the game are completed on the cloud gaming server. The role of the client device is to receive and send data and present the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, TV, computer, PDA, etc.; however, it is the cloud gaming server in the cloud that performs information processing. When playing the game, the player operates the client device to send operation instructions to the cloud gaming server. The cloud gaming server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0026] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading and installing the game program through an electronic device and running it. The local terminal device can provide the graphical user interface to the player in a variety of ways, for example, it can be rendered and displayed on the terminal's display screen, or provided to the player through holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present the graphical user interface, the graphical user interface includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0027] In one possible implementation, an embodiment of the present invention provides a method for controlling the actions of a virtual character in a game, wherein a graphical user interface is provided via a terminal device, where the terminal device may be the aforementioned local terminal device or a client device in the aforementioned cloud interaction system. The graphical user interface includes a virtual character.
[0028] like Figure 1 As shown, the method includes the following steps:
[0029] Step S102, determining a target state of the virtual character based on the current state of the virtual character;
[0030] Optionally, in response to a control instruction for the virtual character, the current state of the virtual character is obtained, and the target state of the virtual character is determined according to the current state.
[0031] Exemplarily, before receiving the control instruction, the current state of the virtual character is not acquired. When the control instruction for the virtual character is received, the current state of the virtual character is acquired, and the target state of the virtual character is determined based on the acquired current state.
[0032] Optionally, the current state of the virtual character is acquired in real time, and a control instruction directed to the virtual character is responded to, and a target state of the virtual character is determined according to the current state.
[0033] Exemplarily, before receiving the above control instruction, the current state of the virtual character is acquired in real time, and when receiving the control instruction for the virtual character, the target state of the virtual character is determined according to the acquired current state.
[0034] The virtual character can be a player-controlled virtual character or a non-player-controlled virtual character. The current state refers to the virtual character's current state of motion and can be information describing the virtual character's motion at that moment. For example, the current state includes: current movement direction, current speed, current posture, current steering angle, etc. Optionally, during the game, the game system determines the virtual character's current state in real time.
[0035] Optionally, the control instructions include: a first control instruction generated in response to a control operation on a virtual character, and / or a second control instruction generated in response to an update to a game mission of the virtual character. It is understood that the control instructions include: a first control instruction generated in response to a control operation on a virtual character, and a second control instruction generated in response to an update to a game mission of the virtual character. Alternatively, the control instructions include: a first control instruction generated in response to a control operation on a virtual character, and a second control instruction generated in response to an update to a game mission of the virtual character.
[0036] The target state refers to the action state of the virtual character after executing the control command. It can also be the description of the virtual character's action at the target moment, where the target moment is the moment after the control command is executed. Executing the control command can mean performing a specific action or a specific game task. For example, the target state includes target movement direction, target speed, target posture, target turning angle, etc.
[0037] Optionally, in response to a control instruction for the virtual character, the target state of the virtual character is determined based on the current state and the control instruction. For example, in response to a control operation for the virtual character (the player inputs the up arrow key and clicks the pass button), the target state of the virtual character is determined based on the current state and the control operation. If the current state includes: current movement direction and current movement speed, based on the control operation of inputting the up arrow key and clicking the pass button, the target state can be determined to include: target movement direction, target movement speed, etc.
[0038] Step S104: Determine at least one candidate action from a pre-established action database based on the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information of the action sequence and the action content;
[0039] Optionally, the action features of the above-mentioned action are determined by the action notification or action state of the action sequence, and a preset action feature configuration table. The above-mentioned pre-established database includes at least one action, which are all pre-generated, and also includes at least one action feature of the action, and different action features are used to indicate different action information. Optionally, based on the current state and the target state, the action that needs to be performed for the virtual character to switch from the current state to the target state is determined, and the action that needs to be performed is matched with the action in the action database, and the matched action is determined as an alternative action. The above-mentioned action content includes action name, action duration, action type, action path, action ball data, action footstep data, action trigger range, action trigger angle, action trigger distance, action trigger speed, action rate, etc.
[0040] Optionally, based on the current state and the target state, the description information (i.e., state parameters) of the action that the virtual character needs to perform to switch from the current state to the target state is determined, and the description information is matched with each action feature of the action in the action database, and the action that matches the description information is determined as the alternative action.
[0041] Step S106 , determining a target candidate action that matches the current posture from at least one candidate action according to the current posture of the virtual character, and controlling the virtual character to execute the target candidate action.
[0042] The above current posture usually refers to the action posture of the virtual character at the current moment, and can also be understood as the posture of the current frame. For example, Figure 2 The current pose is shown. Often the candidate poses will include multiple poses.
[0043] Optionally, the posture features of the current posture and the action features of the alternative actions can be determined, the posture features and the action features can be compared, the alternative action with the same posture features as the action features can be determined from the action features, the alternative action can be determined as the target alternative action, and the virtual character can be controlled to perform the target alternative action.
[0044] Optionally, for each candidate action, a target action posture that matches the current posture is determined from the action postures included in the candidate action, the candidate action is determined as the target candidate action, and the virtual character is controlled to perform the target candidate action.
[0045] Optionally, a target action posture that matches the current posture is determined from a plurality of action postures included in at least one candidate action, an alternative action corresponding to the target action posture is determined as a target candidate action, and the virtual character is controlled to execute the target candidate action.
[0046] Optionally, the virtual character may be controlled to execute a target alternative action starting from the target action posture.
[0047] The disclosed embodiment provides a method for controlling the actions of a virtual character in a game. The method comprises determining a target state of the virtual character according to the current state of the virtual character; determining at least one alternative action from a pre-established action database according to the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; and determining a target alternative action that matches the current posture from at least one alternative action according to the current posture of the virtual character, and controlling the virtual character to execute the target alternative action. In this method, there is no need to implement action selection and playback through a state machine. Instead, the pre-established action database is used to determine the alternative actions that the virtual character may need to execute, and then the virtual character is controlled to execute the target alternative action that matches the current posture. The actions in the action database are independent of each other, and there is no limit on the number of animation resources in the action database. Even if a large number of action resources are added, the virtual character can still run efficiently without the problem of being difficult to maintain, thereby improving the action connection effect and action smoothness of the virtual character, thereby improving the game quality and the player's gaming experience.
[0048] A possible implementation of the above step of determining at least one alternative action from a pre-established action database based on the current state and the target state is as follows:
[0049] Step 1: determining state parameters of a virtual state based on the current state and the target state; the state parameters are used to indicate the action characteristics of the action required to be performed by the virtual character to switch from the current state to the target state;
[0050] The aforementioned motion features are related to the temporal information and motion content of the motion sequence. Optionally, the aforementioned state parameters include expected values of target motion features, such as movement direction: 50-60 degrees, movement speed: 20, dribbling hand: left hand, etc. Optionally, the state parameters of the virtual state are determined based on the difference between the current state and the target state. The difference can be a difference in feature values of the motion features or a difference in feature information of the motion features.
[0051] Optionally, the difference between the action parameters of the target state and the action parameters of the current state is calculated, and the state parameters of the virtual character are determined based on the difference; or, different features between the target state and the current state are determined, and the state parameters are determined based on the different features.
[0052] For example, the current state includes the current moving direction of 45 degrees (i.e., action parameters), and the target state includes the target moving direction of 180 degrees (i.e., action parameters). The difference in action parameters can be calculated as 180-45=135, and the state parameters of the virtual character include: the moving turning amount is 135 degrees, that is, the target action feature is "moving turning amount", and the expected value of the target action feature is "135 degrees".
[0053] For another example, the current state includes the current dribbler being the left hand, and the target state includes the target dribbler being the right hand. The different features between the target state and the current state can be determined as the parameters of the dribbler, and the state parameters of the virtual character obtained include: the dribbler changes from the left hand to the right hand, that is, the target action feature is "dribbler", and the expected value of the target action feature is "left hand to right hand".
[0054] Step 2: Determine at least one candidate action that matches the state parameter from a pre-established action database based on the action feature indicated by the state parameter and at least one action feature of each action.
[0055] Optionally, the large working parameters of each action can be compared with the action characteristics indicated by the state parameters from the multiple actions included in the action database, and the action that matches the state parameters can be determined as an alternative action. Since each action is independent of each other and there is no state network, multiple alternative actions will usually be matched. For example, the state parameters of the virtual character include: the dribbler switches from left hand to right hand, and the first action in the action database is the dribbler switching from left hand to right hand, then the first action can be determined as an alternative action. For another example, the state parameters of the virtual character include: the movement turning amount is 135 degrees, and the second action in the action database is the movement turning amount is 135 degrees, then the second action can be determined as an alternative action.
[0056] In one possible implementation, the action database includes at least one action and at least one action feature of the action; the action feature also includes a feature parameter. The state parameter includes at least one desired feature, which also includes an expected parameter. For example, the action feature includes a movement speed of 30, and the desired feature includes a movement speed of 60.
[0057] In step 2 above, the step of determining at least one candidate action matching the state parameter from a pre-established action database based on the action feature indicated by the state parameter and at least one action feature of each action, a possible implementation method is as follows:
[0058] Step 21: traverse at least one action and perform the following steps for each action:
[0059] For each expected feature, feature matching is performed between the expected feature and each action feature of the action to determine the matching result between the action and the state parameter;
[0060] Optionally, if each expected feature is identical to the corresponding action feature in the first action, or the expected feature belongs to a subset of the corresponding action feature in the first action, it is determined that the first action and the state parameter are matched successfully. If one or more expected features in the expected features are different from the corresponding action feature in the first action, or the one or more expected features do not belong to the subset of the corresponding action feature in the first action, it is determined that the first action and the state parameter are matched unsuccessfully.
[0061] Optionally, a specified expected feature among the expected features is determined, and for each specified expected feature, feature matching is performed on the specified expected feature with each action feature of the action to determine a matching result between the action and the state parameter. The specified expected feature is at least part of the expected feature, or the specified expected feature is an expected feature whose expected parameter is a specified parameter, where the specified parameter is used to indicate that the expected feature does not need to be matched.
[0062] Optionally, for each expected feature, feature matching is performed between the expected feature and the corresponding action feature to determine a matching result between the action and the state parameter.
[0063] Step 22: If the action successfully matches the state parameter, the action is determined as a candidate action that matches the state parameter.
[0064] The above-mentioned state parameters also include a matching tag of the expected feature; the matching tag includes a first tag and a second tag, the first tag indicates that the expected feature needs to be matched; the second tag indicates that the expected feature part needs to be matched.
[0065] In the above step 21, for each expected feature, the expected feature is matched with each action feature of the action, and the matching result of the action and the state parameter is determined. A possible implementation method is as follows:
[0066] Step 211, determining at least one target expected value whose matching tag is a first tag from the expected feature; wherein the first tag indicates that the expected feature needs to be matched;
[0067] Step 212 : For each target expected feature, feature matching is performed between the target expected feature and each action feature of the action to determine a matching result between the action and the state parameter.
[0068] Optionally, feature matching is performed between target expected features and corresponding action features in the action to determine a matching result between the action and the state parameters.
[0069] The target desired feature includes a first target desired feature and a second target desired feature; wherein the desired parameter of the first target desired feature is a required feature value, and the desired parameter of the second target desired feature is a non-required feature value. Whether the desired parameter of the desired feature is a required feature value or a non-required feature value is pre-configured.
[0070] In the above step 212, for each target expected feature, the target expected feature is matched with each action feature of the action, and a matching result of the action and the state parameter is determined. A possible implementation method is as follows:
[0071] (1) for each first target expected feature, comparing the first target expected feature with each action feature of the action, and if the first target expected feature is the same as the first action feature, determining that the first target expected feature matches successfully;
[0072] For example, if the first target expected feature is the dribbler's left hand, and the first action feature is the dribbler's left hand, it is determined that the first target expected feature is the same as the first action feature; for another example, if the first target expected feature is the dribbler's left hand, and the first action feature is the dribbler's right hand, it is determined that the first target expected feature is different from the first action feature.
[0073] (2) If each first target expected feature is successfully matched, for each second target expected feature, a deviation is calculated between the second target expected feature and the second action feature of the action to obtain a deviation value of the second target expected feature; the second target expected feature corresponds to the second action feature;
[0074] For example, if the second target desired feature is a moving angle of 135 and the second action feature is a moving angle of 131, the deviation between 135 and 131 is calculated to be 3%, and the deviation value of the second target desired feature is 3%. Similarly, the deviation values of other second target desired features are calculated.
[0075] Optionally, if there is a first target expected feature that fails to match among the first target expected features, it can be directly determined that the action fails to match the state parameter.
[0076] (3) According to the deviation value, determine the matching result of the action and state parameters.
[0077] Optionally, if the deviation value of the second target expected feature is less than the first deviation threshold, it is determined that the second target expected feature matches successfully; if each second target expected feature matches successfully, it is determined that the action matches the state parameter successfully.
[0078] Optionally, the sum of the deviation values of the second target expected feature is calculated to obtain a total deviation value of the action; if the total deviation value is less than a second deviation threshold, it is determined that the action matches the state parameter successfully.
[0079] The first deviation threshold and the second deviation threshold are different and are both set in advance according to game requirements.
[0080] Each of the above-mentioned alternative actions includes multiple action postures arranged according to the action time (for example, Figure 3 As shown), each action posture corresponds to an animation frame of the alternative action; the above step S106, based on the current posture of the virtual character, determines a target alternative action that matches the current posture from at least one alternative action, and controls the virtual character to perform the target alternative action, a possible implementation method is:
[0081] Step 3, determining a target action posture from a plurality of action postures included in at least one candidate action according to the current posture of the virtual character;
[0082] Optionally, the current posture is compared with each action posture, and a target action posture matching the current posture is determined from multiple action postures.
[0083] For example, determine the posture features of the current posture and the posture features of each action posture, compare the feature difference between the posture features of the current posture and the posture features of each action posture, obtain the feature difference value between the current posture and each action posture, and determine the action posture with the smallest feature difference value as the target action posture.
[0084] Step 4: determine the target alternative action corresponding to the target action posture, and control the virtual character to perform the target alternative action starting from the target action posture.
[0085] If the target alternative action includes four action poses, if the target action pose is the first action pose, the avatar is controlled to perform the target alternative action. If the target alternative action includes four action poses, if the target action pose is the second action pose, the avatar is controlled to perform the target alternative action starting from the second action pose. At this time, the avatar will only perform the second, third, and fourth action poses.
[0086] In the above method, the target action posture among the alternative actions is determined based on the current posture, and the virtual character is controlled to execute the target alternative action starting from the target action posture. Since the current posture is most similar to the target action posture, the action selected by the virtual character and the posture started to be executed can be connected with the current posture, thereby further improving the smoothness of the virtual character's movements.
[0087] In the above step 3, a possible implementation of determining a target action posture from a plurality of action postures included in at least one candidate action according to the current posture of the virtual character is as follows:
[0088] Step 31, determining the ranking of the action posture in the preset scoring items based on the current posture and the action posture;
[0089] The above-mentioned preset scoring items usually include multiple ones, such as the matching degree of hand and foot bone position, the matching degree of subsequent movement trend, the matching degree of waist bone orientation, the matching degree of movement direction and player input angle (joystick direction matching degree), the matching degree of both hands position, etc.
[0090] Optionally, characteristic data related to the preset item score in the current posture and characteristic data related to the preset item score in the action posture are determined, such as determining the first position data of the two feet in the current posture (such as the distance between the two feet, the horizontal distance between the two feet, etc.), and for example, determining the second position data of the two feet in the action posture (such as the distance between the two feet, the horizontal distance between the two feet, etc.), calculating the difference between the first position data and the second position data, and determining the ranking of the action posture in the preset scoring item based on the difference, where the smaller the difference, the higher the ranking.
[0091] Optionally, determine the characteristic information indicated by the preset scoring item; for each action posture, determine the difference between the posture feature of the current posture and the posture related to the characteristic information in the action posture; and determine the ranking of the action posture in the preset scoring item based on the difference.
[0092] For example, the characteristic information for determining the matching degree of hand and foot positions is the position of both feet, the characteristic information for determining the matching degree of subsequent movement trend is the subsequent movement trend, the characteristic information for determining the matching degree of waist bone orientation is the waist bone orientation, the characteristic information for determining the matching degree of movement direction and player input angle size (joystick direction matching degree) is the joystick direction, the characteristic information for determining the matching degree of both hands positions is the position of both hands, etc.
[0093] For example, the preset scoring item is the matching degree of the positions of both feet, and the characteristic information indicated by the preset scoring item is the positions of both feet. For each action posture, the first position distance between the left foot in the current posture and the left foot in the action posture, as well as the second position distance between the right foot in the current posture and the right foot in the action posture are calculated, and the sum of the first position distance and the second position distance is determined as the difference between the posture features of the current posture and the posture related to the characteristic information in the action posture.
[0094] Optionally, the differences are arranged from small to large, and the arrangement order is determined as the ranking of the action postures in the preset scoring items.
[0095] Step 32, for each action posture, calculating a score for the action posture based on the total number of the multiple action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items;
[0096] Optionally, the above-mentioned preset scoring items include multiple items; the scoring of the action posture is calculated in the following manner:
[0097] Score=∑ i (Nn i +1)*W i ;
[0098] Among them, Scroe is the score of the action posture, N is the total number of multiple action postures, n i Where n is the ranking of the action posture in the preset scoring items, i represents the i-th preset scoring item, and W i is the weight of the i-th preset scoring item.
[0099] In step 33, the action posture with the highest score is determined as the target action posture.
[0100] For example, Figure 4 As shown, the "cut-out pose" corresponds to the above-mentioned current pose, and the scoring criteria include "double-foot position matching", "hands position matching", and "joystick direction matching". It also includes "double-foot position matching" ranked 1 with a weight of 0.4, "hands position matching" ranked 2 with a weight of 0.2, and "joystick direction matching" ranked 3 with a weight of 0.4. "Animation A", "Animation B", and "Animation C" correspond to the above-mentioned alternative actions. Fraem0, Fraem1, Fraem2, and Fraem3 correspond to the above-mentioned action postures. The above calculation method can be used to obtain the score of each action posture. Among them, the action posture with the highest score (10.1) is determined as the target action posture.
[0101] The above-mentioned action database includes at least one action and at least one action feature of the action; the above-mentioned method also includes: determining the action sequence of the action for each action, and determining the first action feature of the action based on the action notification or action status of the action sequence; wherein the first action feature is an action feature related to the time information of the action sequence; determining the second action feature of the action according to a preset action feature configuration table; wherein the second action feature is an action feature that is not related to the time information of the action sequence; determining at least one action feature of the action based on the first action feature and the second action feature; and establishing an action database based on at least one action feature of the action.
[0102] In games, AnimNotify of AnimSequence is usually used as a "Tag" to mark the action characteristics of an action at a certain time (corresponding to the first action characteristics mentioned above). For example, Figure 5 As shown, it includes footstep data (FootTag), in / out time (BlendIn / OutTag), etc.
[0103] The preset action feature configuration table records some other action features of the action (corresponding to the second action feature mentioned above), such as: animation type, steering angle, cut-in speed, target speed, trigger distance, etc. Usually based on the principle of on-demand loading, different configuration tables are divided according to the action module. For example, "passing action" and "dribbling action" each have a feature configuration table, and the feature parameters used are also different. Using the above two sources (indicators of action sequence and action features), an action database is established. When the game is running, participate in the action selection process.
[0104] The action features of each action include but are not limited to: action name, action duration, action type, action path, action ball data, action footstep data, action entry time, action exit time, action trigger time, action trigger range, action trigger angle, action trigger distance, action trigger speed, action rate, etc.
[0105] This approach allows for adding motion resources without increasing the complexity of the existing animation system. Simply configuring and storing new motion resources according to specifications will allow them to take effect immediately in the game without any coupling or conflicts with existing motion resources. There's no limit on the number of motion resources, and the motion database contains a large number of motions, allowing the motion system to operate efficiently. Each action plays without sudden changes in the in-game character's posture, ensuring smooth and natural transitions.
[0106] Corresponding to the above method embodiment, the embodiment of the present disclosure provides a device for controlling the movement of a virtual character in a game, which provides a graphical user interface through a terminal device. The graphical user interface includes a virtual character, such as Figure 6 As shown, the device includes:
[0107] A target state determination module 61 is used to determine the target state of the virtual character according to the current state of the virtual character;
[0108] The candidate action determination module 62 is configured to determine at least one candidate action from a pre-established action database based on the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information of the action sequence and the action content;
[0109] The target candidate action execution module 63 is configured to determine a target candidate action from at least one candidate action according to the current posture of the virtual character, and control the virtual character to execute the target candidate action.
[0110] The disclosed embodiment provides a motion control device for a virtual character in a game. The device determines the target state of the virtual character according to the current state of the virtual character; determines at least one alternative action from a pre-established action database according to the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; according to the current posture of the virtual character, determines the target alternative action that matches the current posture from at least one alternative action, and controls the virtual character to execute the target alternative action. In this method, there is no need to implement action selection and playback through a state machine. The pre-established action database is used to determine the alternative actions that the virtual character may need to execute, and then controls the virtual character to execute the target alternative action that matches the current posture. The actions in the action database are independent of each other, and there is no limit on the number of animation resources in the action database. Even if a large number of action resources are added, it can still run efficiently without the problem of difficult maintenance, thereby improving the action connection effect and action smoothness of the virtual character, thereby improving the game quality and the player's gaming experience.
[0111] The above-mentioned alternative action determination module is also used to: determine the state parameters of the virtual state based on the current state and the target state; the state parameters are used to indicate the action characteristics of the action that the virtual character needs to perform to switch from the current state to the target state; based on the action characteristics indicated by the state parameters and at least one action feature of each action, determine at least one alternative action that matches the state parameters from a pre-established action database.
[0112] The above-mentioned state parameters include at least one expected feature; the above-mentioned alternative action determination module is also used to: traverse at least one action, and perform the following steps for each action: for each expected feature, feature match the expected feature with each action feature of the action, and determine the matching result between the action and the state parameter; if the action matches the state parameter successfully, determine the action as an alternative action that matches the state parameter.
[0113] The above-mentioned state parameters also include matching tags of expected features; the above-mentioned alternative action determination module is also used to: determine at least one target expected value whose matching tag is a first tag from the expected features; wherein the first tag indicates that the expected features need to be matched; for each target expected feature, the target expected feature is feature matched with each action feature of the action to determine the matching result of the action and the state parameters.
[0114] The above-mentioned target expected features include a first target expected feature and a second target expected feature; the above-mentioned alternative action determination module is also used to: for each first target expected feature, compare the first target expected feature with each action feature of the action; if the first target expected feature is the same as the first action feature, determine that the first target expected feature matches successfully; if each first target expected feature matches successfully, for each second target expected feature, calculate the deviation between the second target expected feature and the second action feature of the action to obtain the deviation value of the second target expected feature; the second target expected feature corresponds to the second action feature; and according to the deviation value, determine the matching result of the action and the state parameter.
[0115] The above-mentioned alternative action determination module is also used to: if the deviation value of the second target expected feature is less than the first deviation threshold, determine that the second target expected feature matches successfully; if each second target expected feature matches successfully, determine that the action matches the state parameter successfully.
[0116] The above-mentioned alternative action determination module is also used to: calculate the sum of the deviation values of the second target expected characteristics to obtain the total deviation value of the action; if the total deviation value is less than the second deviation threshold, determine that the action and the state parameter match successfully.
[0117] Each of the above-mentioned alternative actions includes multiple action postures arranged according to action time; the above-mentioned target alternative action execution module is also used to: determine the target action posture from the multiple action postures included in at least one alternative action according to the current posture of the virtual character; determine the target alternative action corresponding to the target action posture, and control the virtual character to execute the target alternative action starting from the target action posture.
[0118] The above-mentioned target alternative action execution module is also used to: determine the ranking of the action posture in the preset scoring items based on the current posture and the action posture; for each action posture, calculate the score of the action posture based on the total number of multiple action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items; and determine the action posture with the highest score as the target action posture.
[0119] The above-mentioned preset scoring items include multiple ones; the above-mentioned target candidate action execution module is also used to: calculate the score of the action posture by the following method: Score = ∑ i (Nn i +1)*W i ; Among them, Score is the score of the action posture, N is the total number of multiple action postures, n i Where n is the ranking of the action posture in the preset scoring items, i represents the i-th preset scoring item, and W i is the weight of the i-th preset scoring item.
[0120] The above-mentioned target alternative action execution module is also used to: determine the characteristic information indicated by the preset scoring item; for each action posture, determine the difference between the posture characteristics of the current posture and the posture related to the characteristic information in the action posture; and determine the ranking of the action posture in the preset scoring item based on the difference.
[0121] The above-mentioned action database includes at least one action and at least one action feature of the action; the above-mentioned device also includes a database establishment module, which is used to: determine the action sequence of the action for each action, and determine the first action feature of the action based on the action notification or action status of the action sequence; wherein the first action feature is an action feature related to the time information of the action sequence; determine the second action feature of the action according to a preset action feature configuration table; wherein the second action feature is an action feature that is not related to the time information of the action sequence; determine at least one action feature of the action based on the first action feature and the second action feature; and establish an action database based on at least one action feature of the action.
[0122] The control instructions include: a first control instruction generated for a control operation of a virtual character, and / or a second control instruction generated for an update of a game task of the virtual character.
[0123] The above-mentioned alternative action determination module is also used to: calculate the difference between the action parameters of the target state and the action parameters of the current state, and determine the state parameters of the virtual character based on the difference; or determine the different features between the target state and the current state, and determine them as state parameters based on the different features.
[0124] The target state determination module is further configured to obtain the current state of the virtual character in real time, respond to control instructions for the virtual character, and determine the target state of the virtual character according to the current state.
[0125] The motion control device for a virtual character in a game provided by the embodiment of the present disclosure has the same technical features as the motion control method for a virtual character in a game provided by the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.
[0126] This embodiment further provides an electronic device including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the method for controlling the movements of a virtual character in the aforementioned game. The electronic device can be a server or a terminal device.
[0127] See also Figure 7As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the motion control method of the virtual character in the above-mentioned game.
[0128] Furthermore, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0129] Among them, the memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA (Industry Standard Architecture, Industrial Standard Architecture) bus, PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus or EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0130] The processor 100 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 100 or by instructions in the form of software. The above-mentioned processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 101. The processor 100 reads the information in the memory 101 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.
[0131] The processor in the electronic device can implement the following operations in the method for controlling the actions of the virtual character in the game by executing the machine-executable instructions:
[0132] According to the current state of the virtual character, the target state of the virtual character is determined; according to the current state and the target state, at least one alternative action is determined from a pre-established action database; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; according to the current posture of the virtual character, a target alternative action that matches the current posture is determined from at least one alternative action, and the virtual character is controlled to execute the target alternative action.
[0133] In this method, there is no need to implement action selection and playback through a state machine. Through a pre-established action database, the alternative actions that the virtual character may need to perform are determined, and then the virtual character is controlled to perform the target alternative action that matches the current posture. The actions in the action database are independent of each other, and there is no limit on the number of animation resources. Even if a large number of action resources are added, it can still run efficiently without any maintenance problems, thereby improving the action connection effect and action smoothness of the virtual character, thereby improving the game quality and the player's gaming experience.
[0134] The above-mentioned step of determining at least one alternative action from a pre-established action database based on the current state and the target state includes: determining state parameters of the virtual state based on the current state and the target state; the state parameters are used to indicate the action characteristics of the action required to switch the virtual character from the current state to the target state; based on the action characteristics indicated by the state parameters and at least one action feature of each action, determining at least one alternative action that matches the state parameters from the pre-established action database.
[0135] The above-mentioned state parameters include at least one expected feature; based on the action feature indicated by the state parameter and at least one action feature of each action, the step of determining at least one alternative action that matches the state parameter from a pre-established action database includes: traversing at least one action, and performing the following steps for each action: for each expected feature, feature matching the expected feature with each action feature of the action, and determining the matching result between the action and the state parameter; if the action successfully matches the state parameter, determining the action as an alternative action that matches the state parameter.
[0136] The above-mentioned state parameters also include matching tags of expected features; for each expected feature, feature matching is performed on the expected feature with each action feature of the action, and the step of determining the matching result between the action and the state parameters includes: determining at least one target expected value whose matching tag is a first tag from the expected feature; wherein the first tag indicates that the expected feature needs to be matched; for each target expected feature, feature matching is performed on the target expected feature with each action feature of the action, and the matching result between the action and the state parameters is determined.
[0137] The above-mentioned target expected features include a first target expected feature and a second target expected feature; for each target expected feature, the target expected feature is feature matched with each action feature of the action, and the step of determining the matching result of the action and the state parameter includes: for each first target expected feature, the first target expected feature is compared with each action feature of the action; if the first target expected feature is the same as the first action feature, it is determined that the first target expected feature is matched successfully; if each first target expected feature is matched successfully, for each second target expected feature, the deviation of the second target expected feature and the second action feature of the action is calculated to obtain the deviation value of the second target expected feature; the second target expected feature corresponds to the second action feature; and according to the deviation value, the matching result of the action and the state parameter is determined.
[0138] The above-mentioned step of determining the matching result of the action and the state parameter based on the deviation value includes: if the deviation value of the second target expected feature is less than the first deviation threshold, determining that the second target expected feature is matched successfully; if each second target expected feature is matched successfully, determining that the action and the state parameter are matched successfully.
[0139] The above-mentioned step of determining the matching result of the action and the state parameter based on the deviation value includes: calculating the sum of the deviation values of the second target expected features to obtain the total deviation value of the action; if the total deviation value is less than the second deviation threshold, it is determined that the action and the state parameter are matched successfully.
[0140] Each of the above-mentioned alternative actions includes multiple action postures arranged according to action time; according to the current posture of the virtual character, determining a target alternative action that matches the current posture from at least one alternative action, and controlling the virtual character to perform the target alternative action, includes: according to the current posture of the virtual character, determining the target action posture from the multiple action postures included in at least one alternative action; determining the target alternative action corresponding to the target action posture, and controlling the virtual character to perform the target alternative action starting from the target action posture.
[0141] The above-mentioned step of determining the target action posture from multiple action postures included in at least one alternative action based on the current posture of the virtual character includes: determining the ranking of the action posture in the preset scoring items based on the current posture and the action posture; for each action posture, calculating the score of the action posture based on the total number of multiple action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items; and determining the action posture with the highest score as the target action posture.
[0142] The above-mentioned preset scoring items include multiple; according to the total number of multiple action postures, the ranking of the action postures in the preset scoring items, and the weight of the preset scoring items, the step of calculating the score of the action posture includes: calculating the score of the action posture by the following method: Score = ∑i (Nn i +1)*W i ; Among them, Scroe is the score of the action posture, N is the total number of multiple action postures, n i Where n is the ranking of the action posture in the preset scoring items, i represents the i-th preset scoring item, and W i is the weight of the i-th preset scoring item.
[0143] The above-mentioned step of determining the ranking of the action posture in the preset scoring items based on the current posture and the action posture includes: determining the characteristic information indicated by the preset scoring item; for each action posture, determining the difference between the posture features of the current posture and the posture related to the characteristic information in the action posture; and determining the ranking of the action posture in the preset scoring item based on the difference.
[0144] The above-mentioned action database includes at least one action and at least one action feature of the action; the method also includes: determining the action sequence of the action for each action, and determining the first action feature of the action based on the action notification or action status of the action sequence; wherein the first action feature is an action feature related to the time information of the action sequence; determining the second action feature of the action based on a preset action feature configuration table; wherein the second action feature is an action feature that is not related to the time information of the action sequence; determining at least one action feature of the action based on the first action feature and the second action feature; and establishing an action database based on at least one action feature of the action.
[0145] The control instructions include: a first control instruction generated for a control operation of a virtual character, and / or a second control instruction generated for an update of a game task of the virtual character.
[0146] The above-mentioned step of determining the state parameters of the virtual character based on the current state and the target state includes: calculating the difference between the action parameters of the target state and the action parameters of the current state, and determining the state parameters of the virtual character based on the difference; or determining the different features between the target state and the current state, and determining them as state parameters based on the different features.
[0147] The step of determining the target state of the virtual character according to the current state of the virtual character includes: acquiring the current state of the virtual character in real time, and responding to a control instruction for the virtual character to determine the target state of the virtual character according to the current state.
[0148] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the action control method of the virtual character in the above game.
[0149] The machine-executable instructions stored in the machine-readable storage medium can implement the following operations in the method for controlling the actions of the virtual character in the game by executing the machine-executable instructions:
[0150] According to the current state of the virtual character, the target state of the virtual character is determined; according to the current state and the target state, at least one alternative action is determined from a pre-established action database; wherein the action database includes at least one action and at least one action feature of the action, and the actions are independent of each other; the action feature is related to the time information and action content of the action sequence of the action; according to the current posture of the virtual character, a target alternative action that matches the current posture is determined from at least one alternative action, and the virtual character is controlled to execute the target alternative action.
[0151] In this method, there is no need to implement action selection and playback through a state machine. Through a pre-established action database, the alternative actions that the virtual character may need to perform are determined, and then the virtual character is controlled to perform the target alternative action that matches the current posture. The actions in the action database are independent of each other, and there is no limit on the number of animation resources. Even if a large number of action resources are added, it can still run efficiently without any maintenance problems, thereby improving the action connection effect and action smoothness of the virtual character, thereby improving the game quality and the player's gaming experience.
[0152] The above-mentioned step of determining at least one alternative action from a pre-established action database based on the current state and the target state includes: determining state parameters of the virtual state based on the current state and the target state; the state parameters are used to indicate the action characteristics of the action required to switch the virtual character from the current state to the target state; based on the action characteristics indicated by the state parameters and at least one action feature of each action, determining at least one alternative action that matches the state parameters from the pre-established action database.
[0153] The above-mentioned state parameters include at least one expected feature; based on the action feature indicated by the state parameter and at least one action feature of each action, the step of determining at least one alternative action that matches the state parameter from a pre-established action database includes: traversing at least one action, and performing the following steps for each action: for each expected feature, feature matching the expected feature with each action feature of the action, and determining the matching result between the action and the state parameter; if the action successfully matches the state parameter, determining the action as an alternative action that matches the state parameter.
[0154] The above-mentioned state parameters also include matching tags of expected features; for each expected feature, feature matching is performed on the expected feature with each action feature of the action, and the step of determining the matching result between the action and the state parameters includes: determining at least one target expected value whose matching tag is a first tag from the expected feature; wherein the first tag indicates that the expected feature needs to be matched; for each target expected feature, feature matching is performed on the target expected feature with each action feature of the action, and the matching result between the action and the state parameters is determined.
[0155] The above-mentioned target expected features include a first target expected feature and a second target expected feature; for each target expected feature, the target expected feature is feature matched with each action feature of the action, and the step of determining the matching result of the action and the state parameter includes: for each first target expected feature, the first target expected feature is compared with each action feature of the action; if the first target expected feature is the same as the first action feature, it is determined that the first target expected feature is matched successfully; if each first target expected feature is matched successfully, for each second target expected feature, the deviation of the second target expected feature and the second action feature of the action is calculated to obtain the deviation value of the second target expected feature; the second target expected feature corresponds to the second action feature; and according to the deviation value, the matching result of the action and the state parameter is determined.
[0156] The above-mentioned step of determining the matching result of the action and the state parameter based on the deviation value includes: if the deviation value of the second target expected feature is less than the first deviation threshold, determining that the second target expected feature is matched successfully; if each second target expected feature is matched successfully, determining that the action and the state parameter are matched successfully.
[0157] The above-mentioned step of determining the matching result of the action and the state parameter based on the deviation value includes: calculating the sum of the deviation values of the second target expected features to obtain the total deviation value of the action; if the total deviation value is less than the second deviation threshold, it is determined that the action and the state parameter are matched successfully.
[0158] Each of the above-mentioned alternative actions includes multiple action postures arranged according to action time; according to the current posture of the virtual character, determining a target alternative action that matches the current posture from at least one alternative action, and controlling the virtual character to perform the target alternative action, includes: according to the current posture of the virtual character, determining the target action posture from the multiple action postures included in at least one alternative action; determining the target alternative action corresponding to the target action posture, and controlling the virtual character to perform the target alternative action starting from the target action posture.
[0159] The above-mentioned step of determining the target action posture from multiple action postures included in at least one alternative action based on the current posture of the virtual character includes: determining the ranking of the action posture in the preset scoring items based on the current posture and the action posture; for each action posture, calculating the score of the action posture based on the total number of multiple action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items; and determining the action posture with the highest score as the target action posture.
[0160] The above-mentioned preset scoring items include multiple; according to the total number of multiple action postures, the ranking of the action postures in the preset scoring items, and the weight of the preset scoring items, the step of calculating the score of the action posture includes: calculating the score of the action posture by the following method: Score = ∑ i (Nn i +1)*W i ; Among them, Scroe is the score of the action posture, N is the total number of multiple action postures, n i Where n is the ranking of the action posture in the preset scoring items, i represents the i-th preset scoring item, and W i is the weight of the i-th preset scoring item.
[0161] The above-mentioned step of determining the ranking of the action posture in the preset scoring items based on the current posture and the action posture includes: determining the characteristic information indicated by the preset scoring item; for each action posture, determining the difference between the posture features of the current posture and the posture related to the characteristic information in the action posture; and determining the ranking of the action posture in the preset scoring item based on the difference.
[0162] The above-mentioned action database includes at least one action and at least one action feature of the action; the method also includes: determining the action sequence of the action for each action, and determining the first action feature of the action based on the action notification or action status of the action sequence; wherein the first action feature is an action feature related to the time information of the action sequence; determining the second action feature of the action based on a preset action feature configuration table; wherein the second action feature is an action feature that is not related to the time information of the action sequence; determining at least one action feature of the action based on the first action feature and the second action feature; and establishing an action database based on at least one action feature of the action.
[0163] The control instructions include: a first control instruction generated for a control operation of a virtual character, and / or a second control instruction generated for an update of a game task of the virtual character.
[0164] The above-mentioned step of determining the state parameters of the virtual character based on the current state and the target state includes: calculating the difference between the action parameters of the target state and the action parameters of the current state, and determining the state parameters of the virtual character based on the difference; or determining the different features between the target state and the current state, and determining them as state parameters based on the different features.
[0165] The step of determining the target state of the virtual character according to the current state of the virtual character includes: acquiring the current state of the virtual character in real time, and responding to a control instruction for the virtual character to determine the target state of the virtual character according to the current state.
[0166] The computer program product of the method, device and electronic device for controlling the actions of a virtual character in a game provided by the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. For specific implementation, please refer to the method embodiments and will not be repeated here.
[0167] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0168] In addition, in the description of the embodiments of the present disclosure, unless otherwise expressly specified or limited, the terms "installed," "connected," and "connected" should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to internal connections between two components. Those skilled in the art will understand the specific meanings of the above terms in the present disclosure based on the specific circumstances.
[0169] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0170] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate the description of this disclosure and simplify the description. They do not indicate or imply that the devices or components referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limitations on this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0171] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.
Claims
1. A method for controlling the motion of a virtual character in a game, characterized in that: A graphical user interface is provided through a terminal device, wherein the graphical user interface includes a virtual character, and the method includes: Determining a target state of the virtual character according to the current state of the virtual character; Determining at least one candidate action from a pre-established action database based on the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, the actions being independent of each other; and the action feature being related to time information of an action sequence and action content of the action; According to the current posture of the virtual character, a target candidate action matching the current posture is determined from the at least one candidate action, and the virtual character is controlled to perform the target candidate action.
2. The method according to claim 1, characterized in that The step of determining at least one candidate action from a pre-established action database according to the current state and the target state comprises: Determining state parameters of the virtual state according to the current state and the target state; the state parameters are used to indicate action characteristics of an action required for the virtual character to switch from the current state to the target state; At least one candidate action matching the state parameter is determined from a pre-established action database according to the action feature indicated by the state parameter and at least one action feature of each of the actions.
3. The method according to claim 2, characterized in that The state parameters include at least one desired characteristic; The step of determining at least one candidate action matching the state parameter from a pre-established action database according to the action feature indicated by the state parameter and at least one action feature of each of the actions comprises: Traverse the at least one action and perform the following steps for each action: For each of the expected features, perform feature matching on the expected feature with each action feature of the action, and determine a matching result between the action and the state parameter; If the action successfully matches the state parameter, the action is determined as a candidate action that matches the state parameter.
4. The method according to claim 3, characterized in that The state parameters also include matching tags of the expected features; For each of the expected features, performing feature matching on the expected feature with each action feature of the action, and determining a matching result between the action and the state parameter, comprises: Determining, from the desired feature, that the matching tag is at least one target expected value of a first tag; wherein the first tag indicates that the desired feature needs to be matched; For each of the target expected features, feature matching is performed between the target expected feature and each action feature of the action to determine a matching result between the action and the state parameter.
5. The method according to claim 4, characterized in that The target desired characteristics include a first target desired characteristic and a second target desired characteristic; For each of the target expected features, the step of performing feature matching on the target expected feature with each action feature of the action, and determining a matching result between the action and the state parameter includes: For each of the first target expected features, compare the first target expected feature with each action feature of the action, and if the first target expected feature is the same as the first action feature, determine that the first target expected feature matches successfully; If each of the first target expected features is successfully matched, for each of the second target expected features, calculating a deviation between the second target expected feature and the second action feature of the action to obtain a deviation value of the second target expected feature; the second target expected feature corresponds to the second action feature; A matching result between the action and the state parameter is determined according to the deviation value.
6. The method according to claim 5, characterized in that The step of determining a matching result between the action and the state parameter according to the deviation value includes: If the deviation value of the second target expected feature is less than the first deviation threshold, determining that the second target expected feature is matched successfully; If each of the second target expected features is matched successfully, it is determined that the action is matched successfully with the state parameter.
7. The method according to claim 5, characterized in that The step of determining a matching result between the action and the state parameter according to the deviation value includes: Calculating the sum of the deviation values of the second target expected feature to obtain a total deviation value of the action; If the total deviation value is less than a second deviation threshold, it is determined that the action matches the state parameter successfully.
8. The method according to claim 1, characterized in that Each of the candidate actions includes a plurality of action postures arranged according to action time; The steps of determining, according to the current posture of the virtual character, a target candidate action that matches the current posture from the at least one candidate action, and controlling the virtual character to perform the target candidate action include: Determining a target action posture from a plurality of action postures included in the at least one candidate action according to a current posture of the virtual character; Determine a target candidate action corresponding to the target action posture, and control the virtual character to perform the target candidate action starting from the target action posture.
9. The method according to claim 8, characterized in that The step of determining a target action posture from a plurality of action postures included in the at least one candidate action according to the current posture of the virtual character comprises: Determining a ranking of the action posture in a preset scoring item based on the current posture and the action posture; For each of the action postures, calculating a score for the action posture according to the total number of the plurality of action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items; The action posture with the highest score is determined as the target action posture.
10. The method according to claim 9, characterized in that The preset scoring items include multiple; The step of calculating the score of the action posture according to the total number of the plurality of action postures, the ranking of the action posture in the preset scoring items, and the weight of the preset scoring items includes: The score of the action posture is calculated as follows: Score=∑ i (N-n i +1)*W i ; Among them, Score is the score of the action posture, N is the total number of the multiple action postures, n i Where n is the ranking of the action posture in the preset scoring items, i represents the i-th preset scoring item, and W i is the weight of the i-th preset scoring item.
11. The method according to claim 9, characterized in that The step of determining the ranking of the action posture in a preset scoring item according to the current posture and the action posture comprises: Determining characteristic information indicated by the preset scoring item; For each of the action postures, determining a difference between the current posture and a posture feature of a posture in the action postures associated with the feature information; The ranking of the action posture in the preset scoring item is determined according to the difference.
12. The method according to claim 1, characterized in that The action database includes at least one action and at least one action feature of the action; The method further comprises: For each action, determining an action sequence of the action, and determining a first action feature of the action based on an action notification or an action state of the action sequence; wherein the first action feature is an action feature related to time information of the action sequence; Determining a second action feature of the action according to a preset action feature configuration table; wherein the second action feature is an action feature that is unrelated to the time information of the action sequence; determining at least one action feature of the action according to the first action feature and the second action feature; The action database is established according to at least one action feature of the action.
13. The method according to claim 1, wherein The control instruction includes: a first control instruction generated for a control operation of the virtual character, and / or a second control instruction generated for an update of a game task of the virtual character.
14. The method according to claim 2, characterized in that The step of determining the state parameters of the virtual character according to the current state and the target state comprises: Calculating the difference between the action parameters of the target state and the action parameters of the current state, and determining the state parameters of the virtual character according to the difference; or Different features between the target state and the current state are determined, and the state parameters are determined according to the different features.
15. The method according to claim 1, wherein The step of determining the target state of the virtual character according to the current state of the virtual character comprises: The current state of the virtual character is acquired in real time, and a control instruction for the virtual character is responded to, and a target state of the virtual character is determined according to the current state.
16. A motion control device for a virtual character in a game, characterized in that: A graphical user interface is provided through a terminal device, wherein the graphical user interface includes a virtual character, and the apparatus includes: A target state determination module, configured to determine a target state of the virtual character according to the current state of the virtual character; an alternative action determination module, configured to determine at least one alternative action from a pre-established action database based on the current state and the target state; wherein the action database includes at least one action and at least one action feature of the action, the actions being independent of each other; and the action feature being related to time information of an action sequence and action content of the action; The target candidate action execution module is used to determine a target candidate action from the at least one candidate action according to the current posture of the virtual character, and control the virtual character to execute the target candidate action.
17. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for controlling the actions of a virtual character in a game as described in any one of claims 1 to 15.
18. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for controlling the action of a virtual character in a game according to any one of claims 1 to 15.
Citation Information
Patent Citations
Virtual character control method and device, computing equipment and storage medium
CN112619148A
Virtual object action processing method and device and computer equipment
CN115920389A