NPC behavior control method, device and electronic equipment

Through the combination of AI behavior tree and scene query system EQS, the behavior control of NPCs is dynamically determined, which solves the problems of slow and rigid NPC behavior in the existing technology, and achieves more flexible and user-friendly NPC interactions.

CN114288662BActive Publication Date: 2025-02-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210002983.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-04
Publication Date
2025-02-25
Estimated Expiration
2042-01-04

AI Technical Summary

Technical Problem

In the prior art, NPCs are slow and rigid in behavior, unable to adapt to complex and changeable virtual environments, affecting user experience.

Method used

Through the AI ​​behavior tree, based on the current virtual environment where the NPC is located, determine the EQS query node and target blackboard key related to the virtual environment. Call EQS to run and output the target point with the blackboard value corresponding to the blackboard key as the reference point, and then select the target to Click the AI ​​behavior tree to control NPC behavior.

Benefits of technology

It realizes flexible control of NPC behavior, adapts to real-time changing virtual environments, and improves the satisfaction of players' interactions with NPCs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114288662B_ABST
    Figure CN114288662B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a behavior control method, device and electronic device for NPC, which relates to the field of computer technology. The method includes: determining the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node through the AI ​​behavior tree according to the virtual environment in which the NPC is currently located; calling the EQS query node to run EQS, passing the target blackboard key into the EQS, and obtaining the target point in the virtual environment output by the EQS; inputting the target point into the AI ​​behavior tree, obtaining the behavior to be executed by the NPC output by the AI ​​behavior tree, and controlling the NPC to execute the behavior; wherein the target point is determined according to the reference point of the scene query system, and the reference point is determined according to the blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree. The embodiment of the present application can control the NPC actions more flexibly and improve the satisfaction of the player's interaction with the NPC.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a method, device and electronic device for controlling the behavior of an NPC. Background Art

[0002] In applications with virtual environments, it is common to see NPCs (Non-player Characters) competing with users. In related technologies, NPCs need to adjust their behaviors in real time according to environmental information in the virtual environment, thereby providing players with a better gaming experience.

[0003] Unreal Engine 4 is a commonly used game engine. The related technology often uses the Environment Query System (EQS) in UE4 to output the target point, and the AI ​​behavior tree determines the behavior of the NPC based on the target point.

[0004] In the prior art, the reference point used by EQS to output the target point is fixed and cannot adapt to the complex and changing virtual environment, which causes the behavior of NPC in the prior art to be sluggish and stereotyped, affecting the user experience. Summary of the invention

[0005] The embodiments of the present application provide a method, device and electronic device for controlling the behavior of an NPC, which can solve the above technical problems. The technical solution is as follows:

[0006] According to one aspect of an embodiment of the present application, a method for controlling behavior of an NPC is provided, the method comprising:

[0007] Through the AI ​​behavior tree, according to the virtual environment in which the NPC is currently located, determine the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node;

[0008] Call the EQS query node to run EQS, pass the target blackboard key into EQS, and obtain the target point in the virtual environment output by EQS;

[0009] Input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior;

[0010] Among them, the target point is determined according to the reference point of the scene query system, and the reference point is determined according to the blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree.

[0011] In one possible implementation, the EQS includes a target scene query context for the query configuration item to be configured;

[0012] Pass the target Blackboard Key into EQS, including:

[0013] The target blackboard key is passed into the query configuration item of the target scene query context, so that the target scene query context obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

[0014] In a possible implementation, the EQS query node is called to run the EQS, which also includes:

[0015] Creating at least one type of target scene query context for the query configuration item to be configured;

[0016] Configure the target scene query context in EQS;

[0017] Configure an EQS query node in the AI ​​behavior tree to read EQS;

[0018] The types of target scene query scenarios include a first type of scene query scenario for outputting a reference point of a role variable and a second type of scene query scenario for outputting a reference point of a position variable.

[0019] In a possible implementation, configuring a target scene query context in EQS includes:

[0020] A type of target scene query scenario is configured for the test rule in EQS, and the configured target scene query scenario is named as the first target scene query scenario.

[0021] In one possible implementation, the target blackboard key required by the EQS includes a first blackboard key required by the first target scene query context;

[0022] Get the target point in the virtual environment output by EQS, including:

[0023] Generate multiple sampling points through the sampling point generator in EQS;

[0024] Obtaining a first blackboard value corresponding to a first blackboard key in the blackboard data through a first target scene query scenario, and obtaining a first reference point input test rule according to the first blackboard value;

[0025] By using the test rule, the plurality of sampling points are respectively compared with the first reference point, and the target point is determined from the plurality of sampling points according to the comparison result.

[0026] In a possible implementation, configuring the target scene query context in EQS further includes:

[0027] A type of target scene query context is configured for the sampling point generator, and the configured target scene query context is named as a second target scene query context.

[0028] In one possible implementation, the target blackboard key required by the EQS includes a second blackboard key required by the second target scene query context;

[0029] Generate multiple sampling points through the pre-configured sampling point generators in EQS, including:

[0030] Obtain a second blackboard value corresponding to a second blackboard key in the blackboard data through a second target scene query context, and obtain a second reference point according to the second blackboard value and pass it into a sampling point generator;

[0031] A plurality of sampling points are generated by a sampling point generator with the second reference point as the center.

[0032] In a possible implementation, the target scene query context obtains a reference point according to a blackboard value currently corresponding to the target blackboard key in the blackboard data, including:

[0033] If it is determined that the blackboard value meets the preset conditions, the blackboard value is used as the reference point;

[0034] If it is determined that the blackboard value does not meet the preset condition, the preset value is used as a reference point.

[0035] According to another aspect of an embodiment of the present application, a behavior control device for an NPC is provided, the device comprising:

[0036] The node dynamic determination module is used to determine the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node according to the virtual environment currently located by the NPC through the AI ​​behavior tree;

[0037] The target point output module is used to call the EQS query node to run EQS, pass the target blackboard key into EQS, and obtain the target point in the virtual environment output by EQS;

[0038] The behavior execution module is used to input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior;

[0039] Among them, the target point is determined according to the reference point of the scene query system, and the reference point is determined according to the blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree.

[0040] In one possible implementation, the EQS includes a target scene query context for the query configuration item to be configured;

[0041] Target point output module, including:

[0042] The reference point output unit is used to pass the target blackboard key into the query configuration item of the target scene query scenario, so that the target scene query scenario obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

[0043] In a possible implementation, the behavior control device further includes:

