A method, apparatus, device, and storage medium for game behavior planning

By quantifying the state of non-player characters and obtaining behavioral route information, the problem of repetitive and monotonous behavior planning in traditional non-player characters is solved, enabling faster development and a richer gaming experience.

CN115624759BActive Publication Date: 2026-04-21超参数科技(深圳)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
超参数科技(深圳)有限公司
Filing Date
2022-10-18
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In traditional non-player character behavior planning, behavior is constrained by rules, leading to repetitive and monotonous gameplay and affecting the gaming experience.

Method used

By acquiring the current state and target task planning of non-player characters, the distance of behavioral states is quantified, and behavioral route information is obtained from the action library for planning.

Benefits of technology

It increases the speed of non-player character development and behavioral diversity, thereby enhancing the player's gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115624759B_ABST
    Figure CN115624759B_ABST
Patent Text Reader

Abstract

This application provides a game behavior planning method, apparatus, computer device, and medium. The method includes: acquiring the current state information and target task planning of a non-player character in the game, wherein the current state information includes the current behavior and the current behavior state, and the target task planning includes the target behavior state; quantifying the current behavior state and the target behavior state, and calculating the distance between the quantified current behavior state and the target behavior state; acquiring behavior route information from an action library based on the distance, using the current behavior as a reference; and performing behavior planning on the non-player character based on the behavior route information, so that the non-player character completes the target task planning. The method proposed in this application can acquire the behavior route of the non-player character according to a given target task planning, and then control it to complete the target planning. This method improves the development speed of the non-player character, and the behavior range of the non-player character is wide, which can improve the player's user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a game behavior planning method, a game behavior planning device, a computer device, and a computer storage medium. Background Technology

[0002] With the development of computer technology, applying artificial intelligence (AI) to the gaming industry has become a current trend. In particular, non-player characters developed using AI have become an indispensable part of games.

[0003] Currently, traditional non-player character behavior planning typically relies on pre-written rules to control their actions. Because these rules specify a particular order for all actions, non-player characters can only execute tasks according to a completely ordered principle, without considering whether individual actions satisfy the preconditions of other actions. Furthermore, since the task steps are fixed, the non-player character's behavior lacks variation, becoming repetitive and monotonous, negatively impacting the player's sense of realism and immersion in the game world. Additionally, because the set of rule-based actions is finite, the non-player character's behavior is also limited, resulting in a poor gaming experience for players. Summary of the Invention

[0004] This application provides a game behavior planning method, a game behavior planning device, a computer device, and a computer storage medium, which can improve the development speed of non-player characters, and improve the user experience because the behavior range of non-player characters is wider.

[0005] Firstly, this application provides a game behavior planning method, the method comprising:

[0006] Obtain the current state information and target task planning of non-player characters in the game, wherein the current state information includes the current behavior and the current behavior state, and the target task planning includes the target behavior state;

[0007] The current behavior state and the target behavior state are quantified, and the distance between the quantized current behavior state and the target behavior state is calculated.

[0008] Based on the current behavior, obtain behavior route information from the action library based on the distance;

[0009] Based on the behavioral route information, behavioral planning is performed on the non-player character to enable the non-player character to complete the target task planning.

[0010] Secondly, this application also provides a game behavior planning device, the device comprising:

[0011] The acquisition module is used to acquire the current status information and target task planning of non-player characters in the game. The current status information includes the current behavior and the current behavior status, and the target task planning includes the target behavior status.

[0012] A calculation module is used to quantify the current behavior state and the target behavior state, and to calculate the distance between the quantized current behavior state and the target behavior state.

[0013] The acquisition module is also used to acquire behavior route information from the action library based on the distance, using the current behavior as a reference.

[0014] A behavior planning module is used to plan the behavior of the non-player character based on the behavior route information, so that the non-player character can complete the target task planning.

[0015] Thirdly, this application also provides a computer device, the computer device comprising:

[0016] Memory and processor;

[0017] The memory is connected to the processor and is used to store programs;

[0018] The processor is used to implement the steps of the game behavior planning method as described in any of the embodiments of this application by running the program stored in the memory.

[0019] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the steps of the game behavior planning method as described in any of the embodiments of this application.

