Action method and device of game character, computer device and storage medium

By constructing an action queue and determining execution conditions based on real-time data, the problem of inflexible NPC behavior logic in existing technologies is solved, enabling reasonable behavior of game characters and reducing development difficulty.

CN114404980BActive Publication Date: 2025-11-11BEIJING PIXEL SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111632380.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-11-11
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

The existing NPC behavior logic implementation based on behavior trees in games is not flexible enough and involves a lot of logical judgments during execution, which increases the development difficulty for game designers.

Method used

By acquiring the game character's action goals, real-time self-data, and environmental data, an action queue is constructed. Based on this data, the execution conditions in the action queue are determined, and the game character is controlled to switch between standby and running states to execute the actions in the action queue.

Benefits of technology

It ensures the logical consistency of game character behavior, reduces the development difficulty for game designers, and makes game character behavior more flexible and realistic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114404980B_ABST
    Figure CN114404980B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, computer device, and storage medium for the action of a game character. The method includes: the computer device acquiring the game character's action target, real-time self-data, and real-time environmental data; determining multiple actions required by the game character to complete the action target based on the corresponding actions of the game character and the execution conditions of each action, i.e., constructing an action queue; when the execution conditions of the first action in the action queue can be satisfied by the real-time self-data and real-time environmental data, changing the state of the game character from a standby state to a running state, thereby controlling the game character to execute the actions in the action queue. Therefore, this invention, based on the game character's action target and the executable actions of the game character and the execution conditions of each action, establishes an action queue, ensuring logical consistency between adjacent actions in the action queue and guaranteeing the rationality of the game character's behavioral logic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of games, and more particularly to a method, apparatus, computer device, and storage medium for the movement of a game character. Background Technology

[0002] In existing games, the presence of NPCs (non-player characters) enhances gameplay, such as monster characters or shopkeepers in simulations. NPCs can perform a series of actions based on the current world environment and their own attributes, thus interacting with the player. Designing reasonable AI (Artificial Intelligence) for NPCs, that is, designing reasonable behavioral logic for NPCs, can bring a better gaming experience to the player.

[0003] Commonly, NPC behavior logic is implemented based on behavior trees and state machines. However, behavior logic based on behavior trees is mostly implemented through a fixed architecture, which is not flexible enough and involves a lot of logical judgments during execution. Moreover, for game designers, complex behavior trees will bring certain editing difficulties. Summary of the Invention

[0004] In view of this, the present invention provides a method, apparatus, computer device and storage medium for the action of game characters, which improves the current situation where behavior logic based on behavior trees is mostly implemented through a fixed architecture, which is not flexible enough and includes a lot of logical judgments during execution.

[0005] In a first aspect, embodiments of the present invention provide a method for the movement of a game character, wherein the state of the game character includes a standby state and a running state, and the method includes:

[0006] Acquire the game character's action target, real-time self data, and real-time environmental data within a preset range;

[0007] Based on the actions corresponding to the game character and the execution conditions of each action, an action queue corresponding to the action target is constructed, wherein the actions include game character movement actions;

[0008] Based on the real-time self-data and the real-time environment data, determine whether the execution conditions of the first action in the action queue are met;

[0009] If so, the state of the game character is changed from the standby state to the running state, and the game character is controlled to execute the actions in the action queue.

[0010] Optionally, in one embodiment of the present invention, constructing the action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action includes:

[0011] Based on the actions corresponding to the game character, determine all target actions corresponding to the action target, wherein the target actions are used to complete the action target;

[0012] For each target action, a corresponding initial queue is generated, and the target action is written into the initial queue;

[0013] Based on the execution conditions of each action, it is determined whether there is a corresponding prerequisite action for the execution conditions of the target action, wherein after the game character executes the prerequisite action, the real-time self data and real-time environmental data of the game character satisfy the execution conditions of the target action;

[0014] If it exists, write the prerequisite action into the initial queue and set the prerequisite action as the new target action;

[0015] Repeat the step of determining whether there is a corresponding prerequisite action for the execution condition of the target action based on the execution condition of each action, until there is no corresponding prerequisite action for the execution condition of the target action, and then use the initial queue as the action queue.

[0016] Optionally, in one embodiment of the present invention, after constructing the action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, and before determining whether the execution conditions of the first action in the action queue are met based on the real-time self data and the real-time environment data, the method further includes:

[0017] Calculate the queue cost of each action queue based on the execution cost of all actions in each action queue corresponding to the action target;

[0018] The step of determining whether the execution condition of the first action in the action queue is met based on the real-time self-data and the real-time environment data includes:

[0019] Based on the real-time self-data and the real-time environment data, determine whether the execution conditions of the first action in the action queue with the lowest queue cost are met;

[0020] The step of changing the state of the game character from the standby state to the running state, and controlling the game character to execute actions in the action queue, includes:

[0021] The game character's state is changed from the standby state to the running state, and the game character is controlled to execute the action in the action queue with the lowest queue cost.

[0022] Furthermore, in one embodiment of the present invention, after determining whether the execution condition of the first action in the action queue is met based on the real-time self-data and the real-time environment data, the method further includes:

[0023] If not, based on the real-time self-data and real-time environment data, determine one by one whether the execution conditions of the first action in the other action queues are met according to the order of the queue cost;

[0024] When the conditions are met, the game character's state is changed from standby to running, and the game character is controlled to execute the actions in the action queue that meet the execution conditions.

[0025] Furthermore, in one embodiment provided by this invention, the method further includes:

[0026] During the process of controlling the game character to execute the actions in the action queue, it is determined whether the execution conditions of the actions in the action queue are met based on the real-time self data and the real-time environment data;

[0027] If not, change the state of the game character from the running state to the standby state, and execute the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range.

[0028] Optionally, in one embodiment of the present invention, the step of changing the state of the game character from the standby state to the running state and controlling the game character to execute the action queue includes:

[0029] The game character's state is changed from the standby state to the running state, and the game character is controlled to execute the first action in the action queue;

[0030] When the game character completes the first action, it is removed from the action queue;

[0031] The state of the game character is changed from the running state to the standby state, and the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range are re-executed.

[0032] Optionally, in one embodiment of the present invention, the action is implemented through a behavior tree.

[0033] Secondly, embodiments of the present invention provide a method for the movement of a game character, wherein the state of the game character includes a standby state and a running state, and the method includes:

[0034] The acquisition module is used to acquire the game character's action target, real-time self data, and real-time environmental data within a preset range;

[0035] A construction module is used to construct an action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, wherein the actions include movement actions of the game character;

[0036] The judgment module is used to determine whether the execution conditions of the first action in the action queue are met based on the real-time self data and the real-time environment data.

[0037] An execution module is configured to, if so, change the state of the game character from the standby state to the running state, and control the game character to execute actions in the action queue.

[0038] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the computer program, when run on the processor, executes the action method of a game character as disclosed in any of the first aspects.

[0039] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when run on a processor, executes a method of action for a game character as disclosed in any of the first aspects.

[0040] In the game character action method provided in this embodiment of the invention, the computer device first acquires the game character's action target, real-time self-data, and real-time environmental data within a preset range, that is, determines the purpose of the game character's action, determines the game character's own data such as health points and strength attributes, and identifies the interactive objects around the game character; then, based on the corresponding actions of the game character, that is, the actions that the game character can execute, and the execution conditions of each action, that is, the real-time self-data conditions and / or real-time environmental data conditions that the game character must meet when executing the action, a sequence of actions corresponding to the action target is constructed, that is, it is determined which actions the game character will execute to complete the action target; then, based on the real-time self-data and real-time environmental data, it is determined whether the execution condition of the first action in the action queue is met, that is, it is determined whether the game character can execute the action queue in sequence; if it is met, the state of the game character is changed from standby state to running state, and the game character is controlled to execute the actions in the action queue.

[0041] Therefore, in the game character action method provided by this embodiment of the invention, the computer device, based on the game character's action target and the executable actions of the game character and the execution conditions of each action, formulates an action queue, ensuring logical consistency between adjacent actions in the action queue and guaranteeing the rationality of the game character's behavioral logic. Furthermore, when applying this embodiment of the invention to real-world scenarios, game designers only need to focus on the real-time changes in the game character's own data and environmental data after performing an action, and on the necessary conditions before the game character performs an action, without needing to consider the execution order of each action, thereby reducing development difficulty. Attached Figure Description

[0042] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of protection of the present invention. In the various drawings, similar components are numbered similarly.