[0044] A scenario creation module, used to create at least one type of target scenario query scenario for the query configuration item to be configured;

[0045] EQS configuration module, used to configure the target scene query context in EQS;

[0046] Node configuration module, used to configure the EQS query node for reading EQS in the AI ​​behavior tree;

[0047] The types of target scene query scenarios include a first type of scene query scenario for outputting a reference point of a role variable and a second type of scene query scenario for outputting a reference point of a position variable.

[0048] In one possible implementation, the EQS configuration module includes:

[0049] The first scenario configuration module is used to configure a type of target scenario query scenario for the test rule in the EQS, and name the configured target scenario query scenario as the first target scenario query scenario.

[0050] In one possible implementation, the target blackboard key required by the EQS includes a first blackboard key required by the first target scene query context;

[0051] The target point output module includes:

[0052] A sampling point generating unit, used for generating a plurality of sampling points through a sampling point generator in EQS;

[0053] A first blackboard value transfer unit is used to obtain a first blackboard value corresponding to a first blackboard key in the blackboard data through a first target scene query context, and obtain a first reference point input test rule according to the first blackboard value;

[0054] The rule comparison unit is used to compare the multiple sampling points with the first reference point respectively by testing the rule, and determine the target point from the multiple sampling points according to the comparison result.

[0055] In one possible implementation, the EQS configuration module includes:

[0056] The second scenario configuration module is used to configure a type of target scenario query scenario for the sampling point generator, and name the configured target scenario query scenario as a second target scenario query scenario.

[0057] In one possible implementation, the target blackboard key required by the EQS includes a second blackboard key required by the second target scene query context;

[0058] The sampling point generation unit includes:

[0059] A second blackboard value transmission unit is used to query the context through the second target scene, obtain a second blackboard value corresponding to the second blackboard key in the blackboard data, and obtain a second reference point according to the second blackboard value and pass it into the sampling point generator;

[0060] The center generating unit is used to generate a plurality of sampling points with the second reference point as the center through the sampling point generator.

[0061] In a possible implementation, the reference point output unit is specifically used to:

[0062] If it is determined that the blackboard value meets the preset conditions, the blackboard value is used as the reference point;

[0063] If it is determined that the blackboard value does not meet the preset condition, the preset value is used as a reference point.

[0064] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the first aspect.

[0065] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method of the first aspect are implemented.

[0066] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method of the first aspect are implemented.

[0067] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0068] Through the AI ​​behavior tree, according to the virtual environment in which the NPC is currently located, the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node are determined. Since the virtual environment in which the NPC is located changes in real time, the EQS query node and the target blackboard key determined at different times are also different. The EQS query node is further called to run the corresponding EQS, and the target blackboard key is passed into the EQS, so that the EQS can use the blackboard value corresponding to the blackboard key as a reference point, output the target point, and input the target point into the AI ​​behavior tree to obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior. Since the behavior is related to the virtual environment in which the NPC is located, the present application can control the NPC action more flexibly and improve the satisfaction of the player's interaction with the NPC. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in describing the embodiments of the present application.

[0070] Figure 1 A schematic diagram of sampling point information of an EQS provided in an embodiment of the present application;

[0071] Figure 2 A structural block diagram of an electronic device implemented in an embodiment of the present application;

[0072] Figure 3 A structural block diagram of a computer system provided in an embodiment of the present application;

[0073] Figure 4 A flowchart of a method for controlling NPC behavior provided in an embodiment of the present application;

[0074] Figure 5 A schematic diagram of a behavior tree provided in an embodiment of the present application;

[0075] Figure 6 A flowchart of another NPC behavior control method provided in an embodiment of the present application;

[0076] Figure 7 A flowchart of another behavior control method provided in an embodiment of the present application;

[0077] Figure 8 A schematic diagram of an interface for configuring a target scene query scenario of a sampling point generator according to an embodiment of the present application;

[0078] Fig. 9 A schematic diagram of a node configuration interface of an AI behavior tree provided in an embodiment of the present application;

[0079] Fig.10A schematic diagram of a query configuration item configuration interface provided in an embodiment of the present application;

[0080] Fig.11 A flowchart of another behavior control method provided in an embodiment of the present application;

[0081] Fig.12 A schematic diagram of the structure of an NPC behavior control device provided in an embodiment of the present application;

[0082] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.

[0084] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B".

[0085] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0086] First, several terms involved in this application are introduced and explained:

[0087] 1) Environment Query System (EQS) is used to help AI behavior trees filter scene location information. The filtering process scores (higher scores are better) or removes the sampling points according to given conditions, and finally provides a result that best fits the query for use by AI behavior trees. Common uses are to find hiding points or the best attack position, etc.

[0088] 2) Sampling point generators (Generators), which are used for sampling generation rules. Sampling points are selected around the center point according to a certain rule. The selected sampling points are used for testing. The center point can be the location of the NPC or other locations.

[0089] 3) Test rules (Test) Use the sampling point for rule detection. Sampling points are scored or kicked out according to the rules used between the sampling point and the reference content (generally the reference content has the inquirer, or the sampling point itself can also write the reference content).

[0090] 4) Scene query context (context), scene query context plays a very important role in the test items. In the test node, different reference points need to be selected for test participation according to different test methods. Taking the distance test as an example, the distance between the sampling point and the scene query context needs to be calculated (the interrogator and sampling point Item are provided by default). Simply put, each sampling point is tested and compared with the scene query context respectively, and then the result is marked on the sampling point in the form of a score. In the related technology, the scene query context can provide a single actor or position as a reference point, or a group of actors or positions as reference points, but the relevant rules are hard-coded in the code and cannot be changed according to the situation at runtime.

[0091] See also Figure 1 , which exemplarily shows a schematic diagram of the sampling point information of EQS. As shown in the figure, the virtual environment includes multiple sampling points generated by the sampling point generator, which are represented by white circles in the figure. The scene query scenario provides a reference point to the test rule, which is represented by a black circle in the figure. The test rule compares the reference point with each sampling point to obtain a score for each sampling point. The score is displayed below each sampling point. It can be seen that the closer the sampling point is to the reference point in the test rule, the higher the score.

[0092] 5) AI behavior tree uses nodes to describe behavior logic, mainly including: selection node, sequence node, parallel node, modification node, random node, condition node, behavior node. A behavior tree represents an AI logic.