[0020] The game behavior planning method, device, computer equipment, and computer storage medium disclosed in this application can obtain behavior route information from an action library according to a given target task plan, and then control the behavior of a non-player character based on the behavior route information. Since no rules need to be pre-defined, the development speed of non-player characters is improved. Furthermore, because the action library contains a wide range of non-player character behaviors, it is also possible to control the non-player character to complete the specified target plan through a greater number of behavior sequences, thus improving the player's user experience.

[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram illustrating the steps of a game behavior planning method provided in an embodiment of this application;

[0024] Figure 2 This is a schematic block diagram of a game behavior planning device provided in one embodiment of this application;

[0025] Figure 3 This is a schematic block diagram of a computer device provided in an embodiment of this application;

[0026] Figure 4 This is a schematic diagram of the structure of the computer-readable storage medium provided in this application.

[0027] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Detailed Implementation

[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0030] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0031] It should be understood that, in order to clearly describe the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, the first identification model and the second identification model are only used to distinguish different callback functions and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" do not necessarily mean they are different.

[0032] It should also be understood that the term "and / or" as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0033] To facilitate understanding of the embodiments of this application, some background technologies involved in the embodiments of this application will be briefly described below.

[0034] In typical games, the actions of non-player characters are governed by rules, making it a fully ordered task. A non-player character's objective action might include destroying a target or acquiring an item. In traditional task systems, non-player characters are limited to choosing only one crucial action at a given time. Once selected, a non-player character can chain atomic actions into a sequence to create a task. A fully ordered task specifies a particular order for all non-player character actions, regardless of whether individual actions satisfy the prerequisites for others. While objective actions can be performed in any order, a fully ordered task dictates the sequence of these actions, resulting in monotonous and repetitive behavior that negatively impacts the player's sense of realism and immersion in the game world. Furthermore, because the set of rule-based actions is finite, the non-player character's actions are also limited, leading to a poor gaming experience.

[0035] Based on this, this application proposes a game behavior planning method, a game behavior planning device, a computer device, and a computer storage medium. It can retrieve behavior route information from an action library according to a given target task plan, and then control the behavior of a non-player character based on this behavior route information. Since no rules need to be pre-defined, the development speed of non-player characters is improved. Furthermore, because the action library contains a wide range of non-player character behaviors, it is also possible to control the non-player character to complete the specified target plan through a greater number of behavior sequences, thus improving the player's user experience.

[0036] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0037] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating the steps of a game behavior planning method provided in an embodiment of this application. This method can be applied to computer devices for behavior planning of non-player characters in games.

[0038] like Figure 1 As shown, the game behavior planning method includes steps S11 to S14.

[0039] Step S11: Obtain the current status information and target task planning of non-player characters in the game. The current status information includes the current behavior and the current behavior status, and the target task planning includes the target behavior status.

[0040] Non-player characters (NPCs) are an important part of the game. They are not controlled by the player, but they can drive the development of the game's plot based on the player's operation commands.

[0041] It should be noted that this application does not limit the type of game mentioned above. For example, it can be an MMO (Massive Multiplayer Online) game, including but not limited to MMORPG games. MMO games support multiple online players and have strong interactivity, allowing players to interact strongly with non-player characters, thus obtaining a better gaming experience.

[0042] Based on this, the current behavior information of a non-player character includes the current behavior and the current behavior state. The current behavior state of a non-player character may include their hunger level, mood, stamina, etc., which are not limited in this application.

[0043] Furthermore, the aforementioned non-player character's target task planning includes target behavioral states. These target behavioral states are the state information of the non-player character as instructed by the player, such as the non-player character's target hunger level, target mood level, target stamina level, etc., which this application does not limit. It is understandable that during gameplay, after obtaining the current state information of the non-player character, it is necessary to control the non-player character to complete the target task planning through a series of actions based on the current behavior. This series of actions is linked together to form a behavioral path.

[0044] In specific implementation, during the game, based on the current behavior information and target behavior information of the non-player characters obtained in S11, this embodiment of the disclosure can proceed to the next step of processing through step S12, as described in detail below:

[0045] Step S12: Quantify the current behavior state and the target behavior state, and calculate the distance between the quantified current behavior state and the target behavior state.