[0043] Figure 1 A flowchart illustrating the first method for a game character to act, as provided in an embodiment of the present invention, is shown.

[0044] Figure 2 A flowchart illustrating a second method for the movement of a game character, as provided in an embodiment of the present invention, is shown.

[0045] Figure 3 A flowchart illustrating the third method for the movement of a game character provided in an embodiment of the present invention is shown;

[0046] Figure 4 A schematic diagram of the movement device for a game character provided in an embodiment of the present invention is shown. Detailed Implementation

[0047] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0048] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0049] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, component, assembly, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, components, assemblies, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, components, assemblies, or combinations thereof.

[0050] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0051] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.

[0052] Reference Figure 1 , Figure 1 A flowchart illustrating a first method for a game character's action according to an embodiment of the present invention is shown. In this method, the game character's state includes a standby state and a running state.

[0053] It is understood that game characters can be understood as NPCs in a virtual game world, or virtual objects of users temporarily controlled by computer devices. Any virtual object controlled by computer devices can be understood as a game character in the embodiments of the present invention.

[0054] It's also understandable that when a game character is in standby mode, the computer will determine the action objective the character needs to achieve, such as starting a fire, pressing a button at a preset location, or attacking a preset target. After determining the action objective, the computer will determine the actions the game character needs to perform to achieve it.

[0055] As an example, if the target requires the game character to use a weapon to attack, then when the game character does not have a weapon and the target is in sight, the computer device will set the game character to move to the location of the weapon, pick up the weapon, and use the weapon to attack the target.

[0056] When a game character is in a running state, the computer will control the game character to perform the actions required to complete the action objective one by one.

[0057] Based on this, the action method for game characters provided in the embodiments of the present invention includes:

[0058] S110, acquire the game character's action target, real-time self data, and real-time environmental data within a preset range.

[0059] In other words, the computer determines the action objectives that the game character needs to complete, such as winning the game. The game character's real-time self-data can be understood as carried items, health points, strength attribute values, etc. Real-time environmental data refers to the objects that the game character can interact with within a preset range, such as weapons that can be picked up, flammable items, and attackable targets, etc.

[0060] It is understood that the preset range can be adjusted according to the actual situation, and the embodiments of the present invention do not limit the preset range. For example, in one feasible method, the preset range is the visible range of the game character; while in another feasible method, the preset range is a circular range formed by taking the position of the game character as the center and a preset radius.

[0061] S120, construct an action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, wherein the actions include game character movement actions.

[0062] It is understandable that the actions corresponding to game characters are the actions that game characters can perform. Different types of game characters can be configured with different executable actions. For example, only male characters can perform the action of shaving, while fish characters can perform the action of blowing bubbles in the water.

[0063] When a game character performs an action, the game character must meet the conditions for performing the action. For example, to perform the action of starting a fire, the game character must have an ignition device among its items, and there must be flammable materials around the game character.

[0064] It should be noted that the actions of the game characters can be set according to the actual situation, and the execution conditions of each action are also the same. This embodiment of the invention does not impose any additional limitations.

[0065] It should also be noted that, in the embodiments of the present invention, the movement of the game character is not a single action or state, but rather movement is attached to various actions, that is, movement is combined with the action to be performed after movement, such as combining the archery action with movement, i.e., the action of moving and shooting arrows at the same time, etc. The embodiments of the present invention combine movement actions with other actions to obtain movement-type actions, making the movements of the game character more flexible and closer to reality.

[0066] Based on this, after determining the action goal of the game character, the computer device constructs multiple actions that the game character needs to perform to complete the action goal, namely, an action queue, according to the actions that the game character can perform and the execution conditions of each action.

[0067] It's important to understand that game characters complete action objectives by executing actions in the action queue, and the completion of the last action in the queue signifies the achievement of the objective. It's also crucial to understand that adjacent actions in the action queue have a logical sequence. For example, the condition for executing the "cooking action" is that "the game character's carried items include cleaned, culinary items." Therefore, the action preceding the "cooking action" is cleaning the culinary items carried.

[0068] Optionally, in one embodiment provided by the present invention, S120 includes:

[0069] Based on the actions corresponding to the game character, determine all target actions corresponding to the action target, wherein the target actions are used to complete the action target;

[0070] For each target action, a corresponding initial queue is generated, and the target action is written into the initial queue;