[0093] 6) Virtual environment: It is a virtual environment displayed (or provided) when the application is running on the device. The virtual environment can be a simulation of the real world, a semi-simulation and semi-fictitious environment, or a purely fictitious environment. The virtual environment can be any one of a two-dimensional virtual environment, a 2.5-dimensional virtual environment, and a three-dimensional virtual environment. The following embodiments are illustrated by taking the virtual environment as a three-dimensional virtual environment, but this is not limited to this. Optionally, the virtual environment is also used for virtual environment battles between at least two virtual characters.

[0094] For example, the virtual environment is used for at least two virtual characters to fight with virtual firearms; for another example, the virtual environment is used for at least two virtual characters to fight with virtual firearms in a designated geographical area, and the designated geographical area shrinks as the virtual time increases. Optionally, the virtual firearm is also equipped with a sight. The sight includes at least one of an airborne sight, a 2x sight, a 4x sight, a 6x sight, an 8x sight, a 15x sight, a holographic sight, and a red dot sight.

[0095] 7) Virtual object: refers to an object that can be moved in a virtual environment. The movable object can be a virtual person, a virtual animal, an animated character, etc., such as a person, an animal, a plant, an oil drum, a wall, a stone, etc. displayed in a three-dimensional virtual environment. Optionally, the virtual object is a three-dimensional model created based on animation skeleton technology. Each virtual object has its own shape and volume in the three-dimensional virtual environment and occupies a part of the space in the three-dimensional virtual environment. Optionally, the virtual object holds a virtual firearm, which is also equipped with a scope.

[0096] Figure 2 The electronic device 100 includes an operating system 110 and an application 120 .

[0097] The operating system 110 is the basic software that provides application programs 120 with secure access to the computer hardware.

[0098] The application 120 is an application that supports a virtual environment. Optionally, the application 120 is an application that supports a three-dimensional virtual environment. The application 120 may be any one of a virtual reality application, a three-dimensional map program, a third-person shooting game (TPS), a first-person shooting game (FPS), a MOBA game, and a multiplayer gunfight survival game. The application 120 may be a stand-alone application, such as a stand-alone 3D game program.

[0099] Figure 3 The computer system 200 includes a first device 220 , a server 240 , and a second device 260 .

[0100] The first device 220 is installed and runs an application that supports a virtual environment. The application can be any one of a virtual reality application, a three-dimensional map program, a TPS game, an FPS game, a MOBA game, and a multiplayer shooter survival game. The first device 220 is a device used by a first user, and the first user uses the first device 220 to control a first virtual object in a virtual environment to perform an activity, and the activity includes but is not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Schematically, the first virtual object is a first virtual character, such as a simulated character or an anime character.

[0101] The first device 220 is connected to the server 240 via a wireless network or a wired network.

[0102] The server 240 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 240 is used to provide background services for applications that support a three-dimensional virtual environment. Optionally, the server 240 undertakes the main computing work, and the first device 220 and the second device 260 undertake the secondary computing work; or, the server 240 undertakes the secondary computing work, and the first device 220 and the second device 260 undertake the main computing work; or, the server 240, the first device 220, and the second device 260 adopt a distributed computing architecture to perform collaborative computing.

[0103] The second device 260 is installed and runs an application that supports a virtual environment. The application can be any one of a virtual reality application, a three-dimensional map program, an FPS game, a MOBA game, and a multiplayer shooter survival game. The second device 260 is a device used by a second user, and the second user uses the second device 260 to control a second virtual object in the virtual environment to perform an activity, which includes but is not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Schematically, the second virtual object is a second virtual character, such as a simulated character or an anime character.

[0104] Optionally, the first virtual character and the second virtual character are in the same virtual environment. Optionally, the first virtual character and the second virtual character may belong to the same team, the same organization, have a friend relationship, or have temporary communication permissions. Optionally, the first virtual character and the second virtual character may also belong to different teams, different organizations, or two hostile groups.

[0105] Optionally, the applications installed on the first device 220 and the second device 260 are the same, or the applications installed on the two devices are the same type of applications on different control system platforms. The first device 220 may generally refer to one of a plurality of devices, and the second device 260 may generally refer to one of a plurality of devices. This embodiment is only illustrated by the first device 220 and the second device 260. The device types of the first device 220 and the second device 260 are the same or different, and the device types include: at least one of a game console, a desktop computer, a smart phone, a tablet computer, an e-book reader, an MP3 player, an MP4 player, and a laptop computer. The following embodiments are illustrated by the device being a desktop computer.

[0106] Those skilled in the art will appreciate that the number of the above devices may be more or less. For example, the above device may be only one, or the above devices may be dozens or hundreds, or more. The embodiment of the present application does not limit the number and type of devices.

[0107] Figure 4 A flow chart of a method for controlling the behavior of an NPC provided by an exemplary embodiment of the present application is shown. The method can be applied to Figure 2 The electronic device shown, or Figure 3 the first device shown, or Figure 4 In the second device, the method includes:

[0108] S101. Determine, through the AI ​​behavior tree, an EQS query node of a scene query system related to the virtual environment and a target blackboard key required by the EQS corresponding to the EQS query node according to the virtual environment currently located by the NPC.

[0109] The AI ​​behavior tree is a tree structure that includes logic nodes and behavior nodes. Every time a behavior needs to be found, it will start from the root node of the tree, traverse each node, and find the behavior that matches the current data. In the embodiment of the present application, the corresponding nodes can be determined in advance according to the various virtual environments that the NPC may be in, so as to form an AI behavior tree. In this way, when the NPC is in a certain virtual environment, the corresponding EQS query node can be found from the AI ​​behavior tree.

[0110] like Figure 5 As shown, it exemplarily shows a schematic diagram of a behavior tree 40. The behavior tree 40 may include different types of nodes such as combinations, conditions, actions, etc., and the most appropriate action is selected for execution through conditional judgment and the priority between actions. Different nodes on the AI ​​behavior tree can perform different tasks.

[0111] The EQS query node (Run EQS Query) belongs to the task node in the behavior tree. The task node defines the task performed by the AI ​​behavior tree, such as moving to a certain point or performing an attack, etc. It does not participate in decision-making behavior; the task can fail or succeed, and only when the execution result is returned will it end and execute the next decision.

[0112] The embodiments of the present application do not make specific limitations on the virtual environment in which the NPC is located, such as an environment in which the NPC is attacked by the enemy, an environment in which teammates need assistance, an environment in which the enemy needs to be attacked, etc. Different environments can be determined based on specific information in the environment. For example, when the NPC's teammates are nearby and their health is low, the NPC is in a virtual environment in which teammates need assistance.