[0046] Since non-player characters need to follow a behavioral path to reach the target behavioral state from the current behavioral state, in order to obtain the behavioral path, it is necessary to first quantify the current behavioral state and the target behavioral state, and then calculate the distance between the quantified current behavioral state and the target behavioral state.

[0047] It should be noted that this application does not limit the quantification method described above; for example, quantification can be performed using the GOAP algorithm. The GOAP algorithm can define executable behaviors for non-player characters, such as eating, cooking, and grocery shopping. It can also use binary variables to describe the behavioral state of the non-player character. Since the behavioral state of the non-player character includes state variables such as hunger level, mood, and stamina, these state variables can be described. For example, behavioral state S1: Hunger 1, Happiness 0, Fatigue 1; behavioral state S2: Hunger 0, Happiness 1, Fatigue 0.

[0048] Furthermore, this application does not limit the method for calculating the distance described above; for example, the distance can be calculated using a heuristic function. Heuristic functions can calculate the minimum cost evaluation value from any node to the target node. The capabilities of heuristic functions play an indispensable role in games, and the trade-off between their calculation speed and accuracy can improve the speed of game development.

[0049] Typically, non-player behavior states are all qualitatively related. Therefore, the distance between two behavior states can be calculated by subtracting the absolute values ​​of all binary variables of the two behavior states and then summing them. For example, based on the above embodiment, the distance between behavior state S1 and behavior state S2 can be calculated using a heuristic function as follows:

[0050] (Hunger)|1-0|+(Happiness)|0-1|+(Fatigue)|1-0|=3

[0051] However, the above calculation formula has certain limitations: the behavior state of non-player characters can only be represented by 0 or 1. In many games, the behavior state variables of non-player characters are often integers, such as a value between 0 and 100, and different ranges will give non-player characters different behaviors. For example, a non-player character can run when the hunger value is between 0 and 30, can only walk when the hunger value is between 30 and 70, is too hungry to walk when the hunger value is between 70 and 99, and starves to death when the hunger value is 100. Therefore, it is difficult to express the subtle differences in the state variables using only binary values, and it is also inconvenient for game designers to carry out game design.

[0052] Optionally, in order to overcome the above limitations, the distance between the quantized current behavior state and the target behavior state is calculated, including: performing regularization processing on the quantized current behavior state and the target behavior state; and calculating the distance between the regularized current behavior state and the target behavior state.

[0053] Specifically, the difference between each state variable in the current behavior state and the corresponding state variable in the target behavior state can be calculated separately; then, the difference of each state variable is divided by the preset threshold of the corresponding state variable to obtain the distance between each state variable in the current behavior state and the corresponding state variable in the target behavior state; further, the distances between each state variable in the current behavior state and the corresponding state variable in the target behavior state are summed to obtain the regularized distance between the current behavior state and the target behavior state.

[0054] It should be noted that this application does not limit the aforementioned preset threshold; for example, it can be the maximum value of the state variable set based on the game scene. Based on this, the distance between the current behavior state and the target behavior state after regularization can be expressed by the following formula:

[0055] H = SUM(Si – Si' / Si_max)

[0056] Where: H is the distance between the current behavior state and the target behavior state; Si is the state variable in the current behavior; Si' is the state variable in the corresponding target behavior state; and Si_max is the maximum value of the corresponding state variable.

[0057] In this embodiment, the quantified current behavior state and the target behavior state can be regularized. This solves the problem of numerical differences between different state variables, facilitating game design by game planners. Furthermore, the distance between the regularized current behavior state and the target behavior state can be calculated, and this distance can be used to obtain the behavior path of non-player characters.

[0058] Step S13: Based on the current behavior, obtain behavior route information from the action library based on distance.

[0059] Step S14: Based on the behavior route information, perform behavior planning for non-player characters so that they can complete the target task planning.

[0060] After obtaining the target task plan and the distance between the current behavior state and the target behavior state, the behavior route information can be obtained from the action library based on the current behavior and the obtained distance.

[0061] Understandably, since the action library includes several behaviors that non-player characters can perform, once the target task plan is obtained, one or more sets of actions that can complete a target task plan can be obtained from the action library based on the current behavior and distance, according to priority or comprehensive sorting, an optimal behavior route can be determined, and a series of behaviors can be executed in sequence.

[0062] Optionally, the action library can be pre-generated by the following steps: obtaining several behaviors that non-player characters can perform; designing action paradigms for the several behaviors to generate the action library.

[0063] The role of action paradigm design is to provide game designers (such as game planners) with a standardized template for action design. A series of designed actions can generate an action library, which can be used to obtain the behavior paths of non-player characters.

[0064] Optionally, the action paradigm design includes the design of preset standards. The above-mentioned processing of the several behaviors to generate the action library may include: processing the several behaviors based on the development order between the several behaviors to generate several behavior trees; and designing the several behavior trees based on preset standards to generate the action library.

[0065] The above development order is also the priority order between actions. For example, the actions that non-player characters can perform include: going to a restaurant, buying groceries, cooking, looking for bread in the refrigerator, and eating. The development order between actions is: (1) buying groceries -> cooking -> eating; (2) going to a restaurant -> eating; (3) looking for bread in the refrigerator -> eating; (4) if there is food, you can go and eat directly.

[0066] Based on this, the aforementioned behavior paths generated from the development sequence of several behaviors constitute several behavior trees. It can be understood that the upper levels of the behavior tree are prerequisites, used to determine whether to enter the behavior tree; the lower levels are the root actions. After determining entry into the behavior tree based on the prerequisites, the specific branch to enter can be determined based on the branch conditions. The results of the branch condition determinations are mutually exclusive, ensuring that only one branch can occur at a time, thus reaching the event located at the leaf node of the action tree, i.e., the corresponding action result.

[0067] Furthermore, after generating several behavior trees, these behavior trees can be designed based on preset standards to generate an action library.

[0068] It should be noted that this application does not limit the aforementioned preset criteria. For example, it can be a criterion composed of premises, actions, and structure, where premises include prerequisites and all branch conditions along the path; actions include the root action and all actions along the path; and results include the results of all actions along the path. In this way, it is possible to obtain behavioral route information from the action library based on the current behavior and the obtained distance.

[0069] Based on the above embodiments, behavior route information is obtained from the action library based on distance, with the current behavior as the benchmark. This includes: searching for the current action set from the action library based on distance, with the current behavior as the benchmark; repeating the current action set a preset number of times to make the non-player character reach the initial behavior state; and obtaining behavior route information based on the current action set if the initial behavior state is consistent with the target behavior state.

[0070] It should be noted that this application does not limit the aforementioned preset number of attempts. Preferably, the preset number of attempts should be large enough to ensure that the non-player character can reach the initial behavioral state, while avoiding wasting resources. When the initial behavioral state reached by the current action set obtained by the non-player character through repeated searches is the target behavioral state, it indicates that the current action set can achieve the target task planning. Therefore, behavioral route information can be obtained based on the current action set.

[0071] Optionally, after repeating the current action set a preset number of times to make the non-player character reach the initial behavior state, the method may further include: obtaining the initial behavior of the non-player character when it reaches the initial behavior state; using the initial behavior as a reference, searching for an initial action set from the action library based on distance; determining whether the initial action set is completely consistent with the current action set; if the initial action set is inconsistent with the current action set, obtaining a new action set from the initial action set, and repeating the new action set a preset number of times to make the non-player character reach the target behavior state.

[0072] Specifically, after obtaining the initial behavioral state, the action library can be further searched to obtain an initial action set. A new action set, inconsistent with the current action set, is then obtained based on this initial action set. When the new action set is repeated a preset number of times, and the non-player character can reach the target behavioral state, it indicates that the new action set can achieve the target task planning. Therefore, behavioral route information can be obtained based on the new action set. In this way, the range of the obtained action set is wider, and the corresponding behavioral route information is more abundant. This means that when planning the behavior of the non-player character based on the behavioral route information to enable the non-player character to complete the target task planning, the non-player character can be controlled to complete the specified target planning through a greater number of action sequences, improving the player's user experience.

[0073] The game behavior planning method proposed in this application can obtain behavior route information from an action library based on a given target task plan, and then control the behavior of non-player characters based on the behavior route information. Since no rules need to be formulated in advance, the development speed of non-player characters is improved. Furthermore, since the behavior range of non-player characters in the action library is relatively wide, it is also possible to control non-player characters to complete the specified target plan through a variety of behavior sequences, thereby improving the player's user experience.

[0074] Please see Figure 2 , Figure 2 This is a schematic block diagram of a game behavior planning device provided in an embodiment of this application. The game behavior planning device can be configured in a server to execute the aforementioned game behavior planning method.

[0075] like Figure 2 As shown, the game behavior planning device 200 includes: an acquisition module 201, a calculation module 202, and a behavior planning module 203.

[0076] The acquisition module 201 is used to acquire the current status information and target task planning of non-player characters in the game, wherein the current status information includes the current behavior and the current behavior status, and the target task planning includes the target behavior status;

[0077] The calculation module 202 is used to quantify the current behavior state and the target behavior state, and calculate the distance between the quantized current behavior state and the target behavior state.

[0078] The acquisition module 201 is further configured to acquire behavior route information from the action library based on the distance, using the current behavior as a reference.

[0079] The behavior planning module 203 is used to plan the behavior of the non-player character based on the behavior route information, so that the non-player character can complete the target task planning.

[0080] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and its modules and units can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0081] The methods and apparatus of this application can be used in a wide variety of general-purpose or special-purpose computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer terminal devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0082] For example, the above-described method and apparatus can be implemented as a computer program, which can be used in, for example... Figure 3 It runs on the computer device shown.