[0071] Based on the execution conditions of each action, it is determined whether there is a corresponding prerequisite action for the execution conditions of the target action, wherein after the game character executes the prerequisite action, the real-time self data and real-time environmental data of the game character satisfy the execution conditions of the target action;

[0072] If it exists, write the prerequisite action into the initial queue and set the prerequisite action as the new target action;

[0073] Repeat the step of determining whether there is a corresponding prerequisite action for the execution condition of the target action based on the execution condition of each action, until there is no corresponding prerequisite action for the execution condition of the target action, and then use the initial queue as the action queue.

[0074] In other words, the computer device first determines each action that can complete the objective from all the actions that the game character can perform; that is, the target action. It is easy to understand that there can be multiple actions corresponding to the game character completing the objective.

[0075] In one feasible manner, the target actions corresponding to the action objective "starting a fire" include "igniting combustibles using an ignition device" and "releasing fire magic".

[0076] Furthermore, when a game character performs multiple target actions to complete an action objective, the computer device will generate a corresponding initial queue for each target action and write the target actions into the initial queue.

[0077] Next, the computer device will determine whether the execution conditions of the target action can be met when the game character performs a certain action. That is, after the game character performs an action, the game character's real-time self data and real-time environmental data meet the execution conditions of the target action.

[0078] Taking the target action "releasing fire magic" corresponding to the above-mentioned action objective "starting a fire" as an example. If the execution condition for "releasing fire magic" is "having learned fire magic," and the action that the game character can perform includes "learning fire magic," then the computer device sets the action "learning fire magic" as a prerequisite action for "releasing fire magic." Then, the computer device writes the prerequisite action into the initial queue and sets the prerequisite action as the new target action.

[0079] Furthermore, after the new target action is set, the computer device will repeatedly determine whether there is a corresponding prerequisite action for the execution conditions of the target action based on the execution conditions of each action, and continuously write the prerequisite actions of each target action into the initial queue until there is no corresponding prerequisite action for the execution conditions of the target action. That is, after the game character performs any action, the corresponding real-time self data and real-time environment data cannot meet the execution conditions of the target action, or the game character does not need to perform any action, and the real-time self data and real-time environment data will definitely meet the target action. In this case, the computer device will use the initial queue as an action queue to complete the construction of an action queue corresponding to the action target.

[0080] Understandably, if there are multiple prerequisite actions for the target action, the computer device will copy the initial queue multiple times, write the different prerequisite actions into different initial queues, and transform the different initial queues into different action queues in the manner described above.

[0081] S130, based on the real-time self data and the real-time environment data, determine whether the execution conditions of the first action in the action queue are met.

[0082] In other words, the computer device determines whether the execution conditions of the first action in the action queue are met based on the game character's real-time self-data and real-time environmental data, that is, whether the game character can execute the actions in the action queue in the order of their sequence.

[0083] Understandably, if there are multiple action queues corresponding to the action target, the computer device can randomly select one action queue from all the action queues corresponding to the action target for judgment.

[0084] S140, if so, change the state of the game character from the standby state to the running state, and control the game character to execute the actions in the action queue.

[0085] In other words, when the game character's real-time self-data and real-time environmental data meet the execution conditions of the first action in the action queue, the computer device changes the game character's state from standby to running, thereby controlling the game character to execute the actions in the action queue.

[0086] If the game character's real-time self-data and real-time environment data meet the execution conditions of the first action in the action queue, but when the action target corresponds to multiple action queues, the computer device can further determine whether the first action in other action queues meets the execution conditions based on the real-time self-data and real-time environment data; when the conditions are met, the state is changed to running state, and the game character is controlled to execute the action in the action queue.

[0087] Furthermore, if the game character's real-time self-data and real-time environment data meet the execution conditions of the first action in the action queue, but there are no other corresponding action queues for the action target, the computer device skips the current action target and randomly selects a new action target from other action targets to re-execute S110.

[0088] Furthermore, if a game character has only one action target, the game character will remain in a standby state until the execution condition of the first action in any action queue corresponding to the action target is met, at which point subsequent steps will be executed.

[0089] Optionally, in one embodiment of the present invention, the specific execution process of S140 may include:

[0090] The game character's state is changed from the standby state to the running state, and the game character is controlled to execute the first action in the action queue;