[0113] The EQS query node is used to run the pre-configured EQS. In the embodiment of the present application, the blackboard key required for the EQS corresponding to the EQS query node can be determined through the AI ​​behavior tree. The blackboard is the database of the behavior tree. All data in the game can be stored in the blackboard. The behavior tree obtains data from the blackboard and determines the behavior to be executed by the NPC based on the preset rules.

[0114] The data in the blackboard, that is, the blackboard data, is recorded in the form of key-value pairs. Different blackboard keys (BlackBoardkey) are used to store different data. Taking shooting games as an example, common blackboard keys include Teammate, TargetEnemy, etc. The blackboard value corresponding to the Teammate blackboard key is used to record the position of teammates, and the blackboard value corresponding to TargetEnemy is used to record the position of enemies.

[0115] Different from the prior art in which EQS corresponds to a fixed blackboard key, the embodiment of the present application determines the EQS query node and the target blackboard key corresponding to the current environment of the NPC through the AI ​​behavior tree. When the environment in which the NPC is located is different, the EQS query node and the target blackboard key determined by the AI ​​behavior tree will change accordingly. For example, in a virtual environment where a cover needs to be avoided, the AI ​​behavior tree determines that the corresponding target blackboard key is the enemy, then EQS will be centered on the enemy. After a period of time, when the enemy is eliminated, there are injured teammates in the virtual environment, and the AI ​​behavior tree can determine that the corresponding target blackboard key is a teammate, thereby realizing dynamic calling of the blackboard key.

[0116] S102, calling the EQS query node to run the EQS, passing the target blackboard key into the EQS, and obtaining the target point in the virtual environment output by the EQS.

[0117] It should be understood that different EQS can collect different environmental data for testing and analysis. The embodiment of the present application pre-establishes the correspondence between each EQS query node and EQS. Each EQS query node corresponds to its own EQS. It should be noted that different EQS query nodes can correspond to the same EQS or different EQSs. The specific correspondence can be freely configured by the developer according to the actual scenario. Then, after the AI ​​behavior tree determines the EQS query node corresponding to the virtual environment, the corresponding EQS can be further determined.

[0118] The target point of the embodiment of the present application is determined by EQS using the blackboard data of the AI ​​behavior tree, and the blackboard value currently corresponding to the target blackboard key is used as the reference point. Since the blackboard key input to EQS in the present application is dynamically updated with the environment in which the NPC is located, the reference point generated by EQS in the embodiment of the present application is also dynamically changing, and the corresponding target point also changes dynamically accordingly. The embodiment of the present application can effectively improve the efficiency of determining the target point based on the dynamic reference point.

[0119] It should be understood that the reference point and the target point in the embodiment of the present application are both located in the virtual environment. The reference point in the embodiment of the present application is of the same type as the reference point in the related art, including actor and location. The actor, i.e., the virtual object, can be a teammate, an enemy, or materials in a virtual scene, etc. The location, i.e., the location in the virtual environment, theoretically supports any location in the virtual environment as a reference point.

[0120] It should be understood that EQS may need multiple reference points when outputting a target point, and the present application embodiment still supports that some of the reference points still use pre-fixed reference points. For example, in some cases, EQS needs two reference points, one of which is obtained by the AI ​​behavior tree determining the target blackboard key according to the virtual environment where the NPC is currently located, and then obtaining the corresponding blackboard value from the blackboard data, while the other reference point is the blackboard value corresponding to the pre-set fixed blackboard key.

[0121] S103. Input the target point into the AI ​​behavior tree, obtain the behavior to be executed by the NPC output by the AI ​​behavior tree, and control the NPC to execute the behavior.

[0122] For example, if the AI ​​behavior tree outputs a behavior of moving toward cover, the NPC will consider the target point as the best place to hide in cover and move toward that location.

[0123] The NPC behavior control method of the embodiment of the present application determines the EQS query node corresponding to the virtual environment currently located by the NPC and the target blackboard key required by the EQS corresponding to the EQS query node according to the AI ​​behavior tree. Since the virtual environment where the NPC is located changes in real time, the EQS query nodes and target blackboard keys determined at different times are also different. The EQS query node is further called to run the corresponding EQS, and the target blackboard key is passed into the EQS, so that the EQS can use the blackboard value corresponding to the blackboard key as a reference point, output the target point, input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior. Since the behavior is related to the virtual environment where the NPC is located, the present application can control the NPC actions more flexibly and improve the satisfaction of the player's interaction with the NPC.

[0124] See also Figure 6 , which exemplarily shows a flow chart of another NPC behavior control method provided by an embodiment of the present application. As shown in the figure, the process includes an AI behavior tree determining a scene query system EQS query node related to the virtual environment and a target blackboard key required by the EQS corresponding to the EQS query node according to the virtual environment in which the NPC is currently located; calling the EQS query node to run EQS, using the target blackboard key to configure the scene query scenario in the EQS, and further according to the sampling point generator and test rules in the EQS, the EQS outputs the target point in the virtual environment; inputting the target point into the AI ​​behavior tree, obtaining the NPC behavior to be executed output by the AI ​​behavior tree, and controlling the NPC to execute the behavior; the NPC's behavior further causes the virtual environment to change, so that the behavior tree determines the next behavior of the NPC according to the changed virtual environment, and repeats the cycle.

[0125] Based on the above embodiments, as an optional embodiment, the EQS includes a target scene query context of the query configuration item to be configured.

[0126] It should be understood that the scene query scenario configured in the EQS of the related art is a hard-coded code segment that cannot be configured with variable parameters, while the target scene query scenario in the EQS of the present application is pre-configured with a query configuration item QueryParams, which can be configured as a target blackboard key by the EQS query node.

[0127] Pass the target Blackboard Key into EQS, including:

[0128] The target blackboard key is passed into the query configuration item of the target scene query context, so that the target scene query context obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

[0129] Since the virtual environment in which the NPC is located changes in real time during the game, the blackboard keys configured by the EQS query node will also be dynamically controlled by the AI ​​behavior tree, thereby achieving the effect of dynamically setting the reference point.

[0130] See also Figure 7 , which exemplarily shows a flow chart of another behavior control method provided in an embodiment of the present application, as shown in the figure, including

[0131] Creating a target scene query context for query configuration items to be configured; since the scene query context of the embodiment of the present application has query configuration items, it is possible to dynamically pass in configuration items, thereby obtaining an effect of a dynamic reference point;