[0083] Please see Figure 3 , Figure 3 This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device 300 may be a server. Figure 3 As shown, the computer device 300 includes a processor 301, a memory 302, and a network interface connected via a system bus. The memory 302 may include volatile storage media, non-volatile storage media, and internal memory.

[0084] The non-volatile storage medium can store the operating system and computer program. The computer program includes program instructions that, when executed, cause the processor 301 to perform any game behavior planning method.

[0085] The processor 301 provides computing and control capabilities to support the operation of the entire computer device 300.

[0086] The internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor 301, the processor 301 can execute any game behavior planning method.

[0087] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that the structure of this computer device 300 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 300 to which the present application applies. A specific computer device 300 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0088] It should be understood that processor 301 can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0089] In some embodiments, the processor 301 is used to run a computer program stored in the memory 302 to perform the following steps: acquiring the current state information and target task planning of a non-player character in the game, wherein the current state information includes the current behavior and the current behavior state, and the target task planning includes the target behavior state; quantifying the current behavior state and the target behavior state, and calculating the distance between the quantized current behavior state and the target behavior state; acquiring behavior route information from the action library based on the distance, using the current behavior as a reference; and performing behavior planning for the non-player character based on the behavior route information, so that the non-player character completes the target task planning.

[0090] In some embodiments, the processor 301 is further configured to acquire several behaviors that the non-player character can perform; and to design action paradigms for the several behaviors to generate the action library.

[0091] In some embodiments, the processor 301 is further configured to process the plurality of behaviors based on the development order among the plurality of behaviors to generate a plurality of behavior trees; and to design the plurality of behavior trees based on the preset criteria to generate the action library.

[0092] In some embodiments, the processor 301 is further configured to perform regularization processing on the quantized current behavior state and the target behavior state; and calculate the distance between the regularized current behavior state and the target behavior state.

[0093] In some embodiments, the processor 301 is further configured to calculate the difference between each state variable in the current behavior state and the corresponding state variable in the target behavior state; divide the difference by a preset threshold of the corresponding state variable to obtain the distance between each state variable in the current behavior state and the corresponding state variable in the target behavior state; and sum the distances between each state variable in the current behavior state and the corresponding state variable in the target behavior state to obtain the distance between the regularized current behavior state and the target behavior state.

[0094] In some implementations, the processor 301 is further configured to search for a current action set from the action library based on the distance, using the current behavior as a reference; repeat the current action set a preset number of times to bring the non-player character to an initial behavior state; and if the initial behavior state is consistent with the target behavior state, obtain the behavior route information based on the current action set.

[0095] In some embodiments, the processor 301 is further configured to acquire the initial behavior of the non-player character when it reaches the initial behavior state; based on the initial behavior, search for an initial action set from the action library based on the distance; determine whether the initial action set is completely consistent with the current action set; if the initial action set is inconsistent with the current action set, acquire a new action set from the initial action set, and repeat the new action set based on the preset number of times, so that the non-player character reaches the target behavior state.

