Behavior control method and device for game non-player characters (NPCs), and storage medium
By monitoring real-time environmental information and generating target NPCs on the game client, the overhead problem caused by server-configured NPC behavior in MMORPG games is solved, enabling rich NPC behaviors and personalized gaming experience.
Patent Information
- Application Number
- CN202111369756.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2041-11-18
AI Technical Summary
In MMORPG games, configuring a large number of NPC behaviors on the server will result in high overhead and affect server performance, while configuring fewer NPC behaviors will reduce the game's expressiveness.
By monitoring real-time environmental information on the game client, generating and controlling the behavior of the target NPC, reducing dependence on the server, using the target NPC generator to generate the target NPC at the target creation location, and controlling it to perform the target behavior.
It saves game server overhead, enriches NPC behavior in the game, improves game performance and player experience, and realizes a personalized and customized game world.
Smart Images

Figure CN114053716B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of online game technology, and in particular to a method and device for controlling the behavior of non-player characters (NPCs) in games, a storage medium, and a computer device. Background Art
[0002] MMORPGs (Massive Multiplayer Online Role-Playing Games) often provide players with a more realistic gaming experience by stacking a large number of NPC (non-player character) behaviors, making the game world feel more real and the gaming experience richer. In online games, NPC behaviors are generally configured through the game server, and the server synchronizes NPC behaviors to each game client. If a large number of NPC behaviors are configured and synchronized, it will incur a large overhead on the server, causing heavy server operation pressure. If there are fewer NPC behaviors, the expressiveness of the game will be greatly reduced. How to reduce server overhead while ensuring the expressiveness of the game is an exploration direction in this field. Summary of the Invention
[0003] In view of this, the present application provides a behavior control method and device, storage medium, and computer equipment for non-player characters (NPCs) in games, which helps save game server expenses, enrich NPC behaviors in games, improve game expressiveness, and enhance player gaming experience.
[0004] According to one aspect of the present application, a method for controlling the behavior of a non-player character (NPC) in a game is provided, which is applied to a game client and includes:
[0005] Monitor real-time environmental information within the game;
[0006] Acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC;
[0007] The target NPC generator in the game client is called to generate the target NPC at the target creation position, and the target NPC is controlled to execute the target behavior corresponding to the target creation position.
[0008] Optionally, the acquiring target behavior generation data matching the real-time environment information specifically includes:
[0009] Determining whether the real-time environmental information satisfies a preset action execution condition, wherein the preset action execution condition includes an execution condition for at least one planned action corresponding to each preset NPC, the preset NPC is located within a display area corresponding to the real-time location of the player character, and the real-time environmental information includes current time information and / or current weather information;
[0010] When the real-time environmental information meets the execution conditions of any planned behavior, the any planned behavior is used as the target behavior, the preset NPC corresponding to the execution conditions of any planned behavior is used as the target NPC, and the target behavior generation data is obtained.
[0011] Optionally, before monitoring the real-time environment information within the game, the target NPC is configured in the following manner:
[0012] Adding at least one NPC to the game configuration scene, wherein the at least one NPC includes a target NPC, and the target NPC generator is generated based on the adding operation of the target NPC;
[0013] Adding at least one reference behavior point in the game configuration scene, and configuring a planned behavior corresponding to each of the reference behavior points, wherein each of the at least one reference behavior point has a corresponding position, and the at least one reference behavior point includes a reference behavior point located at the target creation position;
[0014] The controlling the target NPC to execute the target behavior corresponding to the target creation position specifically includes:
[0015] Allocate part or all of the planned behaviors in the reference behavior points configured at the target creation position to the target NPC as the target behaviors;
[0016] The target NPC is controlled to execute the target behavior starting from the target creation position.
[0017] Optionally, before configuring part or all of the planned behaviors in the reference behavior points configured at the target creation location as the target behaviors to the target NPC, the method further includes:
[0018] Configure a benchmark behavior point corresponding to each target behavior period for the target NPC;
[0019] After controlling the target NPC to perform the target behavior with the target creation position as a starting point, the method further includes:
[0020] The target NPC is controlled to move to the next reference behavior point configured for the target NPC, and the target NPC is controlled to execute the planned behavior corresponding to the next reference behavior point until the planned behaviors corresponding to all reference behavior points of the target NPC are executed.
[0021] Optionally, each benchmark behavior point corresponds to at least one planned behavior; when any benchmark behavior point corresponds to multiple planned behaviors, the multiple planned behaviors include non-specified planned behaviors and / or specified planned behaviors, and the specified planned behaviors are configured with corresponding specified NPCs;
[0022] The configuring part or all of the planned behaviors in the reference behavior points configured at the target creation position as the target behaviors to the target NPC specifically includes:
[0023] If the planned behavior corresponding to the target reference point includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC belongs to the target-specified NPC corresponding to the target-specified planned behavior, then the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC;
[0024] If the planned behavior corresponding to the target reference point includes a target designated planned behavior and a target non-designated planned behavior, and the target NPC does not belong to the target designated NPC, then the non-designated planned behavior corresponding to the target reference point is configured as the target behavior to the target NPC;
[0025] If the planned behavior corresponding to the target reference point is a target non-specified planned behavior, all planned behaviors corresponding to the target reference point are configured as the target behaviors to the target NPC;
[0026] If the planned behavior corresponding to the target reference point is a target-specified planned behavior, the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC.
[0027] Optionally, after allocating some or all of the at least one reference behavior point to the target NPC, the method further includes:
[0028] In the event that the configuration data corresponding to the game is changed, the target behavior generation data of the target NPC is changed according to the configuration change data of the game, wherein the configuration change data includes the reference behavior point to be changed configured on the target NPC and / or the planned behavior to be changed corresponding to the reference behavior point to be changed;
[0029] The game client generates data according to the changed target behavior to control the behavior of the target NPC.
[0030] Optionally, after controlling the target NPC to perform the target behavior starting from the target creation position, the method further includes:
[0031] If the target NPC is also configured with a next behavior point position corresponding to the target creation position, then when the monitored real-time environmental information satisfies the execution condition of the next planned behavior corresponding to the target behavior, the target NPC is controlled to move to the behavior point position corresponding to the next planned behavior, so that the target NPC executes the next planned behavior with the behavior point position as the starting point;
[0032] Otherwise, after the target NPC finishes performing the target behavior, the target NPC is destroyed.
[0033] According to another aspect of the present application, a device for controlling the behavior of a game NPC is provided, which is applied to a game client and includes:
[0034] Environmental monitoring module, used to monitor real-time environmental information within the game;
[0035] A data acquisition module, configured to acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC;
[0036] The behavior execution module is used to call the target NPC generator in the game client to generate the target NPC at the target creation position, and control the target NPC to execute the target behavior corresponding to the target creation position.
[0037] Optionally, the data acquisition module is specifically used to:
[0038] Determining whether the real-time environmental information satisfies a preset action execution condition, wherein the preset action execution condition includes an execution condition for at least one planned action corresponding to each preset NPC, the preset NPC is located within a display area corresponding to the real-time location of the player character, and the real-time environmental information includes current time information and / or current weather information;
[0039] When the real-time environmental information meets the execution conditions of any planned behavior, the any planned behavior is used as the target behavior, the preset NPC corresponding to the execution conditions of any planned behavior is used as the target NPC, and the target behavior generation data is obtained.
[0040] Optionally, the target NPC is configured as follows:
[0041] Adding at least one NPC to the game configuration scene, wherein the at least one NPC includes a target NPC, and the target NPC generator is generated based on the adding operation of the target NPC;
[0042] Adding at least one reference behavior point in the game configuration scene, and configuring a planned behavior corresponding to each of the reference behavior points, wherein each of the at least one reference behavior point has a corresponding position, and the at least one reference behavior point includes a reference behavior point located at the target creation position;
[0043] The behavior execution module is specifically used to: configure part or all of the planned behaviors in the reference behavior points configured at the target creation position as the target behaviors to the target NPC; and control the target NPC to execute the target behavior starting from the target creation position.
[0044] Optionally, the behavior execution module is further configured to:
[0045] Before assigning part or all of the planned behaviors among the benchmark behavior points assigned to the target creation location as the target behaviors to the target NPC, assigning benchmark behavior points corresponding to each target behavior time period to the target NPC;
[0046] After controlling the target NPC to perform the target behavior starting from the target creation position, the target NPC is controlled to move to the next benchmark behavior point configured for the target NPC, and the target NPC is controlled to perform the planned behavior corresponding to the next benchmark behavior point until the planned behaviors corresponding to all benchmark behavior points of the target NPC are completed.
[0047] Optionally, each benchmark behavior point corresponds to at least one planned behavior; when any benchmark behavior point corresponds to multiple planned behaviors, the multiple planned behaviors include non-specified planned behaviors and / or specified planned behaviors, and the specified planned behaviors are configured with corresponding specified NPCs;
[0048] The behavior execution module is further used to:
[0049] If the planned behavior corresponding to the target reference point includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC belongs to the target-specified NPC corresponding to the target-specified planned behavior, then the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC;
[0050] If the planned behavior corresponding to the target reference point includes a target designated planned behavior and a target non-designated planned behavior, and the target NPC does not belong to the target designated NPC, then the non-designated planned behavior corresponding to the target reference point is configured as the target behavior to the target NPC;
[0051] If the planned behavior corresponding to the target reference point is a target non-specified planned behavior, all planned behaviors corresponding to the target reference point are configured as the target behaviors to the target NPC;
[0052] If the planned behavior corresponding to the target reference point is a target-specified planned behavior, the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC.
[0053] Optionally, the device further comprises:
[0054] an updating module configured to, when configuration data corresponding to the game is changed, change the target behavior generation data of the target NPC according to the configuration change data of the game, wherein the configuration change data includes the reference behavior point to be changed configured on the target NPC and / or the planned behavior to be changed corresponding to the reference behavior point to be changed;
[0055] The behavior execution module is further used to generate data according to the changed target behavior through the game client to control the behavior of the target NPC.
[0056] Optionally, the behavior execution module is further configured to:
[0057] If the target NPC is also configured with a next behavior point position corresponding to the target creation position, then when the monitored real-time environmental information satisfies the execution condition of the next planned behavior corresponding to the target behavior, the target NPC is controlled to move to the behavior point position corresponding to the next planned behavior, so that the target NPC executes the next planned behavior with the behavior point position as the starting point;
[0058] Otherwise, after the target NPC finishes performing the target behavior, the target NPC is destroyed.
[0059] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the behavior control method of the non-player character (NPC) in the game is implemented.
[0060] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned behavior control method for non-player characters (NPCs) in the game when executing the program.
[0061] By means of the above technical solution, the present application provides a method and device for controlling the behavior of a non-player character NPC in a game, a storage medium, and a computer device, which monitors the real-time in-game environment information in the game client, obtains target behavior generation data that matches the real-time environment information, determines the target creation position corresponding to the target NPC, and then calls the target NPC generator to generate the target NPC at the target creation position, so that the generated target NPC performs the target behavior corresponding to the target creation position. Compared with the prior art method of configuring NPC behavior through the game server, the embodiment of the present application configures the NPC in the game and controls the NPC behavior by locally generating it on the game client, saving game server overhead, and controlling the NPC behavior based on the real-time in-game environment information in the game client. There is no need to synchronize the NPC behavior in each game client. Different players can see different NPC behaviors that match the local real-time environment information, which helps to personalize and customize the game world and enhance the player's gaming experience.
[0062] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0064] Figure 1 A flowchart of a method for controlling the behavior of a non-player character (NPC) in a game provided by an embodiment of the present application is shown;
[0065] Figure 2 A flow chart showing another method for controlling the behavior of a non-player character (NPC) in a game provided by an embodiment of the present application is shown;
[0066] Figure 3 A schematic diagram of the structure of a game NPC behavior control device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0067] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.
[0068] In this embodiment, a behavior control method for a non-player character NPC in a game is provided, which is applied to a game client, such as Figure 1 As shown, the method includes:
[0069] Step 101, monitoring real-time environment information within the game;
[0070] The embodiments of the present application provide an NPC behavior control method applied to a game client, which implements control of some NPC behaviors in the game locally on the game client (hereinafter referred to as NPC behaviors configured by the game client). Some NPC behaviors in the game can be independently configured and controlled by the game client, and specific NPC behaviors can be displayed in the game without the participation of the game server. Generally speaking, each game client independently displays NPC behaviors, that is, NPC behaviors controlled by game client A are not visible in game client B. Similarly, NPC behaviors controlled by game client B are not visible in game client A. The game in the embodiments of the present application can be an MMO (Massive Multiplayer Online) type game, including but not limited to MMORPG games. Moreover, since they are client-side NPCs, they are not affected by the server. Even when the client is offline or runs the game in offline mode, these client-side NPCs can still be displayed, and the client can still continue to control the behaviors of these client-side NPCs. In addition, the embodiments of the present application can also be applied to MMO+open world type games. For some client NPCs, the game client can control the behavior of these client NPCs by itself, and according to the configuration information of these client NPCs, when the configured time / timing / synchronization conditions are triggered, the client synchronizes the status, behavior and other information of the client NPC to the game server, and synchronizes the NPC data to the game server. For example, the status and behavior data of the client NPC that generates income for the players in the game can be synchronized to the server, thereby satisfying both the control of the client NPC and the requirements of the MMO+open world; in addition, there can be client NPCs and server NPCs (that is, NPCs whose behavior is controlled by the server) in the game client. The game client can control the client NPC by itself, and can also synchronize the behavior and status of the server NPC displayed in the game client according to the synchronization information received from the server, thereby meeting the needs of MMO+open world type games.
[0071] In an embodiment of the present application, a game client can control NPC behavior based on real-time in-game environmental information. First, while the game is running, real-time in-game environmental information is monitored. For example, to demonstrate the behavior of NPC characters "working at sunrise and resting at sunset" in the game and enhance the realism of the game, the in-game time information can be monitored. In actual application scenarios, the in-game time information can be different for different game clients. Specifically, the in-game time information can be determined based on the player's game progress. For example, if player A's game progress is to perform task 1 in area 1 at night, and player B's game progress is to perform task 2 in area 2 during the day, the in-game time information for game client A is night, and for game client B, the in-game time information is day. Of course, the time information can be divided into more fine-grained granularity, such as specific years, months, days, hours, minutes, and seconds.
[0072] Step 102: Acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC;
[0073] Furthermore, based on the monitored environmental information, the preset NPC behaviors are matched in real time to obtain target behavior generation data that matches the real-time environmental information. For example, if the time monitored in the game is 8 o'clock, and a fisherman NPC is pre-set to appear at the door of house A at 8 o'clock and go out fishing, then when the current time in the game is obtained as 8 o'clock, the fisherman NPC can be determined as the target NPC, and the fisherman NPC's behavior of going out to fish is the target behavior of the target NPC. Further, the target behavior generation data corresponding to the fisherman NPC's fishing behavior is obtained, which specifically includes the fisherman NPC's identifier, i.e., the target NPC identifier, and the location of the door of house A, i.e., the target creation location.
[0074] Step 103: Call the target NPC generator in the game client to generate the target NPC at the target creation location, and control the target NPC to perform the target behavior corresponding to the target creation location.
[0075] Furthermore, a pre-loaded target NPC generator corresponding to the target NPC is called and used to generate a model of the target NPC, thereby creating the target NPC in the game. The target NPC generator specifically generates the model at the target creation location. Using the target behavior pre-configured at the target creation location within the game client, the target NPC's behavior is configured, so that the target NPC appears to be performing the target behavior within the game. For example, the aforementioned fisherman NPC's behavior of leaving for fishing at 8:00 is used as an example. The fisherman NPC generator generates a fisherman NPC at the door of House A and synchronizes the pre-configured behavior at the door of House A to the fisherman NPC, so that the fisherman NPC appears to leave for fishing at 8:00 in the game. This approach allows some NPC behaviors within the game to be configured individually through the game client, saving game server overhead and providing strong support for enriching in-game NPC behaviors and enhancing game realism. Furthermore, by controlling NPC behaviors based on real-time environmental information within the game client, different players can experience different NPC behaviors within the game, allowing each player to create their own unique game world, helping to provide a personalized and customized gaming experience and increasing player satisfaction.
[0076] By applying the technical solution of this embodiment, the real-time in-game environment information in the game client is monitored, and target behavior generation data matching the real-time environment information is obtained, and the target creation location corresponding to the target NPC is determined, thereby calling the target NPC generator to generate the target NPC at the target creation location, so that the generated target NPC performs the target behavior corresponding to the target creation location. Compared with the prior art method of configuring NPC behavior through the game server, the embodiment of the present application configures the NPC in the game and controls the NPC behavior by locally generating it through the game client, saving game server overhead, and controlling the NPC behavior based on the real-time in-game environment information in the game client. There is no need to synchronize the NPC behavior in each game client. Different players can see different NPC behaviors that match the local real-time environment information, which helps to personalize and customize the game world and enhance the player's gaming experience.
[0077] In an embodiment of the present application, optionally, at least one NPC is added to the game configuration scene, wherein the at least one NPC includes a target NPC, and the target NPC generator is generated based on the adding operation of the target NPC; at least one benchmark behavior point is added to the game configuration scene, and the planned behavior corresponding to each benchmark behavior point is configured respectively, each benchmark behavior point in the at least one benchmark behavior point has its own corresponding position, and the at least one benchmark behavior point includes a benchmark behavior point located at the target creation position.
[0078] In an embodiment of the present application, a pre-set planned behavior blueprint configuration can be used to load an NPC generator and configure planned behaviors in the game. Among them, NPCs can be added to the game configuration scene by dragging the NPC blueprint into the game configuration scene. The NPC generator is generated based on the NPC addition operation, and the image of the NPC is customized by modifying the NPC blueprint configuration. In addition, the benchmark behavior point blueprint can be dragged into the game configuration scene, and the planned behavior can be edited at the benchmark behavior point, so that the effect of configuring the planned behavior corresponding to the behavior point for the NPC generated at the behavior point can be achieved through the configured benchmark behavior point, so that the NPC generated at the benchmark behavior point in the game can be configured with the planned behavior corresponding to the benchmark behavior point. For example, the door position of House A is used as a behavior point, and the behavior of going out fishing is edited at this point. When an NPC is generated at the door position of House A during game operation, the behavior of going out fishing will be configured to this NPC, so that this NPC can perform the behavior of going out fishing.
[0079] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another behavior control method for non-player characters NPC in the game is provided, such as Figure 2 As shown, the method includes:
[0080] Step 201: monitor real-time environment information within the game.
[0081] Step 202: Determine whether the real-time environmental information satisfies the preset behavior execution conditions, wherein the preset behavior execution conditions include the execution conditions of at least one planned behavior corresponding to each preset NPC, the preset NPC is located within the display area corresponding to the real-time position of the player character, and the real-time environmental information includes current time information and / or current weather information.
[0082] Step 203: When the real-time environmental information meets the execution conditions of any planned behavior, any planned behavior is used as the target behavior, the preset NPC corresponding to the execution conditions of any planned behavior is used as the target NPC, and the target behavior generation data is obtained, wherein the target behavior generation data includes the target creation position corresponding to the target NPC.
[0083] Step 204: Call the target NPC generator in the game client to generate the target NPC at the target creation location.
[0084] Step 205: Allocate part or all of the planned behaviors in the reference behavior points configured at the target creation location as the target behaviors to the target NPC.
[0085] Step 206: Control the target NPC to execute the target behavior starting from the target creation position.
[0086] In the above embodiment, real-time environmental information such as the current time and weather information within the game can be monitored to determine in real time whether the current environmental information meets the preset behavior execution conditions. The preset behavior execution conditions can specifically include trigger conditions corresponding to multiple planned behaviors of each preset NPC near the player character. The preset NPCs can be all preset NPCs within the display area corresponding to the player character's real-time location. For example, the execution condition for a soldier NPC's patrol behavior is that the game time reaches 6:00, the execution condition for a child NPC's shelter from the rain behavior is that the game weather is raining, and the execution condition for a fisherman NPC's fishing behavior is that the game time reaches 8:00 and the weather is sunny. By monitoring the real-time environmental information within the game, it is possible to determine which planned behavior should be triggered by the current game environment. When it is determined that the real-time environmental information meets the execution conditions of a planned behavior, the planned behavior that meets the conditions is used as the target behavior. Further, the target NPC identifier and target creation location corresponding to the target behavior are obtained, and a pre-loaded target NPC generator is called to generate the target NPC at the target creation location. Based on the pre-edited planned behavior at the reference behavior point, the behavior of the target NPC is configured so that the target NPC executes the configured planned behavior at the target creation location in the game, i.e., the target behavior.
[0087] In the embodiment of the present application, optionally, if the target behavior generation data further includes a plurality of target behavior time periods corresponding to the target NPC and a reference behavior point corresponding to each target behavior time period, then before step 205, the step may further include: configuring a reference behavior point corresponding to each target behavior time period for the target NPC, wherein the target behavior generation data further includes a plurality of target behavior time periods corresponding to the target NPC and a reference behavior point corresponding to each target behavior time period;
[0088] Accordingly, step 205 may also include: controlling the target NPC to move to the next benchmark behavior point configured for the target NPC, and controlling the target NPC to execute the planned behavior corresponding to the next benchmark behavior point until the planned behaviors corresponding to all benchmark behavior points of the target NPC are executed.
[0089] In this embodiment, the target behavior of the NPC can be a plurality of behaviors that are continuous in time and triggered to execute by time changes. After the target NPC is created, a plurality of benchmark behavior points corresponding to a plurality of time periods can be configured for the target NPC (the benchmark behavior point corresponding to the target creation position is the first benchmark behavior point among them). After the target NPC is created at the target creation position, in addition to configuring the planned behavior of the benchmark behavior point corresponding to the target creation position to the target NPC, each benchmark behavior point can also be configured to the target NPC. Thus, after the target NPC executes the planned behavior corresponding to the target creation position, the target NPC will move to the position of the next benchmark behavior point, configure the planned behavior corresponding to the point, and continue to execute the planned behavior, and so on until the target NPC executes the planned behavior of all the benchmark behavior points corresponding to the NPC.
[0090] In an embodiment of the present application, optionally, step 206 may also include: if the target NPC is also configured with a next behavior point position corresponding to the target creation position, then when the real-time environmental information is monitored to meet the execution conditions of the next planned behavior corresponding to the target behavior, the target NPC is controlled to move to the behavior point position corresponding to the next planned behavior, so that the target NPC executes the next planned behavior with the behavior point position as the starting point; otherwise, after the target NPC finishes executing the target behavior, the target NPC is destroyed.
[0091] In this embodiment, the NPC's target behavior can be a single independent behavior or one of multiple logically related behaviors. For example, a soldier NPC's patrol behavior is a standalone behavior. After the patrol behavior is completed, the soldier NPC can be destroyed and the real-time environmental information can continue to be monitored. When the real-time environmental information meets the execution conditions for the patrol behavior, the soldier NPC is regenerated and the patrol behavior is executed. If the target behavior is followed by other related behaviors, because NPC behaviors are configured using behavior points, which can also be understood as the target NPC also being configured with a next behavior point corresponding to the target creation location, after the current target behavior is executed, the NPC remains in the game and is not destroyed. When the real-time environmental information is monitored to meet the next planned behavior, the NPC is controlled to move to the behavior point of the next planned behavior. Based on the planned behavior edited in this behavior point, the NPC behavior is continuously configured so that the NPC continues to execute the next planned behavior until all planned behaviors are executed, and the NPC is destroyed. Furthermore, if the NPC is configured to execute multiple behaviors in a loop, for example, the NPC executes a series of behaviors every day, demonstrating a behavioral pattern of "working at sunrise and resting at sunset," then the NPC can be kept in the game and remain until the current game run ends.
[0092] In the embodiment of the present application, each benchmark behavior point optionally corresponds to at least one planned behavior; when any benchmark behavior point corresponds to multiple planned behaviors, the multiple planned behaviors include non-specified planned behaviors and / or specified planned behaviors, and the specified planned behaviors are configured with corresponding specified NPCs; step 205 may specifically include:
[0093] Step 205-1: If the planned behavior corresponding to the target reference point includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC belongs to the target-specified NPC corresponding to the target-specified planned behavior, then the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC;
[0094] Step 205-2: If the planned behavior corresponding to the target reference point includes a target designated planned behavior and a target non-designated planned behavior, and the target NPC does not belong to the target designated NPC, then the non-designated planned behavior corresponding to the target reference point is configured as the target behavior to the target NPC;
[0095] Step 2053: If the planned behavior corresponding to the target reference point is a target non-specified planned behavior, all planned behaviors corresponding to the target reference point are configured as the target behaviors to the target NPC;
[0096] Step 205-4: If the planned behavior corresponding to the target reference point is a target-specified planned behavior, the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC.
[0097] In this embodiment, the same behavior point can be pre-edited with multiple planned behaviors. For example, the door of House A can serve as the benchmark behavior point for Fisherman A's fishing behavior, Child B's playing behavior, and any NPC's shopping behavior, where shopping behavior belongs to the above-mentioned non-designated planned behavior, and Fisherman A's fishing behavior and Child B's playing behavior belong to the above-mentioned designated planned behavior. When editing the benchmark behavior point, if a certain benchmark behavior point A only corresponds to non-designated planned behavior, then the non-designated planned behavior can be directly edited into this benchmark behavior point A. If the benchmark behavior point contains designated planned behavior, then in order to avoid confusion caused by the planned behavior, when editing the designated planned behavior, its corresponding designated NPC must also be edited into the benchmark behavior point at the same time. Specifically, if a certain benchmark behavior point B only corresponds to designated planned behavior, then each designated planned behavior and its corresponding designated NPC identifier can be edited into this benchmark behavior point B together. If a certain benchmark behavior point C contains both non-specified planned behaviors and specified planned behaviors, then the non-specified planned behaviors will be edited directly into this benchmark behavior point C, and the specified planned behaviors and their corresponding specified NPC identifiers will also be edited into this benchmark behavior point C. For example, in behavior point C, edit specified planned behavior 1 and specified NPC 1, as well as non-specified planned behavior 2. In order to reduce the amount of editing, the specified planned behaviors and NPCs can also be classified. For example, NPCs are divided into adults and children, and specified planned behaviors are divided into adult planned behaviors and child planned behaviors. For example, the benchmark behavior point at the door of house A has the behavior of going out fishing (and the category corresponding to the behavior, i.e., adult planned behavior) and the behavior of playing (and the category corresponding to the behavior, i.e., child planned behavior). When an NPC is generated at this behavior point, the specific planned behavior to be configured as the behavior of this NPC is determined based on the category of the generated NPC. For example, if the generated NPC is an adult, the behavior of the adult NPC is configured as the behavior of going out fishing. Similarly, if the generated NPC is a child, the behavior of the child NPC is configured as the behavior of playing.
[0098] Furthermore, after the target NPC is generated at the target creation position, when configuring the target behavior for the target NPC, if the target reference point corresponding to the target creation position only contains target non-specified planned behaviors, then all target non-specified planned behaviors in the point are used as target behaviors; if the target reference point only contains target specified planned behaviors, then the target specified planned behaviors that match the target NPC are used as target behaviors; if the target reference point contains both target non-specified planned behaviors and target specified planned behaviors, then first determine whether the target NPC belongs to the target specified NPC corresponding to the point. If it does, the target specified planned behaviors that match the target NPC are used as target behaviors. If not, all target non-specified planned behaviors are used as target behaviors.
[0099] In an embodiment of the present application, optionally, it may also include: when the configuration data corresponding to the game changes, the target behavior generation data of the target NPC is changed according to the configuration change data of the game, wherein the configuration change data includes the benchmark behavior points to be changed configured on the target NPC and / or the planned behaviors to be changed corresponding to the benchmark behavior points to be changed; and the behavior of the target NPC is controlled by the game client according to the changed target behavior generation data.
[0100] In the above embodiment, when the configuration data corresponding to the game changes, the NPC generator, the benchmark behavior point, and the planned behavior corresponding to the benchmark behavior point can be deleted, added, or modified based on the configuration change data. The specific configuration change data can include updating the configured NPC and benchmark behavior point in the game configuration scene, and then reloading the NPC generator, configuring the benchmark behavior point, and the corresponding planned behavior according to the updated configuration. After reconfiguration, the effect of updating the planned behavior of the NPC in the game can be achieved, making the update and maintenance of the NPC behavior in the game more convenient. In a specific application scenario, if the changed part includes the configuration data corresponding to the target NPC, then the target behavior generation data of the target NPC will change accordingly, and the target NPC will be controlled in the game according to the changed data. Optionally, the benchmark behavior point to be changed includes the benchmark behavior point at the target creation position, and / or the planned behavior to be changed corresponding to the benchmark behavior point to be changed includes the planned behavior corresponding to the benchmark behavior point at the target creation position.
[0101] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a game NPC behavior control device, which is applied to the game client, such as Figure 3 As shown, the device includes:
[0102] Environmental monitoring module, used to monitor real-time environmental information within the game;
[0103] A data acquisition module, configured to acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC;
[0104] The behavior execution module is used to call the target NPC generator in the game client to generate the target NPC at the target creation position, and control the target NPC to execute the target behavior corresponding to the target creation position.
[0105] Optionally, the data acquisition module is specifically used to:
[0106] Determining whether the real-time environmental information satisfies a preset action execution condition, wherein the preset action execution condition includes an execution condition for at least one planned action corresponding to each preset NPC, the preset NPC is located within a display area corresponding to the real-time location of the player character, and the real-time environmental information includes current time information and / or current weather information;
[0107] When the real-time environmental information meets the execution conditions of any planned behavior, the any planned behavior is used as the target behavior, the preset NPC corresponding to the execution conditions of any planned behavior is used as the target NPC, and the target behavior generation data is obtained.
[0108] Optionally, the target NPC is configured as follows:
[0109] Adding at least one NPC to the game configuration scene, wherein the at least one NPC includes a target NPC, and the target NPC generator is generated based on the adding operation of the target NPC;
[0110] Adding at least one reference behavior point in the game configuration scene, and configuring a planned behavior corresponding to each of the reference behavior points, wherein each of the at least one reference behavior point has a corresponding position, and the at least one reference behavior point includes a reference behavior point located at the target creation position;
[0111] The behavior execution module is specifically used to: configure part or all of the planned behaviors in the reference behavior points configured at the target creation position as the target behaviors to the target NPC; and control the target NPC to execute the target behavior starting from the target creation position.
[0112] Optionally, the behavior execution module is further configured to:
[0113] Before assigning part or all of the planned behaviors among the benchmark behavior points assigned to the target creation position as the target behaviors to the target NPC, benchmark behavior points corresponding to each target behavior period are assigned to the target NPC, wherein the target behavior generation data further includes multiple target behavior periods corresponding to the target NPC and benchmark behavior points corresponding to each target behavior period;
[0114] After controlling the target NPC to perform the target behavior starting from the target creation position, the target NPC is controlled to move to the next benchmark behavior point configured for the target NPC, and the target NPC is controlled to perform the planned behavior corresponding to the next benchmark behavior point until the planned behaviors corresponding to all benchmark behavior points of the target NPC are completed.
[0115] Optionally, each benchmark behavior point corresponds to at least one planned behavior; when any benchmark behavior point corresponds to multiple planned behaviors, the multiple planned behaviors include non-specified planned behaviors and / or specified planned behaviors, and the specified planned behaviors are configured with corresponding specified NPCs;
[0116] The behavior execution module is further used to:
[0117] If the planned behavior corresponding to the target reference point includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC belongs to the target-specified NPC corresponding to the target-specified planned behavior, then the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC;
[0118] If the planned behavior corresponding to the target reference point includes a target designated planned behavior and a target non-designated planned behavior, and the target NPC does not belong to the target designated NPC, then the non-designated planned behavior corresponding to the target reference point is configured as the target behavior to the target NPC;
[0119] If the planned behavior corresponding to the target reference point is a target non-specified planned behavior, all planned behaviors corresponding to the target reference point are configured as the target behaviors to the target NPC;
[0120] If the planned behavior corresponding to the target reference point is a target-specified planned behavior, the target-specified planned behavior corresponding to the target reference point and matching the target NPC is configured as the target behavior to the target NPC.
[0121] Optionally, the device further comprises:
[0122] an updating module configured to, when configuration data corresponding to the game is changed, change the target behavior generation data of the target NPC according to the configuration change data of the game, wherein the configuration change data includes the reference behavior point to be changed configured on the target NPC and / or the planned behavior to be changed corresponding to the reference behavior point to be changed;
[0123] The behavior execution module is further used to generate data according to the changed target behavior through the game client to control the behavior of the target NPC.
[0124] Optionally, the behavior execution module is further configured to:
[0125] If the target NPC is also configured with a next behavior point position corresponding to the target creation position, then when the monitored real-time environmental information satisfies the execution condition of the next planned behavior corresponding to the target behavior, the target NPC is controlled to move to the behavior point position corresponding to the next planned behavior, so that the target NPC executes the next planned behavior with the behavior point position as the starting point;
[0126] Otherwise, after the target NPC finishes performing the target behavior, the target NPC is destroyed.
[0127] It should be noted that for other corresponding descriptions of the functional units involved in the behavior control device for a game NPC provided in the embodiment of the present application, please refer to Figures 1 to 2 The corresponding description in the method will not be repeated here.
[0128] Based on the above Figures 1 to 2 The method shown in FIG. 1 is a method for performing the above-mentioned operation. Accordingly, the embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned operation is performed. Figures 1 to 2 The behavior control method of the game non-player character NPC is shown.
[0129] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0130] Based on the above Figures 1 to 2 The method shown, and Figure 3 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 2 The behavior control method of the game non-player character NPC is shown.
[0131] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a Wi-Fi interface), etc.
[0132] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0133] The storage medium may also include an operating system and a network communication module. An operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the execution of information processing programs and other software and / or programs. The network communication module facilitates communication between components within the storage medium, as well as with other hardware and software within the physical device.
[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by means of hardware to monitor the real-time in-game environment information in the game client, and obtain target behavior generation data that matches the real-time environment information, determine the target creation position corresponding to the target NPC, and thus call the target NPC generator to generate the target NPC at the target creation position, so that the generated target NPC performs the target behavior corresponding to the target creation position. Compared with the prior art method of configuring NPC behavior through the game server, the embodiment of the present application configures the NPC in the game and controls the NPC behavior by locally generating the game client, saving game server overhead, and controlling the NPC behavior based on the real-time in-game environment information in the game client. There is no need to synchronize the NPC behavior in each game client, and different players can see different NPC behaviors that match the local real-time environment information, which helps to personalize and customize the game world and enhance the player's gaming experience.
[0135] Those skilled in the art will understand that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application. Those skilled in the art will understand that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple sub-modules.
[0136] The serial numbers of the above application are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosure only discloses several specific implementation scenarios of the present application, but the present application is not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present application.
Claims
1. A method for controlling the behavior of a non-player character (NPC) in a game, characterized in that: Applied to game clients, including: Adding at least one NPC to a game configuration scene, wherein the at least one NPC includes a target NPC, and a target NPC generator is generated based on an adding operation of the target NPC; adding at least one reference behavior point to the game configuration scene, and respectively configuring a planned behavior corresponding to each of the reference behavior points, wherein each of the at least one reference behavior point has a corresponding position, and the at least one reference behavior point includes a reference behavior point located at a target creation position; Monitor real-time environmental information within the game; Acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC; Call the target NPC generator in the game client to generate the target NPC at the target creation position, and control the target NPC to perform the target behavior corresponding to the target creation position, including: configuring part or all of the planned behaviors in the benchmark behavior points configured at the target creation position as the target behavior to the target NPC; controlling the target NPC to perform the target behavior with the target creation position as the starting point.
2. The method according to claim 1, characterized in that The acquiring target behavior generation data matching the real-time environment information specifically includes: Determining whether the real-time environmental information satisfies a preset action execution condition, wherein the preset action execution condition includes an execution condition for at least one planned action corresponding to each preset NPC, the preset NPC is located within a display area corresponding to the real-time location of the player character, and the real-time environmental information includes current time information and / or current weather information; When the real-time environmental information meets the execution conditions of any planned behavior, the any planned behavior is used as the target behavior, the preset NPC corresponding to the execution conditions of any planned behavior is used as the target NPC, and the target behavior generation data is obtained.
3. The method according to claim 1, characterized in that Before assigning part or all of the planned behaviors in the reference behavior points configured at the target creation position to the target NPC as the target behaviors, the method further includes: Configure a benchmark behavior point corresponding to each target behavior period for the target NPC; After controlling the target NPC to perform the target behavior with the target creation position as a starting point, the method further includes: The target NPC is controlled to move to the next reference behavior point configured for the target NPC, and the target NPC is controlled to execute the planned behavior corresponding to the next reference behavior point until the planned behaviors corresponding to all reference behavior points of the target NPC are executed.
4. The method according to claim 1, wherein Each benchmark behavior point corresponds to at least one planned behavior; when any benchmark behavior point corresponds to multiple planned behaviors, the multiple planned behaviors include non-specified planned behaviors and / or specified planned behaviors, and the specified planned behaviors are configured with corresponding specified NPCs; The configuring part or all of the planned behaviors in the reference behavior points configured at the target creation position as the target behaviors to the target NPC specifically includes: If the planned behavior corresponding to the reference behavior point at the target creation position includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC belongs to the target-specified NPC corresponding to the target-specified planned behavior, then the target-specified planned behavior corresponding to the reference behavior point at the target creation position that matches the target NPC is configured as the target behavior to the target NPC; If the planned behavior corresponding to the reference behavior point at the target creation position includes a target-specified planned behavior and a target-unspecified planned behavior, and the target NPC does not belong to the target-specified NPC, then the unspecified planned behavior corresponding to the reference behavior point at the target creation position is configured as the target behavior to the target NPC; If the planned behavior corresponding to the reference behavior point at the target creation position is a target non-specified planned behavior, all planned behaviors corresponding to the reference behavior point at the target creation position are configured as the target behaviors to the target NPC; If the planned behavior corresponding to the reference behavior point on the target creation position is a target-specified planned behavior, the target-specified planned behavior corresponding to the reference behavior point on the target creation position that matches the target NPC is configured as the target behavior to the target NPC.
5. The method according to claim 1, wherein After configuring part or all of the planned behaviors in the reference behavior points configured at the target creation location as the target behaviors to the target NPC, the method further includes: In the event that the configuration data corresponding to the game is changed, the target behavior generation data of the target NPC is changed according to the configuration change data of the game, wherein the configuration change data includes the reference behavior point to be changed configured on the target NPC and / or the planned behavior to be changed corresponding to the reference behavior point to be changed; The game client generates data according to the changed target behavior to control the behavior of the target NPC.
6. The method according to claim 2, characterized in that After controlling the target NPC to perform the target behavior with the target creation position as a starting point, the method further includes: If the target NPC is also configured with a next behavior point position corresponding to the target creation position, then when the monitored real-time environmental information satisfies the execution condition of the next planned behavior corresponding to the target behavior, the target NPC is controlled to move to the behavior point position corresponding to the next planned behavior, so that the target NPC executes the next planned behavior with the behavior point position as the starting point; Otherwise, after the target NPC finishes performing the target behavior, the target NPC is destroyed.
7. A behavior control device for a game NPC, characterized in that: Applied to game clients, including: Environmental monitoring module, used to monitor real-time environmental information within the game; A data acquisition module, configured to acquire target behavior generation data that matches the real-time environment information, wherein the target behavior generation data includes a target creation position corresponding to a target NPC; a behavior execution module, configured to call a target NPC generator within the game client to generate the target NPC at the target creation location, and control the target NPC to execute a target behavior corresponding to the target creation location, wherein: part or all of the planned behaviors at the reference behavior points configured at the target creation location are configured as the target behaviors for the target NPC; and control the target NPC to execute the target behavior starting from the target creation location; The target NPC is configured in the following manner: at least one NPC is added to the game configuration scene, wherein the at least one NPC includes the target NPC, and the target NPC generator is generated based on the adding operation of the target NPC; at least one benchmark behavior point is added to the game configuration scene, and the planned behavior corresponding to each benchmark behavior point is configured respectively, each of the at least one benchmark behavior point has its own corresponding position, and the at least one benchmark behavior point includes a benchmark behavior point located at the target creation position.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Robot player control method and device
CN108553903A
Game object dynamic change method, device and equipment and storage medium
CN112044063A