[0132] Configure the target scene query context in EQS in the UE4 engine; the sampling point generator and test rules in EQS require scene query context, so configure the above target scene query context in the sampling point generator and test rules respectively, and name them accordingly;

[0133] When the game is running, the blackboard key output by the AI ​​behavior tree, the target scene query scenario in EQS configures the blackboard key in the query configuration item, obtains the blackboard value corresponding to the blackboard key from the blackboard data, and determines whether the blackboard value is legal;

[0134] If it is legal, the blackboard value is passed as a reference point to the corresponding sampling point generator or test rule in EQS. If it is illegal, the preset value is passed as a reference point to the corresponding sampling point generator or test rule in EQS.

[0135] The sampling point generator and test rules in EQS finally output the target point based on the reference point, and EQS passes the target point to the AI ​​behavior tree;

[0136] The AI ​​behavior tree obtains the action to be performed based on the target point and controls the NPC to perform the action.

[0137] Based on the above embodiments, as an optional embodiment, calling the EQS query node to run EQS also includes:

[0138] S201: Create at least one type of target scene query context for query configuration items to be configured.

[0139] Existing scene query scenarios can provide a single Actor or location as a scenario, or a group of Actors or locations. Similarly, the types of target scene query scenarios in the embodiments of the present application include a first type of scene query scenario that outputs a reference point of a character variable and a second type of scene query scenario that outputs a reference point of a position variable. It should be understood that if the scene query scenario outputs a reference point of a character variable, then the blackboard value corresponding to the target blackboard key is also a character variable, and if the scene query scenario outputs a reference point of a position variable, then the blackboard value corresponding to the target blackboard key is also a position variable.

[0140] S202: Configure the target scene query context in EQS.

[0141] See also Figure 8 , which exemplarily shows a schematic diagram of the interface for configuring the target scene query scenario of the sampling point generator in the embodiment of the present application. As shown in the figure, many parameters need to be filled in the configuration interface of the sampling point generator, such as Aligened Points Distance, Cone Degrees, AngleStep, Range (range), and Center Actor (center point object). The figure shows multiple scene query scenarios that can be used as center point objects, among which context_ActorParams and context_LocationParams are target scene query scenarios including query configuration items to be configured, and the two target scene query scenarios are used to output the reference point of the role variable and the reference point of the position variable, respectively. Except for the above two scene query scenarios, other scene query scenarios are configured with fixed blackboard keys, for example, the blackboard key configured by the scene query scenario_Enemy is the enemy, and the blackboard key configured by the scene query scenario_WhoAttackMe is the virtual object that attacks the NPC.

[0142] S203. Configure an EQS query node for reading EQS in the AI ​​behavior tree;

[0143] See also Fig. 9 , which exemplarily shows a schematic diagram of the node configuration interface of the AI ​​behavior tree. As shown in the figure, the user clicks the Run EQS Query control on the node configuration interface of the AI ​​behavior tree, and the interface will further display an option of whether to use the query template Query Template. Checking this option indicates that the Query Template needs to be used, so that the interface further displays the EQS that needs to be configured. The name of the EQS configured in the figure is EQS_CheckAreaSafe. As the name suggests, this EQS is an EQS used to check whether the environment in which the NPC is located is safe.

[0144] See also Fig.10, which exemplarily shows a schematic diagram of the query configuration item configuration interface of an embodiment of the present application. As shown in the figure, when the target scene query context is configured in the AI ​​behavior tree through the above steps, the content that needs to be configured will be further displayed in the query configuration item configuration interface. The name of the target scene query context in the figure is context_ActorParams. The target scene query context is a scene query context that uses the character information in the blackboard data as a reference point. The configuration item below the name is the type configuration item Param Type. What is configured in the figure is BBkey, that is, the blackboard key. The configuration item below the type configuration item is the blackboard key configuration item BBKey, which is used to configure a specific blackboard key. The figure shows none, indicating that it has not been configured yet. By clicking the triangle symbol in the configuration item, the assignable BBKey can be popped up.

[0145] The embodiment of the present application needs to configure EQS before applying the AI ​​behavior tree. Since the blackboard key in the query configuration item is configurable, the embodiment of the present application can encapsulate an EQS, so that when configuring EQS for different EQS query nodes on the AI ​​behavior tree, especially when the generators and Tests of some EQS are the same, it is only necessary to simply configure different blackboard keys to quickly obtain different EQSs, which not only saves EQS resources, but also enables similar EQSs to achieve different effects through configuration, thereby improving production efficiency.

[0146] Based on the above embodiments, as an optional embodiment, the embodiment of the present application configures a target scene query context in EQS, including:

[0147] A type of target scene query scenario is configured for the test rule in EQS, and the configured target scene query scenario is named as the first target scene query scenario.

[0148] It should be understood that in an embodiment of the present application, multiple test rules can be set in one EQS for detecting sampling points, and different reference points are often required for different test rules. Therefore, different scene query scenarios are distinguished. The embodiment of the present application distinguishes them by naming. For example, a certain EQS includes 2 distance-related test rules (DistanceTest), where the purpose of the first DistanceTest is to be farthest from a certain point, and the purpose of the second DistanceTest is to be closest to a certain point. The final effect of this EQS is to take the center of these two points, and these two DistanceTests can be configured with scene query scenarios. Accordingly, two test rules filled with scene query scenarios will appear on the EQS query node, but the order in which the two scene query scenarios appear may be confused. The scene query scenario in the first position does not necessarily correspond to the first test rule. By naming the scene query scenarios configured with different test rules, it can be ensured that the scene query scenarios can correspond to the test rules desired by the developer.

[0149] Based on the above embodiments, as an optional embodiment, the target blackboard key required by EQS includes the first blackboard key required by the first target scene query scenario. That is, when determining the target blackboard key, the AI ​​behavior tree will declare the blackboard keys required by different scene query scenarios to avoid blackboard key import errors.

[0150] Accordingly, the target points in the virtual environment output by EQS are obtained, including:

[0151] S301, generating multiple sampling points through a sampling point generator pre-configured in EQS;

[0152] The sampling point generator needs to set the generation center of the sampling point when generating the sampling point. Generally, if the sampling point generator is not configured with the scene query context, the sampling point is generated by default with the NPC as the center or the enemy as the center, and once it is set, it cannot be modified during the game operation. It should be understood that the sampling point generator will also generate sampling points in combination with parameters such as the generation density and generation range of the sampling point. The generation density is used to indicate the distance between two adjacent sampling points. The greater the generation density, the more sampling points are generated per unit area.