[0091] When the game character completes the first action, it is removed from the action queue;

[0092] The state of the game character is changed from the running state to the standby state, and the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range are re-executed.

[0093] It should be noted that once the action queue is constructed, the computer device does not control the game character to execute each action in the action queue in an orderly manner. Instead, after the first action is executed, the action target is immediately redefined, and the corresponding action queue is constructed based on the redefined action target.

[0094] It is understandable that when an action in the action queue is completed, the game character's real-time self data and / or real-time environment data may change due to the execution of the action. The real-time self data and / or real-time environment data may also change due to the behavior of other game characters in the game, causing the execution conditions of other actions in the action queue to be unmet, or causing the execution conditions of the first action in the action queue of other action targets to be met. In other words, the action queue previously set by the computer device may not be accurately reflected in the changed real-time self data and / or real-time environment data.

[0095] Therefore, in this implementation, after the first action in the action queue is completed, the computer device will create a new action queue and control the game character to complete the action objective using the new action queue. It is easy to understand that if the game character's action objective remains unchanged, and the changed real-time self-data and / or real-time environmental data satisfy the second action in the original action queue (i.e., the first action in the new action queue), then after the game character continuously completes the first action in the action queue, the latest action queue should contain only one action—the action that completes the action objective.

[0096] In the game character action method provided by this invention, the computer device, based on the game character's action goals, establishes an action queue according to the actions the game character can perform and the execution conditions of each action. This ensures logical consistency between adjacent actions in the action queue, guaranteeing the rationality of the game character's behavioral logic. Furthermore, when applying this invention to real-world scenarios, game designers only need to focus on the real-time changes in the game character's own and environmental data after performing actions, as well as the necessary conditions before the game character performs actions, without needing to consider the execution order of each action, thereby reducing development difficulty.

[0097] Optional, see reference Figure 2 , Figure 2 The diagram illustrates a flowchart of a second method for the movement of a game character according to an embodiment of the present invention. Specifically, in one implementation of the present invention, after S120 and before S130, the method further includes:

[0098] S150, calculate the queue cost of each action queue based on the execution cost of all actions in each action queue corresponding to the action target;

[0099] Therefore, S130 includes:

[0100] S131, Based on the real-time self-data and the real-time environment data, determine whether the execution conditions of the first action in the action queue with the lowest queue cost are met;

[0101] Therefore, S140 includes:

[0102] S141, change the state of the game character from the standby state to the running state, and control the game character to execute the action in the action queue with the lowest queue cost.

[0103] In other words, in order to make the behavior of game characters more reasonable, in this implementation method, the computer device will determine the queue cost of each action queue after setting all the action queues corresponding to the action goal, so that the game character can complete the action goal with the lowest queue cost, that is, the most efficient action method.

[0104] It should be noted that in game design, each action is often assigned a corresponding action cost. Action cost can be understood as the resource consumption of a game character to perform an action. For example, in one feasible way, the action cost of attacking a target is 4, the action cost of eating medicine is 4, the action cost of running away is 3, the action cost of opening a treasure chest is 5, the action cost of picking up an item is 1, and the action cost of patrolling is 10.

[0105] It should also be noted that the cost of each action can be set according to the actual situation, and the embodiments of the present invention do not impose any limitations.

[0106] Based on this, the computer device sums the action costs of each action in each action queue to obtain the queue cost, and then determines the resources required for the game character to execute the action queue. Next, after calculating the queue cost of each action queue, the computer device first determines whether the game character's real-time self-data and real-time environmental data meet the execution conditions of the first action in the action queue with the lowest queue cost, that is, whether the game character can complete the behavioral goal in the most efficient way.

[0107] Therefore, in this implementation, when the game character can meet the execution conditions of the first action in the action queue with the lowest queue cost, the computer device will control the game character to complete the behavioral goal in the most efficient way, thereby making the game character's behavioral logic more reasonable and improving the game character's action efficiency.

[0108] Further reference Figure 3 , Figure 3 The diagram illustrates a flowchart of a third method for the action of a game character according to an embodiment of the present invention. Specifically, in one implementation of the present invention, after step S130, the method further includes:

[0109] S160, if not, based on the real-time self data and real-time environment data, determine one by one whether the execution condition of the first action in the other action queue is met according to the order of the queue cost;