[0096] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed, implement any of the game behavior planning methods provided in this application.

[0097] The computer-readable storage medium may be the internal storage unit of the computer device 300 described in the foregoing embodiments, such as the hard disk or memory of the computer device.

[0098] Please see Figure 4 This is a schematic diagram of a computer-readable storage medium provided in this application. The storage medium 40 of this application stores a computer program capable of implementing all the aforementioned interface view display methods. This computer program can be stored in the storage medium 40 in the form of a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage devices include 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, or devices such as computers, servers, mobile phones, and tablets.

[0099] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A game behavior planning method, characterized in that, The method includes: Obtain the current state information and target task planning of non-player characters in the game, wherein the current state information includes the current behavior and the current behavior state, and the target task planning includes the target behavior state; The current behavior state and the target behavior state are quantified, and the distance between the quantized current behavior state and the target behavior state is calculated. Based on the current behavior, obtain behavior route information from the action library based on the distance; Based on the behavioral route information, behavioral planning is performed on the non-player character to enable the non-player character to complete the target task planning; Prior to obtaining the current state information of non-player characters in the game and planning the target task, the process includes: Obtain several behaviors that the non-player character can perform; Action paradigms are designed for the aforementioned behaviors to generate the action library; The action paradigm design includes the design of preset standards, and the processing of the several behaviors to generate the action library includes: The behaviors are processed based on their development order to generate several behavior trees; The behavior trees are designed based on the preset criteria to generate the action library; The calculated distance between the current behavior state and the target behavior state includes: The quantized current behavior state and the target behavior state are then regularized. Calculate the distance between the current behavior state after the regularization process and the target behavior state; The quantized current behavior state and target behavior state each include several corresponding state variables. The regularization process for the quantized current behavior state information and target behavior state information includes: Calculate the difference between each state variable in the current behavior state and the corresponding state variable in the target behavior state; Divide the difference by the preset threshold of the corresponding state variable to obtain the distance between each state variable in the current behavior state and the state variable in the corresponding target behavior state. The calculation of the distance between the current behavior state after regularization and the target behavior state includes: The distance between the current behavior state and the target behavior state after regularization is obtained by summing the distances between each state variable in the current behavior state and the corresponding state variable in the target behavior state.

2. The method according to claim 1, characterized in that, The step of obtaining behavior route information from the action library based on the distance, using the current behavior as a reference, includes: Based on the current behavior, the current action set is obtained by searching the action library according to the distance; The current set of actions is repeated a preset number of times to bring the non-player character to its initial behavioral state. If the initial behavior state is consistent with the target behavior state, then the behavior route information is obtained based on the current action set.

3. The method according to claim 2, characterized in that, After repeating the current set of actions a preset number of times to bring the non-player character to its initial behavioral state, the method further includes: Obtain the initial behavior of the non-player character when it reaches the initial behavioral state; Based on the initial behavior, an initial set of actions is obtained by searching the action library according to the distance; Determine whether the initial action set is completely identical to the current action set; If the initial action set is inconsistent with the current action set, a new action set is obtained from the initial action set, and the new action set is repeated based on the preset number of times so that the non-player character reaches the target behavior state.

4. A game behavior planning device for implementing the game behavior planning method as described in any one of claims 1-3, characterized in that, The device includes: The acquisition module is used to acquire the current status information and target task planning of non-player characters in the game. The current status information includes the current behavior and the current behavior status, and the target task planning includes the target behavior status. A calculation module is used to quantify the current behavior state and the target behavior state, and to calculate the distance between the quantized current behavior state and the target behavior state. The acquisition module is also used to acquire behavior route information from the action library based on the distance, using the current behavior as a reference. A behavior planning module is used to plan the behavior of the non-player character based on the behavior route information, so that the non-player character can complete the target task planning.

5. A computer device, characterized in that, The computer device includes: Memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the steps of the game behavior planning method as described in any one of claims 1-3 by running the program stored in the memory.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the steps of the game behavior planning method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • NPC behavior decision method

    CN105561578A

  • Game role action method and device, computer equipment and storage medium

    CN114404980A