[0153] S302. Obtain a first blackboard value corresponding to a first blackboard key in blackboard data through a first target scene query scenario, and obtain a first reference point input test rule according to the first blackboard value.

[0154] Since the first target scene query scenario is configured in the test rules, and the target blackboard key includes the first blackboard key required for the first target scene query scenario, by configuring the first blackboard key in the query configuration item of the first target scene query scenario, the first target scene query scenario can obtain the first blackboard value corresponding to the first blackboard key in the blackboard data, and obtain the first reference point based on the first blackboard value, for example, directly using the first blackboard value as the first reference point.

[0155] S303: Compare the multiple sampling points with the first reference point respectively according to the test rule, and determine the target point from the multiple sampling points according to the comparison result.

[0156] For example, if the test content is to find the sampling point farthest from the reference point, the distance between each sampling point and the reference point is calculated respectively, and the sampling point farthest from the reference point is used as the target point.

[0157] Based on the above embodiments, as an optional embodiment, configuring the target scene query context in EQS further includes:

[0158] A type of target scene query context is configured for the sampling point generator, and the configured target scene query context is named as a second target scene query context.

[0159] It can be seen from the above embodiments that when generating sampling points, the sampling point generator can also generate sampling points with the reference point of the target scene query context as the center, so as to achieve the effect of dynamically generating sampling points. Figure 8 The method shown configures the target scene query context for the sampling point generator, and names the configured target scene query context as the second target scene query context.

[0160] It should be understood that when there are multiple sampling point generators, the naming of the target scene query contexts configured by different sampling point generators is different.

[0161] Based on the above embodiments, as an optional embodiment, the target blackboard key required by the EQS includes a second blackboard key required by the second target scene query scenario.

[0162] Generate multiple sampling points through the pre-configured sampling point generators in EQS, including:

[0163] S401. Obtain a second blackboard value corresponding to a second blackboard key in the blackboard data through a second target scene query context, and obtain a second reference point according to the second blackboard value and pass it into a sampling point generator.

[0164] Since the second target scene query scenario is configured in the sampling point generator, and the target blackboard key includes the second blackboard key required for the second target scene query scenario, by configuring the second blackboard key in the query configuration item of the second target scene query scenario, the second target scene query scenario can obtain the second blackboard value corresponding to the second blackboard key in the blackboard data, and obtain the second reference point based on the second blackboard value, for example, directly using the second blackboard value as the second reference point.

[0165] S402: Generate multiple sampling points with the second reference point as the center by a sampling point generator.

[0166] It should be understood that when there are multiple sampling point generators, for each sampling point generator, a corresponding second target scene query context will be configured to obtain multiple corresponding groups of sampling points. No matter how many sampling point generators there are, EQS will eventually obtain a target point from the sampling points generated by these sampling point generators.

[0167] Based on the above embodiments, as an optional embodiment, the target scene query context obtains a reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data, including:

[0168] If it is determined that the blackboard value meets the preset conditions, the blackboard value is used as the reference point;

[0169] If it is determined that the blackboard value does not meet the preset condition, the preset value is used as a reference point.

[0170] The embodiment of the present application can set conditions for the blackboard value. If the blackboard value meets the conditions, the blackboard value is used as a reference point. If the blackboard value does not meet the conditions, the preset value is used as a reference point. It should be understood that since the target blackboard key corresponding to the blackboard value of the embodiment of the present application includes the first target blackboard key named in the first target scene query context configured in the test rule, and also includes the second target blackboard key named in the second target scene query context configured in the sampling point generator, no matter the blackboard value corresponding to the first target blackboard key or the second target blackboard key, as long as it does not meet the conditions, the corresponding preset value will be used as a reference point.

[0171] See also Fig.11 , which exemplarily shows a flow chart of another behavior control method provided in an embodiment of the present application, as shown in the figure, including:

[0172] S501, creating a first type of scene query context for outputting a reference point of a role variable and a second type of scene query context for outputting a reference point of a position variable, wherein both types of scene query contexts include query configuration items to be configured;

[0173] S502. Configure the target scene query context in EQS:

[0174] Configure a type of target scene query context for at least one test rule in the EQS, and name the configured target scene query context as a first target scene query context;

[0175] Configure a type of target scene query context for at least one sampling point generator in the EQS, and name the configured target scene query context as a second target scene query context;

[0176] S503, configuring an EQS query node in the AI ​​behavior tree for reading the EQS configured in step S502;

[0177] S504, determining an EQS query node corresponding to the virtual environment currently located by the NPC and a target blackboard key required by the EQS according to the AI ​​behavior tree; the target blackboard key includes a first blackboard key required for a first target scene query scenario and a second blackboard key required for a second target scene query scenario;

[0178] S505, calling the EQS query node to run EQS;

[0179] By querying the context of the second target scene, a second blackboard value corresponding to the second blackboard key is obtained in the blackboard data. If the second blackboard value meets the preset conditions, the second blackboard value is passed into the sampling point generator as the second reference point. If the second blackboard value does not meet the preset conditions, the first preset value is passed into the sampling point generator as the second reference point.

[0180] Generate multiple sampling points with the second reference point as the center by a sampling point generator;

[0181] Obtain a first blackboard value corresponding to a first blackboard key in the blackboard data through a first target scene query scenario, if the first blackboard value meets a preset condition, pass the first blackboard value as a first reference point into the test rule, if the first blackboard value does not meet the preset condition, pass the first blackboard value as a first reference point into the test rule;

[0182] By using the test rule, the plurality of sampling points are respectively compared with the first reference point, and the target point is determined from the plurality of sampling points according to the comparison result;

[0183] S506, EQS inputs the target point into the AI ​​behavior tree, obtains the behavior to be executed by the NPC output by the AI ​​behavior tree, and controls the NPC to execute the behavior.

[0184] The following takes the example of an NPC hiding in a bunker in a shooting game to illustrate the behavior control method of the present application.

[0185] NPCs need to know two pieces of information to hide in cover:

[0186] 1. Where is the enemy? Only by knowing where the enemy is can you know where to stay in the bunker to avoid the enemy's shooting;

[0187] 2. Where is the nearest cover? If the cover is far away, the NPC may be eliminated from the game before it moves to the cover.

[0188] Based on the above two pieces of information, the NPC will eventually move towards the best cover that is both close to itself and able to avoid enemy shooting.