[0110] S170, when the condition is met, the state of the game character is changed from standby state to running state, and the game character is controlled to execute the action in the action queue that meets the execution condition.

[0111] In other words, when the execution condition of the first action in the action queue with the lowest cost is not met, that is, when the game character cannot complete the action goal in the most efficient way, the computer will judge one by one whether the game character can complete the action goal in the second most efficient way, the third most efficient way, and so on, so as to ensure that the game character can complete the action goal according to a feasible action queue.

[0112] If the first action in all action queues is not satisfied, the computer device will skip the current action target and select any new action target from the other action targets corresponding to the game character, and then re-execute step S110.

[0113] If a game character has only one action target, the computer will keep the game character in a standby state until the execution condition of the first action in any action queue corresponding to the action target is met, at which point subsequent steps will be executed.

[0114] Furthermore, in one embodiment of this invention, when there are multiple action objectives corresponding to a game character, the computer device will generate a corresponding action queue for each action objective. For each action objective, the action cost with the lowest cost will be used as the target cost. Therefore, when the computer device controls the game character to perform actions, it will control the game character to complete each action objective one by one in ascending order of action cost.

[0115] Furthermore, in one embodiment provided by this invention, the method further includes:

[0116] During the process of controlling the game character to execute the actions in the action queue, it is determined whether the execution conditions of the actions in the action queue are met based on the real-time self data and the real-time environment data;

[0117] If not, change the state of the game character from the running state to the standby state, and execute the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range.

[0118] It is understandable that the real-time self-data and real-time environment data of a game character are not fixed during the execution of actions. They may change due to the behavior of other game characters. If the changed real-time self-data and real-time environment data can meet the execution conditions of the actions in the action queue, the computer device will control the game character to execute the actions completely.

[0119] If the changed real-time self-data and real-time environment data cannot meet the execution conditions of the actions in the action queue, the computer device will redetermine the action target corresponding to the game character, obtain real-time self-data and real-time environment data to construct a new action queue.

[0120] Optionally, in one embodiment of the present invention, the action is implemented through a behavior tree.

[0121] In other words, the embodiments of the present invention are compatible with the method of implementing actions through behavior trees. Therefore, when applying the embodiments of the present invention to a real development environment, game designers can separately set actions that can be easily implemented through behavior trees, making game development more flexible.

[0122] Corresponding to the action method for game characters provided in the embodiments of the present invention, the embodiments of the present invention also provide an action device for game characters, referring to... Figure 4 , Figure 4 This diagram illustrates the structure of a game character's movement device according to an embodiment of the present invention. In the game character's movement device 200 provided in this embodiment, the game character's state includes a standby state and a running state. The device includes:

[0123] The acquisition module 210 is used to acquire the action target, real-time self data, and real-time environmental data within a preset range of the game character;

[0124] The construction module 220 is used to construct an action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, wherein the actions include game character movement actions;

[0125] The judgment module 230 is used to determine whether the execution conditions of the first action in the action queue are met based on the real-time self data and the real-time environment data.

[0126] The execution module 240 is configured to, if so, change the state of the game character from the standby state to the running state, and control the game character to execute the actions in the action queue.

[0127] The motion device for the game character provided in this application embodiment can achieve... Figure 1The method embodiments described herein are based on the various processes of the game character's action method and can achieve the same technical effect. To avoid repetition, they will not be described in detail here.

[0128] This invention also provides a computer device, including a memory and a processor. The memory stores a computer program, which executes actions such as... when run on the processor. Figure 1 The illustrated method embodiment discloses the action method of the game character.

