Non-player character control method and apparatus, and device, medium and program product
By obtaining and updating the status parameters of NPCs, the problem of difficulty in controlling complex behaviors in the existing technology is solved, and the systematized control of NPC behavior and the richness and authenticity of interactive activities are realized, thereby improving the user experience.
Patent Information
- Application Number
- PCT/CN2024/081676
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-16
- Filing Date
- 2024-03-14
- Publication Date
- 2024-11-21
AI Technical Summary
The prior art is difficult to effectively control the interaction of non-player characters (NPCs) with complex behaviors in virtual environments, especially in action games. The related technology is only applicable to NPCs with simple behaviors and cannot meet the needs of complex behavior judgments and action games.
By obtaining the group control logic and the individual NPC control logic, responding to the influencing factors between the virtual role and the NPC group, modifying the state parameters of the NPC, and updating the interaction between the NPC and the virtual role based on these state parameters, realizing the NPC behavior Systematic control.
It realizes more systematic control of NPC behavior, supports customization of behaviors in different states, enhances the richness and authenticity of interactive activities between NPC and virtual characters, and improves the user experience.
Smart Images

Figure CN2024081676_21112024_PF_FP_ABST
Abstract
Description
Non-player character control method, device, equipment, medium and program product
[0001] This application claims priority to Chinese patent application No. 202310548686.7, filed on May 16, 2023, entitled “Non-player character control method, device, equipment, medium and program product”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of computer technology, and more particularly to a method, apparatus, device, medium, and program product for controlling a non-player character. Background Art
[0003] In virtual environment-based applications, such as Massive Multi-player Online Games (MMOGs), users control virtual characters to move around in the virtual environment. Furthermore, non-player characters (NPCs) exist within the virtual environment. NPCs can interact with the user-controlled virtual characters, for example, attacking them. NPCs can also facilitate plot progression or assist users in completing tasks.
[0004] The related technology sets the NPC behavior control logic in the group control logic. One group control logic corresponds to multiple NPCs. Instructions are issued to the individuals of multiple NPCs through the group control logic, and multiple NPCs each execute the behavior corresponding to the received instructions.
[0005] However, this technology is only suitable for situations where the behavior of individual NPCs and the conditions for determining their behavior are relatively simple, such as the birth of an NPC. It is not applicable when the behavior performed by individual NPCs and the conditions for determining their behavior are relatively complex, such as in complex action games.
[0006] Summary of the Invention
[0007] This application provides a method, apparatus, device, medium, and program product for controlling a non-player character. The technical solution is as follows:
[0008] According to one aspect of the present application, a method for controlling a non-player character is provided, the method comprising:
[0009] Obtain group control logic and individual control logic of multiple NPCs. Group control logic is the control logic corresponding to the NPC group, which includes multiple NPCs.
[0010] In response to an influencing factor between the virtual character and a first NPC in the NPC group, modifying a state parameter corresponding to at least one NPC in the NPC group through group control logic;
[0011] Based on the modified state parameters corresponding to the at least one NPC and the individual control logic of the at least one NPC, the interaction between the at least one NPC and the virtual character is updated.
[0012] According to one aspect of the present application, a control device for a non-player character is provided, the device comprising:
[0013] An acquisition module is used to acquire group control logic and individual control logic of multiple NPCs. The group control logic is the control logic corresponding to the NPC group, and the NPC group includes multiple NPCs.
[0014] a control module, configured to modify a state parameter corresponding to at least one NPC in the NPC group through group control logic in response to an influencing factor between the virtual character and a first NPC in the NPC group;
[0015] The updating module is used to update the interaction between the at least one NPC and the virtual character based on the modified state parameters corresponding to the at least one NPC and the individual control logic of the at least one NPC.
[0016] According to another aspect of the present application, a computer device is provided, comprising: a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the control method of the non-player character as described above.
[0017] According to another aspect of the present application, a computer storage medium is provided, wherein the computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the control method of the non-player character as described above.
[0018] According to another aspect of the present application, a computer program product is provided, which includes a computer program stored in a computer-readable storage medium; the computer program is read and executed from the computer-readable storage medium by a processor of a computer device, so that the computer device executes the control method of a non-player character as described above.
[0019] The beneficial effects of the technical solution provided by this application include at least:
[0020] This application will use the group control logic to modify the state parameters of the NPCs in the group, and then the individual control logic of each NPC will combine its own state parameters to update the interaction between the NPC and the virtual character. This application provides an NPC communication solution based on state parameters. The NPC group and the NPC individual communicate through state parameters. The NPC's behavior control logic is mainly located in the individual control logic. Only the switching of state parameters is executed by the group control logic, making the NPC's behavior control logic more systematic. This application also supports customizing the behavior of NPCs under different states (state parameters). The individual control logic of each NPC can be customized according to demand, making the interactive activities between NPCs and virtual characters richer and more realistic. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] FIG1 is a schematic diagram of a method for controlling a non-player character provided by an exemplary embodiment of the present application;
[0022] FIG2 is a schematic diagram of the architecture of a computer system provided by an exemplary embodiment of the present application;
[0023] FIG3 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application;
[0024] FIG4 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application;
[0025] FIG5 is a schematic diagram illustrating the association between individual control logic and group control logic provided by an exemplary embodiment of the present application;
[0026] FIG6 is a schematic diagram of an interactive operation between a virtual character and an NPC provided by an exemplary embodiment of the present application;
[0027] FIG7 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application;
[0028] FIG8 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application;
[0029] FIG9 is a schematic diagram of an interactive operation between a virtual character and an NPC provided by an exemplary embodiment of the present application;
[0030] FIG10 is a flow chart of a method for controlling an NPC provided by an exemplary embodiment of the present application;
[0031] FIG11 is a flow chart of a method for controlling an individual NPC provided by an exemplary embodiment of the present application;
[0032] FIG12 is a flow chart of a method for controlling an NPC provided by an exemplary embodiment of the present application;
[0033] FIG13 is a flow chart of a method for controlling an NPC provided by an exemplary embodiment of the present application;
[0034] FIG14 is a block diagram of a control device for a non-player character provided by an exemplary embodiment of the present application;
[0035] FIG15 is a schematic structural diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0036] First, the nouns involved in the embodiments of this application are introduced:
[0037] A virtual environment is a virtual environment displayed (or provided) when an application is running on a terminal. This virtual environment can be a simulation of the real world, a semi-simulated and semi-imaginary environment, or a purely imaginary environment. This application does not limit this to any of the following: a two-dimensional virtual environment, a 2.5-dimensional virtual environment, or a three-dimensional virtual environment. The following embodiments illustrate a three-dimensional virtual environment.
[0038] Virtual character: refers to a movable character in a virtual environment. The movable character can be a virtual person, virtual animal, cartoon character, etc. For example, people, animals, plants, walls, stones, pools, etc. displayed in a virtual environment. The virtual character is controlled by the user. The virtual character can be classified according to work, such as pharmacist, magician, medical practitioner, etc.; it can also be classified by category, such as human, beast, fairy, etc. Each virtual character has its own shape and volume in the virtual environment and occupies a part of the space in the virtual environment.
[0039] Multiplayer online games (MMOGs) are games whose servers can support a large number of players online simultaneously. These games are also known as massively multiplayer online role-playing games (MMORPGs). These games provide users with a virtual world where they can create avatars and control them to perform activities and complete tasks. Multiple avatars can team up to complete the same task or compete against other teams.
[0040] Non-Player Characters (NPCs): These are virtual characters in the game that are not controlled by the user. NPCs are virtual characters with their own unique behavioral patterns. NPC types include story NPCs, combat NPCs, and service NPCs. Story NPCs provide storylines or information to the user-controlled virtual character. When the user-controlled virtual character performs a task in the game, the task is accompanied by a corresponding storyline. Optionally, based on the user's interaction or actions with the story NPC, the NPC can provide different feedback, such as dropping virtual items, providing prompts, or issuing new tasks. Combat NPCs are NPCs that can fight with the user-controlled virtual character. They can be members of the same team as the user-controlled virtual character, or they can be NPCs that the user-controlled virtual character needs to attack (i.e., enemy NPCs). Service NPCs provide services to the user-controlled virtual character. For example, service NPCs can be virtual merchants or mentors in the virtual environment. These NPCs can perform fixed actions or publish fixed information. The user-controlled virtual character receives the service NPC's services and obtains corresponding information, items, experience points, etc.
[0041] An embodiment of the present application provides a schematic diagram of a method for controlling a non-player character, as shown in FIG1 . The method can be executed by a computer device, which can be a terminal or a server.
[0042] For example, as shown in part (a) of FIG1 , a game interface is displayed on the user interface, which includes a virtual character 10 and multiple NPCs. The computer device obtains group control logic and the individual control logic of each of the multiple NPCs. The group control logic is the control logic corresponding to the NPC group, which includes multiple NPCs. The control logic refers to the code logic that controls the actions of the NPCs. In response to the interactive operation between the virtual character 10 and the first NPC in the NPC group, the computer device modifies the state parameters corresponding to at least one NPC in the NPC group through the group control logic. Based on the modified state parameters corresponding to the at least one NPC and the individual control logic of the at least one NPC, the computer device updates the interaction between the at least one NPC and the virtual character.
[0043] The NPC has a specific image. The NPC can be a human image, an animal image, a mythical beast or fairy image, or a natural landscape image, or an artificial landscape image, but is not limited thereto and is not specifically limited in this embodiment of the application. Multiple NPCs belong to the same NPC group.
[0044] Optionally, the interactive operation includes at least one of normal attack, defense, releasing a big move, typing chat, voice chat, and giving gifts, but is not limited to these. The embodiment of the present application does not make specific limitations on this.
[0045] The state parameter is used to indicate the state of the NPC in the virtual environment. Optionally, the state parameter includes a parameter for describing at least one of an active state and an idle state, but is not limited thereto and is not specifically limited in this embodiment of the present application.
[0046] In some embodiments, an active state refers to a state in which the NPC can actively interact with the virtual character 10. For example, the NPC can actively attack the virtual character 10. An idle state refers to a state in which the NPC cannot actively interact with the virtual character 10. For example, the NPC walks past the virtual character 10 without interacting with the virtual character.
[0047] In some embodiments, the active state refers to the state in which the NPC interacts with the virtual character 10 by unleashing powerful skills. For example, the NPC can attack the virtual character 10 by unleashing powerful skills. Powerful skills are skills with higher attack values and a wider attack range. The idle state refers to the state in which the NPC interacts with the virtual character 10 by unleashing normal attack skills.
[0048] Optionally, taking the state of the NPC during a fight as an example, the activation state includes the attacked state and the attack state. The attacked state refers to the state when the NPC is subjected to a big move skill released by the virtual character; the attack state refers to the state when the NPC releases a big move skill to the virtual character.
[0049] Exemplarily, in response to the virtual character 10 and the first NPC entering into an interactive scenario, the computer device modifies the initial state parameters corresponding to at least one NPC in the NPC group through the group control logic.
[0050] The initial status parameters refer to the default status parameters of NPCs in the NPC group at the beginning of the game.
[0051] For example, as shown in part (a) of Figure 1, multiple NPCs include NPC 1, NPC 2 and NPC 3. NPC 1, NPC 2 and NPC 3 belong to the same NPC group. The default state of NPC 1, NPC 2 and NPC 3 at the beginning of the game is idle, that is, NPC 1, NPC 2 and NPC 3 will not actively attack the virtual character 10.
[0052] For example, when the virtual character 10 attacks the first NPC or the virtual character enters the field of view of the first NPC, the computer device modifies the initial state parameters corresponding to at least one NPC in the NPC group through the group control logic.
[0053] The field of view range refers to a sector-shaped range centered at the NPC's location, or a circular range centered at the NPC's location, or a regular pattern range centered at the NPC's location, or an irregular pattern range centered at the NPC's location, but is not limited thereto and is not specifically limited in the embodiments of this application. The size of the field of view range is not specifically limited.
[0054] As shown in part (b) of Figure 1, when the virtual character 10 enters the field of view of NPC 2, the computer device modifies the initial state parameters corresponding to NPC 1, NPC 2 and NPC 3 through the group control logic, changes NPC 2 from the idle state to the activated state, and keeps NPC 1 and NPC 3 in the idle state. Then, the computer device updates the interaction between NPC 1, NPC 2 and NPC 3 and the virtual character 10 based on the state parameters corresponding to NPC 1, NPC 2 and NPC 3 and their respective individual control logics, that is, NPC 2 actively attacks the virtual character 10, and NPC 1 and NPC 3 walk away.
[0055] In some embodiments, in response to the duration of the interaction between the virtual character 10 and the first NPC reaching a time threshold, the computer device changes the state parameter of the first NPC from an active state to an idle state and changes the state parameter of the second NPC from an idle state to an active state through the group control logic.
[0056] For example, the NPCs in the NPC group include NPC one, NPC two and NPC three. When the fighting time between the virtual character 10 and NPC two reaches 20 seconds, the computer device modifies the status parameters of NPC one, NPC two and NPC three through the group control logic. For example, the status parameters of NPC two are modified from the active state to the idle state, and the status parameters of NPC one and NPC three are modified from the idle state to the active state. That is, after the attack time between the virtual character 10 and NPC two reaches 20 seconds, NPC two no longer continues to fight with the virtual character 10, NPC two moves away from the virtual character 10, and NPC one and NPC three start to fight with the virtual character 10.
[0057] In some embodiments, in response to the sum of the operation points of the interactive operations between the first NPC and the virtual character 10 reaching a point threshold, the computer device modifies the state parameters of the first NPC from an active state to an idle state and the state parameters of the second NPC from an idle state to an active state through the group control logic.
[0058] For example, the NPCs in the NPC group include NPC one, NPC two and NPC three. During the fight between the virtual character 10 and NPC one, NPC one increases 5 points each time it releases a big move. When the points reach 15 points, the computer device modifies the status parameters of NPC one, NPC two and NPC three through the group control logic. For example, the status parameters of NPC one are changed from active state to idle state, and the status parameters of NPC two and NPC three are changed from idle state to active state. That is, during the fight between the virtual character 10 and NPC one, after NPC one releases three big moves, NPC one does not continue to fight with the virtual character 10, NPC one moves away from the virtual character 10, and NPC two and NPC three start fighting with the virtual character 10.
[0059] In some embodiments, the association relationship between the first NPC and the third NPC in the NPC group is obtained; when the first NPC and the third NPC have a positive relationship, the state parameters of the first NPC and the third NPC are modified to a consistent state through the group control logic; when the first NPC and the third NPC have a negative relationship, the state parameters of the first NPC and the third NPC are modified to opposite states through the group control logic.
[0060] A positive relationship is one in which at least two NPCs in the same NPC group move in the same direction. In short, a positive relationship is one in which the NPCs move in the same direction.
[0061] Negative relationships are relationships that cause at least two NPCs in the same NPC group to act in opposite directions. In short, negative relationships are relationships where NPCs act in opposite directions.
[0062] For example, a plurality of NPCs in an NPC group include NPC 1, NPC 2, and NPC 3. NPC 1 and NPC 2 have an active relationship, while NPC 2 and NPC 3 have a negative relationship. Assume that NPC 1, NPC 2, and NPC 3 are all in an active state. When virtual character 10 fights NPC 2, the computer device modifies the state parameters of NPC 1, NPC 2, and NPC 3 through group control logic. Because NPC 1 and NPC 2 have an active relationship, NPC 1's state is maintained in an active state, and NPC 1 also joins the fight between virtual character 10 and NPC 2. Because NPC 2 and NPC 3 have a negative relationship, NPC 3's state is modified to an idle state, and NPC 3 moves away from the fight scene.
[0063] In summary, this application uses the group control logic to modify the state parameters of the NPCs within the group, and then the individual control logic of each NPC combines its own state parameters to update the interaction with the virtual character. This application provides an NPC communication solution based on state parameters. The NPC group and the NPC individual communicate through state parameters. The NPC's behavior control logic is mainly located in the individual control logic. Only the switching of state parameters is executed by the group control logic, making the NPC's behavior control logic more systematic. This application also supports customizing the behavior of NPCs under different states (state parameters). The individual control logic of each NPC can be customized according to demand, making the interactive activities between NPCs and virtual characters richer and more realistic.
[0064] 2 shows a block diagram of a computer system according to an exemplary embodiment of the present application. The computer system 100 includes a first terminal 110 , a server 120 , and a second terminal 130 .
[0065] The first terminal 110 has a client 111 installed and running that supports a virtual environment. The client 111 can be a multiplayer online battle program. When the first terminal runs the client 111, the user interface of the client 111 is displayed on the screen of the first terminal 110. The client 111 can be any of an MMOG, a battle royale shooting game, a virtual reality (VR) application, an augmented reality (AR) program, a three-dimensional map program, a virtual reality game, an augmented reality game, a first-person shooter (FPS), a third-person shooter (TPS), a multiplayer online tactical competitive game (MOBA), or a simulation game (SLG). In this embodiment, the client 111 is an MMOG game for example. First terminal 110 is used by first user 112. First user 112 uses first terminal 110 to control a first virtual character in a virtual environment to perform activities, or to manipulate virtual items owned by a second virtual character. The first virtual character may be referred to as the virtual character of first user 112. First user 112 may assemble, disassemble, and uninstall virtual items owned by the first virtual character, although this application does not limit this. Illustratively, the first virtual character is a first virtual character, such as a simulated human character or an animated character.
[0066] The second terminal 130 has a client 131 installed and running that supports a virtual environment. The client 131 can be a multiplayer online battle program. When the second terminal 130 runs the client 131, the user interface of the client 131 is displayed on the screen of the second terminal 130. The client can be any of an MMOG, a battle royale shooting game, a VR application, an AR program, a three-dimensional map program, a virtual reality game, an augmented reality game, an FPS, a TPS, a MOBA, and a SLG. In this embodiment, the client is an MMOG game as an example. The second terminal 130 is the terminal used by the second user 113. The second user 113 uses the second terminal 130 to control a second virtual character in the virtual environment to perform activities and operate the virtual items owned by the second virtual character. The second virtual character can be referred to as the virtual character of the second user 113. Schematically, the second virtual character is a second virtual character, such as a simulated human character or an anime character.
[0067] 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 camp, the same team, the same organization, have a friendship relationship, or have temporary communication permissions. Optionally, the first virtual character and the second virtual character may belong to different camps, different teams, different organizations, or have a hostile relationship.
[0068] Optionally, the client installed on the first terminal 110 and the second terminal 130 is the same, or the client installed on the two terminals is the same type of client on different operating system platforms (Android or iOS). The first terminal 110 can generally refer to one of multiple terminals, and the second terminal 130 can generally refer to another of the multiple terminals. This embodiment only uses the first terminal 110 and the second terminal 130 as an example. The first terminal 110 and the second terminal 130 can be of the same or different device types, including at least one of a smartphone, a tablet computer, an e-book reader, an MP3 player, an MP4 player, a laptop computer, and a desktop computer.
[0069] FIG2 shows only two terminals, but in different embodiments, multiple other terminals 140 may be connected to the server 120. Optionally, one or more terminals 140 may be terminals corresponding to developers, and a client development and editing platform supporting a virtual environment may be installed on the terminal 140. The developer may edit and update the client on the terminal 140 and transmit the updated client installation package to the server 120 via a wired or wireless network. The first terminal 110 and the second terminal 130 may then download the client installation package from the server 120 to update the client.
[0070] The first terminal 110 , the second terminal 130 , and the other terminals 140 are connected to the server 120 via a wireless network or a wired network.
[0071] Server 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 120 provides backend services for clients supporting a 3D virtual environment. Optionally, server 120 performs primary computing tasks, while the client performs secondary computing tasks; alternatively, server 120 performs secondary computing tasks, while the client performs primary computing tasks; alternatively, server 120 and the client utilize a distributed computing architecture for collaborative computing.
[0072] In an illustrative example, the server 120 includes a processor 122, a user account database 123, a battle service module 124, and a user-facing input / output interface (I / O interface) 125. The processor 122 is configured to load instructions stored in the server 120 and process data in the user account database 123 and the battle service module 124. The user account database 123 is configured to store user account data used by the first terminal 110, the second terminal 130, and other terminals 140, such as user account avatars, user account nicknames, user account combat power indexes, and the service areas where the user accounts are located. The battle service module 124 is configured to provide multiple battle rooms for users to engage in battles, such as 1v1 battles, 3v3 battles, 5v5 battles, etc. The user-facing I / O interface 125 is configured to establish communication and exchange data with the first terminal 110 and / or the second terminal 130 via a wireless network or a wired network.
[0073] FIG3 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0074] Step 302: Obtain group control logic and individual control logic of multiple NPCs.
[0075] Group control logic is the control logic for NPC groups. NPC groups include multiple NPCs, and multiple NPCs belong to the same NPC group. Control logic refers to the code logic that controls NPC actions. Individual control logic refers to the code logic that controls the activities of a single NPC. Group control logic refers to the code logic that controls the activities of multiple NPCs.
[0076] Optionally, the NPC has a specific image, or the NPC does not have a specific image.
[0077] Taking the example of an NPC not having a specific image, the NPC can talk to the virtual character, give gifts or ask questions through a dialog box, but is not limited to this. The embodiments of the present application do not make specific limitations on this.
[0078] Taking the NPC having a specific image as an example, the NPC can be an NPC with a human image, or an NPC with an animal image, or an NPC with an image of a mythical beast or fairy, or an NPC with an image of a natural landscape, or an NPC with an image of an artificial landscape, but is not limited to this, and the embodiments of this application do not make specific limitations on this.
[0079] Step 304: In response to the influencing factors between the virtual character and the first NPC in the NPC group, modify the state parameters corresponding to at least one NPC in the NPC group through the group control logic.
[0080] Influencing factors refer to factors that can trigger the modification of at least one NPC's status parameters, such as the interaction between the NPC and the virtual character, the NPC's unilateral actions on the virtual character (such as the NPC detecting the virtual character), etc.
[0081] The state parameter is used to indicate the state of the NPC in the virtual environment. Optionally, the state parameter includes a parameter for indicating at least one of an active state and an idle state, but is not limited thereto and is not specifically limited in this embodiment of the present application.
[0082] An active state refers to a state where an NPC can actively interact with a virtual character. For example, an NPC can actively attack a virtual character. An idle state refers to a state where an NPC cannot actively interact with a virtual character. For example, an NPC can walk past a virtual character without interacting with them.
[0083] In one embodiment, the state parameter may also be a parameter of another customized state, for example, a customized variable A for "whether the NPC is in a fighting state" may be set. When the value of variable A is 0, it indicates that the NPC is not in a fighting state, and when the value of variable A is 1, it indicates that the NPC is in a fighting state. For example, a customized variable B for "whether the NPC is in an idle state" may be set. When the value of variable B is 0, it indicates that the NPC is not in an idle state, and when the value of variable A is 1, it indicates that the NPC is in an idle state.
[0084] In the following, the state parameters will be mainly used as examples of parameters of major categories of states such as "activated state" and "idle state". In fact, the state parameters can also be more specifically set as parameters of minor categories of states, and this application does not limit this.
[0085] In one embodiment, the influencing factors between the virtual character and the first NPC are detected through the individual control logic of the first NPC. If the influencing factors meet the conditions, the group state parameters (group state variables) are modified through the individual control logic of the first NPC. After the group control logic detects that the group state parameters are modified, the group control logic modifies the individual state parameters of at least one NPC in the NPC group.
[0086] Step 306: Based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC, update the interaction between the at least one NPC and the virtual character.
[0087] For example, for an NPC, after obtaining its own modified state parameters, it controls itself to interact with the virtual character in combination with its own individual control logic.
[0088] In summary, this application will use the group control logic to modify the state parameters of the NPCs within the group, and then the individual control logic of each NPC will combine its own state parameters to update the interaction with the virtual character. This application provides an NPC communication solution based on state parameters. The NPC group and the NPC individual communicate through state parameters. The NPC's behavior control logic is mainly located in the individual control logic, and only the switching of state parameters is executed by the group control logic, making the NPC's behavior control logic more systematic. This application also supports customizing the behavior of NPCs under different states (state parameters). The individual control logic of each NPC can be customized according to demand, making the interactive activities between NPCs and virtual characters richer and more realistic.
[0089] FIG4 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0090] Step 402: Obtain group control logic and individual control logic of multiple NPCs.
[0091] Group control logic is the control logic for NPC groups. NPC groups include multiple NPCs, and multiple NPCs belong to the same NPC group. Control logic refers to the code logic that controls NPC actions. Individual control logic refers to the code logic that controls the activities of a single NPC. Group control logic refers to the code logic that controls the activities of multiple NPCs.
[0092] Step 404: In response to the interaction between the virtual character and the first NPC in the NPC group satisfying the trigger condition, modify the state parameter corresponding to at least one NPC in the NPC group through the group control logic.
[0093] The interaction includes at least one of normal attack, defense, releasing a big move, typing chat, voice chat, and giving gifts, but is not limited to these. The embodiment of the present application does not make specific limitations on this.
[0094] The state parameter is used to indicate the state of the NPC in the virtual environment. Optionally, the state parameter includes a parameter for indicating at least one of an active state and an idle state, but is not limited thereto and is not specifically limited in this embodiment of the present application.
[0095] An active state refers to a state where an NPC can actively interact with a virtual character. For example, an NPC can actively attack a virtual character. An idle state refers to a state where an NPC cannot actively interact with a virtual character. For example, an NPC can walk past a virtual character without interacting with them.
[0096] Exemplarily, the triggering condition includes at least one of the following, but is not limited thereto:
[0097] The duration of the interaction between the avatar and the first NPC reaches the time threshold;
[0098] The interactive operation points between the first NPC and the virtual character reach the threshold;
[0099] The interaction event between the virtual character and the first NPC complies with the predefined interaction event;
[0100] The avatar does not interact with the first active NPC, but actively interacts with the second idle NPC in the NPC group.
[0101] For example, as shown in Figure 5, when the virtual character and the NPC enter an interactive scene, the individual control logic 501 detects the interaction between the NPC and the virtual character in real time. When the interaction between the NPC and the virtual character meets the trigger condition, the individual control logic 501 notifies the group control logic 502 to modify the status parameters corresponding to at least one NPC in the NPC group. When modifying the status parameters of at least one NPC in the NPC group, the group control logic 502 may modify the status parameters according to the priority (activation priority) order of the NPC. Factors affecting the priority of the NPC include: at least one of the specified status parameters, the level of the NPC, the distance between the NPC and the virtual character, and the angle between the NPC and the virtual character, but are not limited to these.
[0102] For example, if the user does not specify the activation order of the NPCs, modifications are made in sequence according to the NPC levels; if the NPC levels are the same, modifications are made in sequence according to the distance between the NPC and the virtual character; if the NPC levels are the same and the distance between the NPC and the virtual character is the same, modifications are made in sequence according to the angle between the NPC and the virtual character.
[0103] In some embodiments, when modifying the status parameters of at least one NPC in an NPC group, group control logic 502 may modify the parameters based on a preconfigured activation number. For example, if the preconfigured activation number is infinite, then as many NPCs as possible in the NPC group will be activated, without determining activation priority. For example, if the preconfigured activation number is three, then three NPCs will be activated from the NPC group according to activation priority.
[0104] Optionally, if the number of NPCs that can be activated in the NPC group is less than the pre-configured activation number, the NPCs in the NPC group will be activated as much as possible. In this case, there is no need to judge according to the activation priority order.
[0105] In some embodiments, in response to the duration of the interaction between the virtual character and the first NPC reaching a time threshold, the computer device modifies a status parameter corresponding to at least one NPC in the NPC group through group control logic.
[0106] In response to the duration of the interaction between the virtual character and the first NPC reaching a time threshold, the computer device changes the state parameter of the first NPC from an active state to an idle state through the group control logic, and changes the state parameter of the second NPC in the NPC group from an idle state to an active state.
[0107] As shown in FIG6 , a schematic diagram of the interaction between a virtual character and an NPC is shown in FIG6 (a), as shown in FIG6 (a), NPC 1 603, NPC 2 602 and NPC 3 604, NPC 1 603, NPC 2 602 and NPC 3 604 all belong to the NPC group. The time threshold is set to 20s. When the fighting time between the virtual character 601 and NPC 2 602 reaches 20s, the computer device modifies the state parameters of NPC 1 603, NPC 2 602 and NPC 3 604 through the group control logic. For example, the state parameter of NPC 2 602 is changed from active to idle, and the state parameter of NPC 1 603, NPC 2 602 is changed from active to idle. The state parameters of NPC 1 603 are changed from idle state to active state, and the state parameters of NPC 3 604 are kept in idle state. That is, after the attack duration between the virtual character 601 and NPC 2 602 reaches 20s, as shown in part (b) of Figure 6, NPC 2 602 no longer continues to fight with the virtual character 601, NPC 2 602 moves away from the virtual character 601, and NPC 1 603 starts to fight with the virtual character 601. The duration in the figure is the interaction duration between the virtual character 601 and the NPC. The duration in the figure can be visible or invisible, and this embodiment of the application does not specifically limit this.
[0108] In some embodiments, in response to the operation score of the interactive operation between the first NPC and the virtual character reaching a score threshold, the computer device modifies a state parameter corresponding to at least one NPC in the NPC group through group control logic.
[0109] Operation points refer to the points corresponding to each operation performed by the first NPC during the interaction with the virtual character, as shown in Table 1.
[0110] Table 1 Operation points correspondence table
[0111] In Table 1, it is assumed that the NPC's score threshold is 20. When the NPC is in an active state and uses skill A, if it effectively hits the virtual character, it will increase by 5 points. As time passes, the score increases by 1 point per second. When the total operation score reaches 20, the NPC changes from an active state to an idle state. After the state is switched, the score decreases by 5 points. After that, in the idle state, the score decreases by 2 points per second as time passes until it reaches 0.
[0112] The computer device obtains an operation score correspondence table corresponding to the interactive operation. In response to the sum of the operation scores of the interactive operation between the first NPC and the virtual character reaching a score threshold, the computer device modifies the state parameter of the first NPC from an activated state to an idle state and modifies the state parameter of the second NPC from an idle state to an activated state through the group control logic.
[0113] For example, the NPCs in the NPC group include NPC one, NPC two and NPC three. During the fight between the virtual character and NPC one, NPC one increases 5 points each time it releases a big move. When the total score reaches 15 points, the computer device modifies the status parameters of NPC one, NPC two and NPC three through the group control logic. For example, the status parameters of NPC one are changed from active state to idle state, and the status parameters of NPC two and NPC three are changed from idle state to active state. That is, during the fight between the virtual character and NPC one, after NPC one releases three big moves, NPC one does not continue to fight with the virtual character, NPC one moves away from the virtual character, and NPC two and NPC three start fighting with the virtual character.
[0114] In some embodiments, in response to the operation score of the interactive operation between the first NPC and the virtual character not reaching the score threshold, the computer device determines that the interaction event between the virtual character and the first NPC meets the predefined interaction event, and modifies the state parameter of the first NPC from the idle state to the activated state through the group control logic.
[0115] For example, predefined interaction events include:
[0116] 1. A virtual character attacks an NPC;
[0117] 2. NPC attacks hit monsters;
[0118] 3. The avatar is at a certain distance and angle from the NPC.
[0119] For example, when the interaction event between the first NPC and the virtual character is "the virtual character attacks the first NPC", the computer device determines that the interaction event between the virtual character and the first NPC meets the predefined interaction event, and the computer device modifies the state parameter of the first NPC from the idle state to the activated state through the group control logic.
[0120] For example, when the interaction event between the first NPC and the virtual character is "the distance between the virtual character and the first NPC is less than 100m", the computer device determines that the interaction event between the virtual character and the first NPC meets the predefined interaction event, and the computer device modifies the status parameter of the first NPC from idle state to active state through group control logic.
[0121] In some embodiments, when the virtual character does not interact with a first NPC in an activated state but interacts with a second NPC in an idle state in an NPC group, the computer device modifies the state parameters of the first NPC from an activated state to an idle state and the state parameters of the second NPC from an idle state to an activated state through the group control logic.
[0122] For example, when a virtual character is interacting with a first NPC in an activated state, when the virtual character actively interacts with a second NPC in an idle state, the state parameters of the first NPC are modified from an activated state to an idle state, and the state parameters of the second NPC are modified from an idle state to an activated state through the group control logic.
[0123] For example, the first NPC and the second NPC are in the same NPC team. The first NPC is in an active state and is fighting with the virtual character, while the second NPC is in an idle state and is pacing nearby. When the virtual character actively attacks the second NPC, the computer device changes the state parameters of the first NPC from an active state to an idle state through the group control logic, and changes the state parameters of the second NPC from an idle state to an active state. That is, the second NPC starts to fight with the virtual character, and the first NPC ends the fight and leaves the virtual character.
[0124] In some embodiments, in response to the distance between the virtual character and the first NPC being less than a distance threshold, the computer device modifies a status parameter corresponding to at least one NPC in the NPC group through group control logic.
[0125] For example, the distance threshold is set to 3 meters. When the distance between the virtual character and the first NPC is less than 3 meters, the virtual character and the NPC enter an interactive scenario, and the status parameters corresponding to at least one NPC in the NPC group are modified through the group control logic. For example, the status parameters of the first NPC are modified to the activated state, and the first NPC releases a big move skill to the virtual character, while the other NPCs in the NPC group remain idle, and the other NPCs each leave the fighting area between the first NPC and the virtual character.
[0126] In some embodiments, in response to the virtual character and the first NPC being in the same location area, the computer device modifies a status parameter corresponding to at least one NPC in the NPC group through group control logic.
[0127] Optionally, the same location area includes at least one of the same floor, the same car, the same cave, and the same combat zone, but is not limited thereto, and the embodiments of the present application do not make specific limitations on this.
[0128] For example, taking the same location area as the same floor as an example, when the virtual character and the first NPC are on the same floor, the virtual character and the NPC enter an interactive scenario, and the status parameters corresponding to at least one NPC in the NPC group are modified through the group control logic. For example, the status parameters of the first NPC are modified to an activated state, the first NPC actively attacks the virtual character, or the first NPC releases a big move skill to the virtual character, while the other NPCs in the NPC group remain idle.
[0129] In some embodiments, in response to the virtual character and the first NPC being in the same location area for a time period reaching a co-location time threshold, the computer device modifies a status parameter corresponding to at least one NPC in the NPC group through group control logic.
[0130] For example, the coexistence time threshold is set to one minute. Taking the same location area as the same floor as an example, when the virtual character and the first NPC are on the same floor for more than one minute, the virtual character and the NPC enter an interactive scenario, and the group control logic is used to modify the corresponding status parameters of at least one NPC in the NPC group. For example, the status parameters of the first NPC are modified from an active state to an idle state, and the second NPC in the NPC group is modified from an idle state to an active state. The second NPC actively attacks the virtual character, or the second NPC releases a big move skill to the virtual character.
[0131] Step 406: Based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC, update the interaction between the at least one NPC and the virtual character.
[0132] For example, for an NPC, after obtaining its own modified state parameters, it controls itself to interact with the virtual character in combination with its own individual control logic.
[0133] In summary, the method provided in this embodiment detects the operation duration, operation points, and whether the preset interaction events are met for the interactive operation between the virtual character and the first NPC, and triggers the group control logic to modify the state parameters corresponding to at least one NPC in the NPC group where the first NPC is located through different triggering methods. The individual control logic of each NPC then combines its own state parameters to update the interaction status with the virtual character. This application provides an NPC communication solution based on state parameters. When an individual NPC detects that a condition has been met, it notifies the NPC group to modify the individual NPC's state parameters. Each individual NPC then combines its own individual control logic and the modified state parameters to update the interactive operation with the virtual character, making the NPC's behavior control logic more systematic.
[0134] FIG7 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0135] Step 702: Obtain group control logic and individual control logic of multiple NPCs.
[0136] Group control logic is the control logic for NPC groups. NPC groups include multiple NPCs, and multiple NPCs belong to the same NPC group. Control logic refers to the code logic that controls NPC actions. Individual control logic refers to the code logic that controls the activities of a single NPC. Group control logic refers to the code logic that controls the activities of multiple NPCs.
[0137] Step 704: In response to the virtual character and the first NPC entering into an interactive scenario, modifying the initial state parameters corresponding to at least one NPC in the NPC group through the group control logic.
[0138] In some embodiments, NPCs in an NPC group all have corresponding default status parameters at the beginning of the game. For example, the NPCs in the NPC group are dispersed in different locations, NPCs in an activated state can actively attack virtual characters, and NPCs in an idle state are in a wandering state.
[0139] The initial status parameters refer to the default status parameters of NPCs in the NPC group at the beginning of the game.
[0140] For example, NPCs include NPC 1, NPC 2, and NPC 3, and NPC 1, NPC 2, and NPC 3 belong to the same NPC group. At the beginning of a game, NPC 1, NPC 2, and NPC 3 are in an idle state by default, meaning that NPC 1, NPC 2, and NPC 3 do not actively attack the virtual character. Exemplarily, in response to the virtual character attacking the first NPC, the computer device modifies the initial state parameters corresponding to at least one NPC in the NPC group through group control logic.
[0141] In some embodiments, in response to the virtual character entering the field of view of the first NPC, the computer device modifies the initial state parameters corresponding to at least one NPC in the NPC group through the group control logic.
[0142] The field of view refers to the frontal visible range centered on the NPC. For example, it can include a sector-shaped range centered at the NPC's location, a circle-centered range centered at the NPC's location, a ring-shaped range centered at the NPC's location, a regular pattern range centered at the NPC's location, or an irregular pattern range centered at the NPC's location, but is not limited to these and is not specifically limited in this embodiment of the application. The size of the field of view is not specifically limited.
[0143] For example, when the virtual character enters the field of view of NPC Two, the computer device modifies the initial state parameters corresponding to NPC One, NPC Two and NPC Three through the group control logic, changes NPC Two from an idle state to an activated state, and keeps NPC One and NPC Three in an idle state. Then, the computer device updates the interaction between NPC One, NPC Two and NPC Three and the virtual character based on the state parameters corresponding to NPC One, NPC Two and NPC Three and their respective individual control logics, that is, NPC Two actively attacks the virtual character, and NPC One and NPC Three walk away.
[0144] In some embodiments, an NPC carries a blind spot detection item that detects virtual characters within the NPC's blind spot. In response to a virtual character entering the blind spot of a first NPC, the computer device modifies the initial state parameters corresponding to at least one NPC in the NPC group through group control logic. The blind spot refers to the rear-facing, non-visible area centered on the NPC.
[0145] Step 706: Based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC, update the interaction between the at least one NPC and the virtual character.
[0146] For example, for an NPC, after obtaining its own modified state parameters, it controls itself to interact with the virtual character in combination with its own individual control logic.
[0147] In summary, the method provided in this embodiment detects whether a virtual character attacks an NPC or enters its field of view, thereby triggering the group control logic to modify the initial state parameters corresponding to at least one NPC in the NPC group to which the first NPC belongs. The individual control logic of each NPC then updates its interaction with the virtual character based on its own modified initial state parameters. This application provides an NPC communication solution based on state parameters, further systematizing the NPC's behavior control logic.
[0148] FIG8 is a flow chart of a method for controlling a non-player character provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0149] Step 802: Obtain group control logic and individual control logic of multiple NPCs.
[0150] Group control logic is the control logic for NPC groups. NPC groups include multiple NPCs, and multiple NPCs belong to the same NPC group. Control logic refers to the code logic that controls NPC actions. Individual control logic refers to the code logic that controls the activities of a single NPC. Group control logic refers to the code logic that controls the activities of multiple NPCs.
[0151] Step 804: Obtain the association relationship between the first NPC and the third NPC in the NPC group; modify the state parameter corresponding to the third NPC through the group control logic according to the association relationship between the first NPC and the third NPC.
[0152] Optionally, the association relationship includes at least one of a positive relationship and a negative relationship, but is not limited thereto, and the embodiments of the present application do not make specific limitations on this.
[0153] A positive relationship is one that aligns the actions of at least two NPCs in the same NPC group. For example, a positive relationship includes at least one of a romantic relationship, a close friend relationship, a playmate relationship, and a mentor-apprentice relationship, but is not limited thereto. This embodiment of the present application does not specifically limit this.
[0154] A negative relationship refers to a relationship that causes at least two NPCs in the same NPC group to move in opposite directions. For example, a negative relationship includes at least one of a hostile relationship and a relationship with different attributes, but is not limited thereto. This embodiment of the application does not specifically limit this.
[0155] When the first NPC and the third NPC have a positive relationship, the state parameters of the first NPC and the third NPC are modified to a consistent state through the group control logic; when the first NPC and the third NPC have a negative relationship, the state parameters of the first NPC and the third NPC are modified to an opposite state through the group control logic.
[0156] For example, as shown in FIG9 , which illustrates a schematic diagram of virtual character and NPC interaction, the NPCs in the NPC group include NPC 1 902, NPC 2 903, and NPC 3 904. NPC 1 902 and NPC 2 903 have an active relationship, while NPC 2 903 and NPC 3 904 have a negative relationship. Assuming that NPC 1 902, NPC 2 903, and NPC 3 904 are all in an active state, when virtual character 901 fights NPC 2 903, the computer device, through group control logic, modifies the state parameters of NPC 1 902, NPC 2 903, and NPC 3 904. Because NPC 1 902 and NPC 2 903 have an active relationship, NPC 1 902 remains in an active state, and NPC 1 902 joins the fight between virtual character 901 and NPC 2 903. Because NPC 2 903 and NPC 3 904 have a negative relationship, NPC 3 904 is modified to an idle state, and NPC 3 904 moves away from the fight.
[0157] In some embodiments, the computer device obtains an association relationship between a first NPC and a third NPC in an NPC group; and modifies a behavior parameter corresponding to the third NPC through group control logic according to the association relationship between the first NPC and the third NPC.
[0158] When the first NPC and the third NPC are in a positive relationship, the behavioral parameters of the first NPC and the third NPC are modified to a consistent state through the group control logic, that is, the first NPC and the third NPC can perform a certain behavior at the same time. For example, when the first NPC performs an attack behavior, the third NPC can also perform an attack behavior; when the first NPC and the third NPC are in a negative relationship, the behavioral parameters of the first NPC and the third NPC are modified to an opposite state through the group control logic, that is, the first NPC and the third NPC cannot perform a certain behavior at the same time. For example, when the first NPC performs an attack behavior, the third NPC cannot perform an attack behavior.
[0159] Step 806: Based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC, update the interaction between the at least one NPC and the virtual character.
[0160] For example, for an NPC, after obtaining its own modified state parameters, it controls itself to interact with the virtual character in combination with its own individual control logic.
[0161] In summary, the method provided in this embodiment obtains the associations between different NPCs in the same group, thereby triggering the group control logic to modify the state parameters of each NPC based on the associations. Each NPC then updates its interaction with the virtual character based on its own individual control logic and its own modified state parameters. This application provides an NPC communication solution based on state parameters, which further systematizes the NPC behavior control logic.
[0162] FIG10 is a flowchart of a method for controlling an NPC provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0163] Step 1001: Start.
[0164] Step 1002: Detect entry into an interactive scenario.
[0165] Exemplarily, the computer device detects whether the virtual character and the NPC enter an interactive scenario.
[0166] Optionally, the way of entering the interactive scenario includes at least one of: the virtual character attacks the first NPC, and the virtual character enters the field of view of the first NPC, but is not limited thereto. The embodiment of the present application does not make specific limitations on this.
[0167] Step 1003: Modify the initial state parameters.
[0168] For example, when the virtual character and the NPC enter into an interactive scenario, the initial state parameters corresponding to at least one NPC in the NPC group are modified through the group control logic.
[0169] For example, when the virtual character enters the field of view of NPC Two, the computer device modifies the initial state parameters corresponding to NPC One, NPC Two and NPC Three through the group control logic, changes NPC Two from an idle state to an activated state, and keeps NPC One and NPC Three in an idle state. Then, the computer device updates the interaction between NPC One, NPC Two and NPC Three and the virtual character based on the state parameters corresponding to NPC One, NPC Two and NPC Three and their respective individual control logics, that is, NPC Two actively attacks the virtual character, and NPC One and NPC Three walk away.
[0170] Step 1004: Set status parameters according to priority.
[0171] Exemplarily, when the group control logic modifies the initial state parameters corresponding to at least one NPC in the NPC group, the group control logic performs the modification according to the priority of the NPC.
[0172] The priority of the NPC includes at least one of: a specified state parameter, a level of the NPC, a distance between the NPC and the virtual character, and an angle between the NPC and the virtual character, but is not limited thereto.
[0173] For example, if the user does not specify the activation order of the NPCs, modifications are made in sequence according to the NPC levels; if the NPC levels are the same, modifications are made in sequence according to the distance between the NPC and the virtual character; if the NPC levels are the same and the distance between the NPC and the virtual character is the same, modifications are made in sequence according to the angle between the NPC and the virtual character.
[0174] Step 1005: Check whether the status parameter is in the active state.
[0175] Exemplarily, after the group control logic modifies the status parameters of the NPCs in the NPC group, it determines whether the status parameters of the first NPC are in the activated state. If the status parameters of the first NPC are in the activated state, execute step 1007; if the status parameters of the first NPC are not in the activated state, execute step 1006.
[0176] Step 1006: Execute other logic.
[0177] In the case where the state parameter of the first NPC is not the active state, other logic is executed, that is, the individual control logic in the inactive state is executed.
[0178] Optionally, other logics include at least one of escape behavior logic, item picking up behavior logic, and pacing behavior logic, but are not limited thereto.
[0179] Step 1007: Execute the individual control logic in the activated state.
[0180] In the case where the state parameter of the first NPC indicates an activated state, the individual control logic in the activated state is executed, that is, the first NPC attacks the virtual character and starts a fight with the virtual character.
[0181] Step 1008: End.
[0182] To sum up, the method provided in this embodiment detects whether the virtual character attacks the NPC or enters the NPC's field of view, thereby triggering the group control logic to modify the initial state parameters corresponding to at least one NPC in the NPC group where the first NPC is located, so that the interactive activities between the NPC and the virtual character are richer and more realistic, and the NPC's behavior is closer to the virtual character controlled by a real user, thereby improving the user experience.
[0183] FIG11 is a flow chart of a method for controlling an individual NPC provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0184] Step 1101: Start.
[0185] Step 1102: Whether the state parameter is in the active state.
[0186] Exemplarily, for an individual NPC, it is determined whether the state parameter of the individual NPC is in an activated state. If the individual NPC is in an activated state, step 1103 is executed; if the individual NPC is in an inactivated state, step 1104 is executed.
[0187] Step 1103: Execute the individual control logic in the activated state.
[0188] Exemplarily, when the individual NPC is in an active state, the individual control logic in the active state is executed, that is, the first NPC attacks the virtual character and starts a fight with the virtual character.
[0189] Step 1104: Whether the state parameter is other state.
[0190] Exemplarily, when the individual NPC is in an inactive state, determine whether the state parameters of the individual NPC are other states. If the state parameters of the individual NPC are other states, execute step 1105; if the state parameters of the individual NPC are not other states, execute step 1106.
[0191] Optionally, other states include at least one of escape behavior logic, item pickup behavior logic, and pacing behavior logic, but are not limited thereto.
[0192] Step 1105: Execute individual control logic in other states.
[0193] For example, when the state parameter of an individual NPC is in another state, the individual NPC is controlled to execute the individual control logic in the other state, for example, controlling the NPC to pick up supplies.
[0194] Step 1106: Execute the individual control logic in the default state.
[0195] For example, when the state parameter of the individual NPC is neither in the activation state nor in any other state, the individual NPC is controlled to execute the individual control logic in the default state.
[0196] Step 1107: End.
[0197] In summary, the method provided in this embodiment changes the behavior of an NPC by changing the state of an individual NPC, making the behavior of the NPC closer to the virtual character controlled by a real user, thereby improving the user experience.
[0198] FIG12 is a flow chart of a method for controlling an NPC provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0199] Step 1201: Start.
[0200] Step 1202: Obtain operation points for interactive operations.
[0201] Operation points refer to the points corresponding to each operation during the interaction between the first NPC and the virtual character.
[0202] Exemplarily, the computer device obtains an operation score correspondence table corresponding to interactive operations, and determines the sum of the operation scores of the interactive operations between the first NPC and the virtual character according to the operation score correspondence table.
[0203] Step 1203: Check whether the operation points have reached the points threshold.
[0204] Exemplarily, the computer device determines whether the sum of the operation points of the interactive operations between the first NPC and the virtual character reaches the point threshold, and executes step 1205 if the sum of the operation points of the interactive operations between the first NPC and the virtual character reaches the point threshold; and executes step 1204 if the sum of the operation points of the interactive operations between the first NPC and the virtual character does not reach the point threshold.
[0205] Step 1204: Whether to perform interactive operations with the NPC in the idle state.
[0206] For example, when the sum of the operation points of the interactive operations between the first NPC and the virtual character does not reach the point threshold, it is determined whether the virtual character performs interactive operations with the NPC in the idle state. If the virtual character performs interactive operations with the NPC in the idle state, step 1205 is executed; if the virtual character does not perform interactive operations with the NPC in the idle state, step 1206 is executed.
[0207] Step 1205: Modify the status parameters corresponding to at least one NPC through the group control logic.
[0208] For example, when the sum of the operation points of the interactive operations between the first NPC and the virtual character reaches the point threshold, the state parameters of the first NPC are modified from the active state to the idle state, and the state parameters of the second NPC are modified from the idle state to the active state through the group control logic.
[0209] For example, the NPCs in the NPC group include NPC one, NPC two and NPC three. During the fight between the virtual character and NPC one, NPC one will increase 5 points each time it releases a big move. When the points reach 15 points, the computer device will modify the status parameters of NPC one, NPC two and NPC three through the group control logic. For example, the status parameters of NPC one are modified from active state to idle state, and the status parameters of NPC two and NPC three are modified from idle state to active state. That is, during the fight between the virtual character and NPC one, after NPC one releases three big moves, NPC one does not continue to fight with the virtual character, NPC one moves away from the virtual character, and NPC two and NPC three start fighting with the virtual character.
[0210] In some embodiments, when the sum of the operation points of the interactive operations between the first NPC and the virtual character does not reach the point threshold, but the virtual character performs interactive operations with the NPC in the idle state, the state parameters of the first NPC are modified from the active state to the idle state through the group control logic, and the state parameters of the second NPC are modified from the idle state to the active state.
[0211] Step 1206: End.
[0212] To sum up, the method provided in this embodiment detects the operation points of the interactive operation between the virtual character and the first NPC, and triggers the group control logic to modify the status parameters corresponding to at least one NPC in the NPC group where the first NPC is located, so that the interaction between the virtual character and the NPC is more linked, the interactive activities between the NPC and the virtual character are richer and more realistic, and the behavior of the NPC is closer to the virtual character controlled by the real user, thereby improving the user experience.
[0213] FIG13 is a flow chart of a method for controlling an NPC provided by an exemplary embodiment of the present application. The method may be executed by a computer device, which may be the terminal or server in FIG2 . The method includes:
[0214] Step 1301: Start.
[0215] Step 1302: Obtain the status parameters of the first NPC.
[0216] Exemplarily, the computer device obtains the status parameters of the first NPC, and obtains the association relationship between the first NPC and the third NPC in the NPC group.
[0217] The status parameters include active status and idle status.
[0218] Optionally, the association relationship includes at least one of a positive relationship and a negative relationship, but is not limited thereto, and the embodiments of the present application do not make specific limitations on this.
[0219] A positive relationship is one that aligns the actions of at least two NPCs in the same NPC group. For example, a positive relationship includes at least one of a romantic relationship, a close friend relationship, a playmate relationship, and a mentor-apprentice relationship, but is not limited thereto. This embodiment of the present application does not specifically limit this.
[0220] A negative relationship refers to a relationship that causes at least two NPCs in the same NPC group to move in opposite directions. For example, a negative relationship includes at least one of a hostile relationship and a relationship with different attributes, but is not limited thereto. This embodiment of the application does not specifically limit this.
[0221] Step 1303: Check whether there is a third NPC that has an active relationship with the first NPC.
[0222] Exemplarily, after obtaining the status parameters of the first NPC, it is detected whether there is a third NPC having a positive relationship with the first NPC. If there is a third NPC having a positive relationship with the first NPC in the NPC group, step 1305 is executed; if there is no third NPC having a positive relationship with the first NPC in the NPC group, step 1304 is executed.
[0223] Step 1304: Whether the first NPC performs the first operation.
[0224] For example, when there is no third NPC having a positive relationship with the first NPC in the NPC group, it is determined whether the first NPC performs the first operation. If the first NPC performs the first operation, step 1306 is executed; if the first NPC does not perform the first operation, step 1307 is executed.
[0225] The first operation includes at least one of running behavior, attacking behavior, flying behavior, and climbing behavior, but is not limited thereto. The embodiment of the present application does not make any specific limitation on this.
[0226] Step 1305: Modify the status parameters of the first NPC and the third NPC to be consistent.
[0227] For example, when there is a third NPC in the NPC group that has an active relationship with the first NPC, the state parameters of the first NPC and the third NPC are modified to a consistent state through the group control logic.
[0228] For example, an NPC group includes NPC 1, NPC 2, and NPC 3. NPC 1 and NPC 2 have an active relationship, while NPC 2 and NPC 3 have a negative relationship. Assuming NPC 1, NPC 2, and NPC 3 are all active, when a virtual character fights NPC 2, the computer device modifies the state parameters of NPC 1, NPC 2, and NPC 3 through group control logic. Because NPC 1 and NPC 2 have an active relationship, NPC 1 remains active, and NPC 1 joins the fight between the virtual character and NPC 2. However, because NPC 2 and NPC 3 have a negative relationship, NPC 3's state is modified to idle, and NPC 3 moves away from the fight.
[0229] Step 1306: Check whether there is a third NPC that has a negative relationship with the first NPC.
[0230] Exemplarily, when the first NPC performs the first operation, it is detected whether there is a third NPC having a negative relationship with the first NPC. If there is a third NPC having a negative relationship with the first NPC in the NPC group, step 1308 is executed; if there is no third NPC having a negative relationship with the first NPC in the NPC group, step 1307 is executed.
[0231] Step 1307: Execute other operations in the individual control logic.
[0232] In the case that there is no third NPC associated with the first NPC in the NPC group, the first NPC and the third NPC are controlled to execute other operations in the individual control logic using their respective corresponding individual control logics.
[0233] Step 1308: The third NPC cannot perform the first operation.
[0234] For example, when there is a third NPC having a negative relationship with a first NPC in the NPC group, and when the first NPC performs a first operation, the third NPC is controlled so as not to perform the first operation.
[0235] For example, when the first NPC and the third NPC have a negative relationship, the behavioral parameters of the first NPC and the third NPC are modified to opposite states through the group control logic, that is, the first NPC and the third NPC cannot perform a certain behavior at the same time. For example, when the first NPC performs an attack behavior, the third NPC cannot perform an attack behavior either.
[0236] Step 1309: End.
[0237] In summary, the method provided in this embodiment, by obtaining the association relationship between different NPCs in the same group, enables NPCs in the NPC group to make more intelligent responses, makes the interactive activities between NPCs and virtual characters richer and more realistic, and makes the behavior of NPCs closer to the virtual characters controlled by real users, thereby improving the user experience.
[0238] FIG14 shows a schematic diagram of a control device for a non-player character provided by an exemplary embodiment of the present application. The device can be implemented as all or part of a computer device through software, hardware, or a combination of both. The device includes:
[0239] An acquisition module 1401 is configured to acquire a group control logic and individual control logics of multiple NPCs. The group control logic is the control logic corresponding to an NPC group, and the NPC group includes multiple NPCs.
[0240] A control module 1402 is configured to modify a state parameter corresponding to at least one NPC in the NPC group through group control logic in response to an influencing factor between the virtual character and a first NPC in the NPC group;
[0241] The updating module 1403 is configured to update the interaction between the at least one NPC and the virtual character based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC.
[0242] In some embodiments, the control module 1402 is configured to modify a state parameter corresponding to at least one NPC in the NPC group through group control logic in response to an interaction between the virtual character and a first NPC in the NPC group satisfying a trigger condition.
[0243] In some embodiments, the control module 1402 is configured to modify a status parameter corresponding to at least one NPC in the NPC group through group control logic in response to the duration of the interaction between the virtual character and the first NPC in the NPC group reaching a time threshold.
[0244] In some embodiments, the control module 1402 is used to modify the state parameters of the first NPC from an active state to an idle state through the group control logic in response to the duration of the interaction between the virtual character and the first NPC in the NPC group reaching a time threshold, and to modify the state parameters of the second NPC in the NPC group from an idle state to an active state through the group control logic, wherein the active state refers to a state in which active interaction with the virtual character can be performed, and the idle state refers to a state in which active interaction with the virtual character cannot be performed.
[0245] In some embodiments, the control module 1402 is configured to modify a status parameter corresponding to at least one NPC in the NPC group through group control logic in response to the operation score of the interactive operation between the first NPC in the NPC group and the virtual character reaching a score threshold.
[0246] In some embodiments, the acquisition module 1401 is used to query the operation score correspondence table to obtain the sum of the operation scores of the interactive operations between the first NPC and the virtual character in the NPC group. The operation score correspondence table includes the operation score corresponding to each interactive operation.
[0247] In some embodiments, the control module 1402 is used to modify the state parameters of the first NPC from an activated state to an idle state through the group control logic in response to the sum of the operation points of the interactive operations between the first NPC and the virtual character reaching a point threshold, and to modify the state parameters of the second NPC in the NPC group from an idle state to an activated state through the group control logic, wherein the activated state refers to a state in which active interaction with the virtual character can be carried out, and the idle state refers to a state in which active interaction with the virtual character cannot be carried out.
[0248] In some embodiments, the control module 1402 is used to modify the state parameters of the first NPC from an idle state to an active state through the group control logic in response to an interaction event between the virtual character and the first NPC in the NPC group meeting a predefined interaction event; wherein the active state refers to a state in which active interaction with the virtual character can be carried out, and the idle state refers to a state in which active interaction with the virtual character cannot be carried out.
[0249] In some embodiments, the control module 1402 is used to modify the state parameters of the first NPC from the activated state to the idle state and the state parameters of the second NPC from the idle state to the activated state through the group control logic when the virtual character does not interact with the first NPC in the activated NPC group, but interacts with the second NPC in the idle state in the NPC group.
[0250] In some embodiments, the control module 1402 is configured to modify, via group control logic, initial state parameters corresponding to at least one NPC in the NPC group in response to the virtual character entering into an interactive scenario with the first NPC in the NPC group. The initial state parameters refer to default state parameters at the start of a game.
[0251] In some embodiments, the control module 1402 is configured to modify the initial state parameters corresponding to at least one NPC in the NPC group through group control logic in response to the virtual character attacking the first NPC.
[0252] In some embodiments, the control module 1402 is configured to modify the initial state parameters corresponding to at least one NPC in the NPC group through group control logic in response to the virtual character entering the field of view of the first NPC.
[0253] In some embodiments, the acquisition module 1401 is configured to acquire an association relationship between a first NPC and a third NPC in an NPC group.
[0254] In some embodiments, the control module 1402 is configured to modify the status parameter corresponding to the third NPC through the group control logic according to the association relationship between the first NPC and the third NPC.
[0255] An association relationship includes a positive relationship, which is a relationship that aligns the actions of at least two NPCs in the same NPC group. In some embodiments, control module 1402 is configured to modify the state parameters of the first and third NPCs to be consistent through group control logic when a first NPC and a third NPC have a positive relationship.
[0256] The association relationship includes a negative relationship, which is a relationship that causes at least two NPCs in the same NPC group to move in opposite directions. In some embodiments, control module 1402 is configured to modify the state parameters of the first and third NPCs to opposite states through group control logic when a first NPC and a third NPC have a negative relationship.
[0257] In one embodiment, the control module 1402 is configured to modify a status parameter corresponding to at least one NPC in the NPC group through group control logic in response to an influencing factor between the virtual character and the first NPC in the NPC group according to an activation priority order.
[0258] In one embodiment, the control module 1402 is configured to modify a state parameter corresponding to at least one NPC in the NPC group through group control logic according to a preconfigured activation quantity in response to an influencing factor between the virtual character and the first NPC in the NPC group.
[0259] FIG15 illustrates a block diagram of a computer device 1500 according to an exemplary embodiment of the present application. Computer device 1500 may be a portable mobile terminal, such as a smartphone, tablet computer, or MP3 (Moving Picture Experts Group Audio Layer III) or MP4 (Moving Picture Experts Group Audio Layer IV) player. Computer device 1500 may also be referred to as a user device, portable terminal, or other similar terminology.
[0260] Typically, the computer device 1500 includes a processor 1501 and a memory 1502 .
[0261] The processor 1501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0262] Memory 1502 may include one or more computer-readable storage media, which may be tangible and non-transitory. Memory 1502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in memory 1502 is used to store at least one instruction, which is executed by processor 1501 to implement the non-player character control method provided in the embodiments of the present application.
[0263] In some embodiments, the computer device 1500 may further optionally include a peripheral device interface 1503 and at least one peripheral device. Specifically, the peripheral device includes at least one of a radio frequency circuit, a touch screen display, a camera, an audio circuit, and a power supply.
[0264] Those skilled in the art will appreciate that the structure shown in FIG. 15 does not limit the computer device 1500 , and may include more or fewer components than shown, or combine certain components, or adopt a different component arrangement.
[0265] An embodiment of the present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one program, and the at least one computer program is loaded and executed by the processor to implement the control method of the non-player character provided by the above-mentioned method embodiments.
[0266] An embodiment of the present application further provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the control method for a non-player character provided by each of the above method embodiments.
[0267] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium; the computer program is read and executed from the computer-readable storage medium by a processor of a computer device, so that the computer device executes to implement the control method of the non-player character provided by the above-mentioned method embodiments.
[0268] It is understandable that in the specific implementation methods of this application, the data involved, historical data, and portraits and other data related to user data processing related to user identity or characteristics, when the above embodiments of this application are applied to specific products or technologies, need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
Claims
1. A method for controlling a non-player character, wherein: The method is performed by a terminal device, and the method includes: Acquire a group control logic and individual control logics of the plurality of NPCs, wherein the group control logic is the control logic corresponding to the NPC group, and the NPC group includes the plurality of NPCs; In response to the influence factor between the virtual character and the first NPC in the NPC group, modifying the state parameter corresponding to at least one NPC in the NPC group through the group control logic; Based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC, the interaction between the at least one NPC and the virtual character is updated.
2. The method according to claim 1, wherein: The step of modifying a state parameter corresponding to at least one NPC in the NPC group by the group control logic in response to an influence factor between the virtual character and the first NPC in the NPC group includes: In response to the interaction between the virtual character and the first NPC in the NPC group satisfying a trigger condition, the state parameter corresponding to the at least one NPC in the NPC group is modified through the group control logic.
3. The method according to claim 2, wherein: In response to the interaction between the virtual character and the first NPC in the NPC group satisfying a trigger condition, modifying the state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the duration of the interaction between the virtual character and the first NPC in the NPC group reaching a time threshold, the state parameter corresponding to the at least one NPC in the NPC group is modified by the group control logic.
4. The method according to claim 3, wherein: In response to the duration of the interaction between the virtual character and the first NPC in the NPC group reaching a time threshold, modifying the state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the duration of the interaction between the virtual character and the first NPC in the NPC group reaching the time threshold, modifying the state parameter of the first NPC from an active state to an idle state through the group control logic, and modifying the state parameter of a second NPC in the first NPC group from the idle state to the active state through the group control logic; The activated state refers to a state in which the user can actively interact with the virtual character, and the idle state refers to a state in which the user cannot actively interact with the virtual character.
5. The method according to claim 2, wherein: In response to the interaction between the virtual character and the first NPC in the NPC group satisfying a trigger condition, modifying the state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the operation score of the interactive operation between the first NPC and the virtual character in the NPC group reaching a score threshold, the state parameter corresponding to the at least one NPC in the NPC group is modified through the group control logic.
6. The method according to claim 5, wherein: In response to the operation score of the interactive operation between the first NPC in the NPC group and the virtual character reaching a score threshold, modifying the state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: Querying an operation score correspondence table to obtain the sum of the operation scores of the interactive operations between the first NPC and the virtual character in the NPC group, wherein the operation score correspondence table includes the operation score corresponding to each interactive operation; In response to the sum of the operation points of the interactive operation between the first NPC and the virtual character reaching the point threshold, the state parameter of the first NPC is modified from the active state to the idle state through the group control logic, and the state parameter of the second NPC in the NPC group is modified from the idle state to the active state through the group control logic; The activated state refers to a state in which the user can actively interact with the virtual character, and the idle state refers to a state in which the user cannot actively interact with the virtual character.
7. The method according to claim 2, wherein: In response to the interaction between the virtual character and the first NPC in the NPC group satisfying a trigger condition, modifying the state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to an interaction event between the virtual character and the first NPC in the NPC group meeting a predefined interaction event, modifying a state parameter of the first NPC from an idle state to an activated state through the group control logic; The activated state refers to a state in which the user can actively interact with the virtual character, and the idle state refers to a state in which the user cannot actively interact with the virtual character.
8. The method according to claim 1, wherein: The step of modifying a state parameter corresponding to at least one NPC in the NPC group by the group control logic in response to an influence factor between the virtual character and the first NPC in the NPC group includes: In response to the virtual character and the first NPC in the NPC group entering into an interactive scenario, the initial state parameters corresponding to at least one NPC in the NPC group are modified through the group control logic, wherein the initial state parameters refer to default state parameters at the beginning of a game.
9. The method according to claim 8, wherein: In response to the virtual character and the first NPC in the NPC group entering into an interactive scenario, modifying the initial state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the virtual character and the first NPC in the NPC group entering into an interactive scenario, modifying a group state parameter corresponding to the NPC group through the individual control logic of the first NPC; In response to the group control logic detecting that the group state parameter has changed, the group control logic modifies the initial state parameter corresponding to the at least one NPC in the NPC group.
10. The method according to claim 8, wherein: In response to the virtual character and the first NPC in the NPC group entering into an interactive scenario, modifying the initial state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the virtual character attacking the first NPC in the NPC group, the initial state parameter corresponding to the at least one NPC in the NPC group is modified through the group control logic.
11. The method according to claim 8, wherein: In response to the virtual character and the first NPC in the NPC group entering into an interactive scenario, modifying the initial state parameter corresponding to the at least one NPC in the NPC group by the group control logic includes: In response to the virtual character entering the field of view of the first NPC in the NPC group, the initial state parameter corresponding to the at least one NPC in the NPC group is modified through the group control logic.
12. The method according to any one of claims 1 to 11, wherein: The method further comprises: Acquire the association relationship between the first NPC and the third NPC in the NPC group; According to the association relationship between the first NPC and the third NPC, the state parameter corresponding to the third NPC is modified through the group control logic.
13. The method according to claim 12, wherein: The association relationship includes a positive relationship, and the positive relationship refers to a relationship in which the action direction of the NPC is consistent; The modifying the state parameter corresponding to the third NPC by the group control logic according to the association relationship between the first NPC and the third NPC includes: In the case that the first NPC and the third NPC are in the active relationship, the state parameters of the first NPC and the third NPC are modified to a consistent state through the group control logic.
14. The method according to claim 12, wherein: The association relationship includes a negative relationship, and the negative relationship refers to a relationship in which the action direction of the NPC is opposite; According to the association relationship between the first NPC and the third NPC, through the group control logic Modifying the status parameters corresponding to the third NPC includes: In the case that the first NPC and the third NPC are in the negative relationship, the state parameters of the first NPC and the third NPC are modified to opposite states through the group control logic.
15. The method according to claim 1, wherein: The step of modifying a state parameter corresponding to at least one NPC in the NPC group by the group control logic in response to an influence factor between the virtual character and the first NPC in the NPC group includes: In response to the influencing factors between the virtual character and the first NPC in the NPC group, the state parameter corresponding to the at least one NPC in the NPC group is modified by the group control logic in accordance with the activation priority order.
16. The method according to claim 1, wherein: The step of modifying a state parameter corresponding to at least one NPC in the NPC group by the group control logic in response to an influence factor between the virtual character and the first NPC in the NPC group includes: In response to the influence factor between the virtual character and the first NPC in the NPC group, the state parameter corresponding to the at least one NPC in the NPC group is modified by the group control logic according to a preconfigured activation quantity.
17. A control device for a non-player character, wherein: The device comprises: An acquisition module, used to acquire group control logic and individual control logic of each of the plurality of NPCs, wherein the group control logic is the control logic corresponding to the NPC group, and the NPC group includes the plurality of NPCs; A control module, configured to modify a state parameter corresponding to at least one NPC in the NPC group through the group control logic in response to an influence factor between the virtual character and the first NPC in the NPC group; An updating module is used to update the interaction between the at least one NPC and the virtual character based on the modified state parameters of the at least one NPC and the individual control logic of the at least one NPC.
18. A computer device, wherein: The computer device comprises: a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the control method of the non-player character according to any one of claims 1 to 16.
19. A computer storage medium, wherein: At least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by the processor to implement the control method of the non-player character according to any one of claims 1 to 16.
20. A computer program product, wherein: The computer program product comprises a computer program, which is stored in a computer-readable storage medium; the computer program is read and executed from the computer-readable storage medium by a processor of a computer device, so that the computer device executes the control method of a non-player character as claimed in any one of claims 1 to 16.
Citation Information
Patent Citations
NPC control method based on artificial intelligence, NPC control device based on artificial intelligence, equipment and medium
CN110496394A
Virtual object control method and device, electronic equipment and storage medium
CN111921200A
Role interaction method and device, equipment and storage medium
CN115018960A
Systems and methods for cinematic direction and dynamic character control via natural language output
US20160071302A1