[0189] From this, we can see that in order to hide in cover, two scene query contexts are needed. The reference point output by one scene query context (context1) is the enemy, and the reference point output by the other scene query context (context2) is the NPC itself.

[0190] Through the AI ​​behavior tree, according to the current virtual environment of the NPC - being attacked by the enemy and needing to find cover, determine the relevant EQS query node and the target blackboard key required by the EQS corresponding to the EQS query node: the first blackboard key: the enemy's position, the second blackboard key: the NPC's own position;

[0191] The EQS includes two sampling point generators, generator1 and generator2. The scene query context configured in generator1 is named context1, and the scene query context configured in generator2 is named context2.

[0192] Pass the first blackboard key to the query configuration item in context1, and pass the second blackboard key to the query configuration item in context2. Then context1 obtains the enemy's position data from the blackboard data according to the first blackboard key, and context2 obtains the NPC's own position data from the blackboard data according to the second blackboard key.

[0193] Generator 1 generates sampling point cluster 1 with the enemy's position data as the center, and generator 2 generates sampling point cluster 2 with the NPC's own position data as the center;

[0194] This EQS includes two test rules, Test1 and Test 2. Test1 is used to determine the enemy's shooting range, and Test2 is used to determine the positions around the NPC that can be avoided.

[0195] The scene query context configured in Test 1 is named context3, and the scene query context configured in Test 2 is named context4;

[0196] Pass the first blackboard key to the query configuration item in context3, and pass the second blackboard key to the query configuration item in context4. Then context1 obtains the enemy's position data from the blackboard data according to the first blackboard key, and context2 obtains the NPC's own position data from the blackboard data according to the second blackboard key.

[0197] Test1 compares each sampling point in sampling point cluster 1 with the sampling point where the enemy is located according to a preset algorithm to obtain the score of each sampling point in sampling point cluster 1. Test2 compares each sampling point in sampling point cluster 2 with the sampling point where the NPC is located according to a preset algorithm to obtain the score of each sampling point in sampling point cluster 2. EQS determines a target point by combining the scores of each sampling point in the two sampling point clusters.

[0198] EQS passes the target point to the AI ​​behavior tree, which generates action instructions to move to the target point and controls the NPC to move to the target point.

[0199] The present application embodiment provides a behavior control device for NPC, such as Fig.12 As shown, the NPC behavior control device may include: a node dynamic determination module 1101, a target point output module 1102 and a behavior execution module 1103, wherein:

[0200] The node dynamic determination module 1101 is used to determine the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node according to the virtual environment currently located by the NPC through the AI ​​behavior tree;

[0201] The target point output module 1102 is used to call the EQS query node to run the EQS, pass the target blackboard key into the EQS, and obtain the target point in the virtual environment output by the EQS;

[0202] The behavior execution module 1103 is used to input the target point into the AI ​​behavior tree, obtain the behavior to be executed by the NPC output by the AI ​​behavior tree, and control the NPC to execute the behavior;

[0203] Among them, the target point is determined according to the reference point of EQS; the reference point is determined according to the blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree.

[0204] The NPC behavior control device of the embodiment of the present application can execute the NPC behavior control method provided in the embodiment of the present application, and the implementation principle is similar. The actions performed by each module in the NPC behavior control device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[0205] The device of the embodiment of the present application determines the target blackboard key required by the EQS query node of the scene query system related to the virtual environment and the EQS query node corresponding to the EQS query node according to the virtual environment currently located by the NPC through the AI ​​behavior tree. Since the virtual environment in which the NPC is located changes in real time, the EQS query node and the target blackboard key determined at different times are also different. The EQS query node is further called to run the corresponding EQS, and the target blackboard key is passed into the EQS, so that the EQS can use the blackboard value corresponding to the blackboard key as a reference point, output the target point, input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior. Since the behavior is related to the virtual environment in which the NPC is located, the present application can control the NPC actions more flexibly and improve the satisfaction of the player's interaction with the NPC.

[0206] In one possible implementation, the EQS includes a target scene query context for the query configuration item to be configured;

[0207] Target point output module, including:

[0208] The reference point output unit is used to pass the target blackboard key into the query configuration item of the target scene query scenario, so that the target scene query scenario obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

[0209] Based on the above embodiments, as an optional embodiment, the behavior control device further includes:

[0210] A scenario creation module, used to create at least one type of target scenario query scenario for the query configuration item to be configured;

[0211] EQS configuration module, used to configure the target scene query context in EQS;

[0212] Node configuration module, used to configure the EQS query node for reading EQS in the AI ​​behavior tree;

[0213] The types of target scene query scenarios include a first type of scene query scenario for outputting a reference point of a role variable and a second type of scene query scenario for outputting a reference point of a position variable.

[0214] Based on the above embodiments, as an optional embodiment, the EQS configuration module includes:

[0215] The first scenario configuration module is used to configure a type of target scenario query scenario for the test rule in the EQS, and name the configured target scenario query scenario as the first target scenario query scenario.

[0216] Based on the above embodiments, as an optional embodiment, the target blackboard key required by the EQS includes a first blackboard key required by the first target scene query scenario;

[0217] The target point output module includes:

[0218] A sampling point generating unit, used for generating a plurality of sampling points through a sampling point generator in EQS;

[0219] A first blackboard value transfer unit is used to obtain a first blackboard value corresponding to a first blackboard key in the blackboard data through a first target scene query context, and obtain a first reference point input test rule according to the first blackboard value;

[0220] The rule comparison unit is used to compare the multiple sampling points with the first reference point respectively by testing the rule, and determine the target point from the multiple sampling points according to the comparison result.

[0221] Based on the above embodiments, as an optional embodiment, the EQS configuration module includes:

[0222] The second scenario configuration module is used to configure a type of target scenario query scenario for the sampling point generator, and name the configured target scenario query scenario as a second target scenario query scenario.

[0223] Based on the above embodiments, as an optional embodiment, the target blackboard key required by the EQS includes a second blackboard key required by the second target scene query scenario;

[0224] The sampling point generation unit includes:

[0225] A second blackboard value transmission unit is used to query the context through the second target scene, obtain a second blackboard value corresponding to the second blackboard key in the blackboard data, and obtain a second reference point according to the second blackboard value and pass it into the sampling point generator;

[0226] The center generating unit is used to generate a plurality of sampling points with the second reference point as the center through the sampling point generator.

[0227] Based on the above embodiments, as an optional embodiment, the reference point output unit is specifically used for:

[0228] If it is determined that the blackboard value meets the preset conditions, the blackboard value is used as the reference point;

[0229] If it is determined that the blackboard value does not meet the preset condition, the preset value is used as a reference point.

[0230] In an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory. The processor executes the above-mentioned computer program to implement the steps of the NPC behavior control method. Compared with the related art, it can achieve: through an AI behavior tree, according to the virtual environment in which the NPC is currently located, determine the scene query system EQS query node related to the virtual environment and the target blackboard key required by the EQS corresponding to the EQS query node. Since the virtual environment in which the NPC is located changes in real time, the EQS query node and the target blackboard key determined at different times are also different. The EQS query node is further called to run the corresponding EQS, and the target blackboard key is passed into the EQS, so that the EQS can use the blackboard value corresponding to the blackboard key as a reference point, output the target point, input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior. Since the behavior is related to the virtual environment in which the NPC is located, the present application can control the NPC action more flexibly and improve the satisfaction of the player's interaction with the NPC.

[0231] In an alternative embodiment, an electronic device is provided, such as Fig.13 As shown, Fig.13 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

[0232] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0233] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.13 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0234] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.

[0235] The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.

[0236] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.

[0237] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented. Compared with the related art, the following can be implemented: determining, through an AI behavior tree, a scene query system EQS query node related to the virtual environment and a target blackboard key required by the EQS corresponding to the EQS query node according to the virtual environment in which the NPC is currently located. Since the virtual environment in which the NPC is located changes in real time, the EQS query nodes and target blackboard keys determined at different times are also different. The EQS query node is further called to run the corresponding EQS, and the target blackboard key is passed into the EQS, so that the EQS can use the blackboard value corresponding to the blackboard key as a reference point, output the target point, input the target point into the AI ​​behavior tree, obtain the NPC behavior to be executed output by the AI ​​behavior tree, and control the NPC to execute the behavior. Since the behavior is related to the virtual environment in which the NPC is located, the present application can control the NPC actions more flexibly and improve the satisfaction of the player's interaction with the NPC.

[0238] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described in the drawings.

[0239] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.

[0240] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.

Claims

1. A method for controlling the behavior of a non-player character NPC, characterized in that: include: Determine, through the AI ​​behavior tree, a scene query system query node related to the virtual environment and a target blackboard key required by the scene query system corresponding to the scene query system query node according to the virtual environment currently located by the NPC; Calling the scene query system query node to run the scene query system, passing the target blackboard key into the scene query system, and obtaining the target point in the virtual environment output by the scene query system; Input the target point into the AI ​​behavior tree, obtain the behavior to be executed by the NPC output by the AI ​​behavior tree, and control the NPC to execute the behavior; Wherein, the target point is determined according to a reference point of the scene query system, and the reference point is determined according to a blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree; The scene query system includes a target scene query context including a query configuration item to be configured; The step of transferring the target blackboard key into the scene query system comprises: The target blackboard key is passed into the query configuration item of the target scene query context, so that the target scene query context obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

2. The behavior control method according to claim 1, characterized in that: The calling of the scene query system query node to run the scene query system also includes: Creating at least one type of target scene query context for the query configuration item to be configured; Configuring the target scene query context in a scene query system; configuring a scene query system query node in the AI ​​behavior tree for reading the scene query system; The types of the target scene query contexts include a first type of scene query context for outputting reference points of role variables and a second type of scene query context for outputting reference points of position variables.

3. The behavior control method according to claim 2, characterized in that: Configuring the target scene query context in the scene query system includes: A type of target scene query context is configured for the test rule in the scene query system, and the configured target scene query context is named as a first target scene query context.

4. The behavior control method according to claim 3, characterized in that: The target blackboard key required by the scene query system includes the first blackboard key required by the first target scene query scenario; Obtaining a target point in the virtual environment output by the scene query system includes: Generate multiple sampling points by using a sampling point generator in the scene query system; Obtaining a first blackboard value corresponding to the first blackboard key in the blackboard data through the first target scene query context, and obtaining a first reference point according to the first blackboard value and transmitting it into the test rule; The multiple sampling points are compared with the first reference point respectively according to the test rule, and the target point is determined from the multiple sampling points according to the comparison result.

5. The behavior control method according to claim 4, characterized in that: The configuring the target scene query context in the scene query system further includes: A type of target scene query context is configured for the sampling point generator, and the configured target scene query context is named as a second target scene query context.

6. The behavior control method according to claim 5, characterized in that: The target blackboard key required by the scene query system includes a second blackboard key required by the second target scene query scenario; The generating of a plurality of sampling points by a sampling point generator pre-configured in the scene query system comprises: By querying the context of the second target scene, obtaining a second blackboard value corresponding to the second blackboard key in the blackboard data, and obtaining a second reference point according to the second blackboard value and passing it into the sampling point generator; The plurality of sampling points are generated by the sampling point generator with the second reference point as the center.

7. The behavior control method according to any one of claims 1 to 6, characterized in that: The step of enabling the target scene query context to obtain a reference point according to a blackboard value currently corresponding to the target blackboard key in the blackboard data includes: If it is determined that the blackboard value meets the preset condition, the blackboard value is used as the reference point; If it is determined that the blackboard value does not meet the preset condition, the preset value is used as the reference point.

8. A behavior control device for a non-player character NPC, characterized in that: include: A node dynamic determination module, used to determine, through an AI behavior tree, a scene query system query node related to the virtual environment and a target blackboard key required by the scene query system corresponding to the scene query system query node according to the virtual environment currently located by the NPC; A target point output module, used for calling the scene query system query node to run the scene query system, transferring the target blackboard key into the scene query system, and obtaining the target point in the virtual environment output by the scene query system; A behavior execution module, used to input the target point into the AI ​​behavior tree, obtain the behavior to be executed by the NPC output by the AI ​​behavior tree, and control the NPC to execute the behavior; Wherein, the target point is determined according to the reference point of the scene query system; the reference point is determined according to the blackboard value currently corresponding to the target blackboard key in the blackboard data of the AI ​​behavior tree; The scene query system includes a target scene query context including a query configuration item to be configured; The target point output module transmits the target blackboard key to the scene query system, including: The target blackboard key is passed into the query configuration item of the target scene query context, so that the target scene query context obtains the reference point according to the blackboard value currently corresponding to the target blackboard key in the blackboard data.

9. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Control method of non-player role

    CN101239240A

  • Method for implementing AI behavior of NPC in VR games

    CN108031121A