[0129] This invention also provides a computer-readable storage medium storing a computer program, which executes the following commands when run on a processor: Figure 1 The illustrated method embodiment discloses the action method of the game character.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0131] In addition, the functional modules or units in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0132] If the aforementioned functions are implemented as software functional modules 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 this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0133] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for the movement of a game character, characterized in that, The game character's state includes a standby state and a running state, and the method includes: Acquire the game character's action target, real-time self data, and real-time environmental data within a preset range; Based on the actions corresponding to the game character and the execution conditions of each action, an action queue corresponding to the action target is constructed, wherein the actions include game character movement actions; Based on the real-time self-data and the real-time environment data, determine whether the execution conditions of the first action in the action queue are met; If so, change the state of the game character from the standby state to the running state, and control the game character to execute the actions in the action queue; The step of constructing the action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action includes: Based on the actions corresponding to the game character, determine all target actions corresponding to the action target, wherein the target actions are used to complete the action target; For each target action, a corresponding initial queue is generated, and the target action is written into the initial queue. Based on the execution conditions of each action, it is determined whether there is a corresponding prerequisite action for the execution conditions of the target action, wherein after the game character executes the prerequisite action, the real-time self data and real-time environmental data of the game character satisfy the execution conditions of the target action; If it exists, write the prerequisite action into the initial queue and set the prerequisite action as the new target action; Repeat the step of determining whether there is a corresponding prerequisite action for the execution condition of the target action based on the execution condition of each action, until there is no corresponding prerequisite action for the execution condition of the target action, and then use the initial queue as the action queue.

2. The method according to claim 1, characterized in that, After constructing the action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, and before determining whether the execution condition of the first action in the action queue is met based on the real-time self data and the real-time environment data, the method further includes: Calculate the queue cost of each action queue based on the execution cost of all actions in each action queue corresponding to the action target; The step of determining whether the execution condition of the first action in the action queue is met based on the real-time self-data and the real-time environment data includes: Based on the real-time self-data and the real-time environment data, determine whether the execution conditions of the first action in the action queue with the lowest queue cost are met; The step of changing the state of the game character from the standby state to the running state, and controlling the game character to execute actions in the action queue, includes: The game character's state is changed from the standby state to the running state, and the game character is controlled to execute the action in the action queue with the lowest queue cost.

3. The method according to claim 2, characterized in that, After determining whether the execution condition of the first action in the action queue is met based on the real-time self-data and the real-time environment data, the method further includes: If not, based on the real-time self-data and real-time environment data, determine one by one whether the execution conditions of the first action in the other action queues are met according to the order of the queue cost; When the conditions are met, the game character's state is changed from standby to running, and the game character is controlled to execute the actions in the action queue that meet the execution conditions.

4. The method according to claim 3, characterized in that, The method further includes: During the process of controlling the game character to execute the actions in the action queue, it is determined whether the execution conditions of the actions in the action queue are met based on the real-time self data and the real-time environment data; If not, change the state of the game character from the running state to the standby state, and execute the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range.

5. The method according to claim 1, characterized in that, The step of changing the state of the game character from the standby state to the running state and controlling the game character to execute the action queue includes: The game character's state is changed from the standby state to the running state, and the game character is controlled to execute the first action in the action queue; When the game character completes the first action, it is removed from the action queue; The state of the game character is changed from the running state to the standby state, and the steps of obtaining the game character's action target, real-time self data, and real-time environmental data within a preset range are re-executed.

6. The method according to claim 1, characterized in that, The actions are implemented using a behavior tree.

7. A motion device for a game character, characterized in that, The game character's state includes a standby state and a running state, and the device includes: The acquisition module is used to acquire the game character's action target, real-time self data, and real-time environmental data within a preset range; A construction module is used to construct an action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action, wherein the actions include movement actions of the game character; The judgment module is used to determine whether the execution conditions of the first action in the action queue are met based on the real-time self data and the real-time environment data. An execution module is configured to, if so, change the state of the game character from the standby state to the running state, and control the game character to execute actions in the action queue; The step of constructing an action queue corresponding to the action target based on the actions corresponding to the game character and the execution conditions of each action includes: Based on the actions corresponding to the game character, determine all target actions corresponding to the action target, wherein the target actions are used to complete the action target; For each target action, a corresponding initial queue is generated, and the target action is written into the initial queue. Based on the execution conditions of each action, it is determined whether there is a corresponding prerequisite action for the execution conditions of the target action, wherein after the game character executes the prerequisite action, the real-time self data and real-time environmental data of the game character satisfy the execution conditions of the target action; If it exists, write the prerequisite action into the initial queue and set the prerequisite action as the new target action; Repeat the step of determining whether there is a corresponding prerequisite action for the execution condition of the target action based on the execution condition of each action, until there is no corresponding prerequisite action for the execution condition of the target action, and then use the initial queue as the action queue.

8. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program that, when run on the processor, executes the action method of the game character as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed on a processor, performs the action method of the game character as described in any one of claims 1-6.