CN113577781B - Non-player character NPC control method, device, equipment and medium - Google Patents

Non-player character NPC control method, device, equipment and medium Download PDF

Info

Publication number
CN113577781B
CN113577781B CN202110870050.5A CN202110870050A CN113577781B CN 113577781 B CN113577781 B CN 113577781B CN 202110870050 A CN202110870050 A CN 202110870050A CN 113577781 B CN113577781 B CN 113577781B
Authority
CN
China
Prior art keywords
npc
tactical
action
npcs
team
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110870050.5A
Other languages
Chinese (zh)
Other versions
CN113577781A (en
Inventor
侯焯明
刘林
吴小康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110870050.5A priority Critical patent/CN113577781B/en
Publication of CN113577781A publication Critical patent/CN113577781A/en
Application granted granted Critical
Publication of CN113577781B publication Critical patent/CN113577781B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/80Special adaptations for executing a specific game genre or game mode
    • A63F13/822Strategy games; Role-playing games
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/80Special adaptations for executing a specific game genre or game mode
    • A63F13/847Cooperative playing, e.g. requiring coordinated actions from several players to achieve a common goal
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/80Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game specially adapted for executing a specific type of game
    • A63F2300/807Role playing or strategy games

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application discloses a control method, a device, equipment and a medium of non-player character NPC, and belongs to the technical field of computers. The method is applied to a terminal, the terminal is operated with control logic of a first NPC, the first NPC belongs to NPC team, and the method comprises the following steps: acquiring cooperative tactical information of the NPC team, the cooperative tactical information being used to indicate at least one tactical action to be performed by a plurality of NPCs in the NPC team; acquiring tactical action performance of other NPCs in the NPC team except the first NPC, wherein the tactical action performance is used for indicating the types of tactical actions being executed by the other NPCs; determining a target tactical action to be executed by the first NPC according to the cooperative tactical information and tactical action execution conditions of other NPCs; the first NPC is controlled to perform the target tactical action. The method improves the intelligent degree of the first NPC and realizes the cooperative combat among the NPCs.

Description

Non-player character NPC control method, device, equipment and medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for controlling NPC of a non-player character.
Background
In an application provided with an athletic environment, it is often common for users to perform an athletic activity with an NPC (Non-player Character).
In the related art, when a player character controlled by a user approaches an NPC, the NPC initiates an attack to the player character, and when the player character is far away from the NPC, the NPC stops attacking the player character, and in the related art, the interaction mode between the NPC and the player character is very simple, and a developer can rapidly and conveniently configure the interaction mode between the NPC and the player character.
However, in the related art, the NPC can only develop a competition with a player character controlled by a user according to a fixed behavior logic, and the degree of intellectualization of the NPC is low.
Disclosure of Invention
The application provides a control method, a device, equipment and a medium for NPCs of non-player characters, which can realize cooperative combat among the NPCs, and the technical scheme is as follows:
according to one aspect of the present application, there is provided a control method of a non-player character NPC, applied to a terminal, the terminal running control logic of a first NPC, the first NPC belonging to an NPC team, the method comprising:
acquiring cooperative tactical information of an NPC team, the cooperative tactical information being indicative of at least one tactical action to be performed by a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs being configured to perform one of the at least one tactical action, the same tactical action being performed by the at least one NPC;
Acquiring tactical action performance of other NPCs in the NPC team except the first NPC, wherein the tactical action performance is used for indicating the types of tactical actions being executed by the other NPCs;
determining a target tactical action to be executed by the first NPC according to the cooperative tactical information and tactical action execution conditions of other NPCs;
the first NPC is controlled to perform the target tactical action.
According to another aspect of the present application, there is provided a control device for a non-player character NPC, the device operating with control logic for a first NPC belonging to a NPC team, the device comprising:
an acquisition module for acquiring collaborative tactical information of an NPC team, the collaborative tactical information being indicative of at least one tactical action to be performed by a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs being configured to perform one of the at least one tactical action, the same tactical action being performed by the at least one NPC;
the acquisition module is also used for acquiring tactical action execution conditions of other NPCs except the first NPC in the NPC team, wherein the tactical action execution conditions are used for indicating the types of tactical actions being executed by the other NPCs;
the determining module is used for determining target tactical actions required to be executed by the first NPC according to the cooperative tactical information and tactical action execution conditions of other NPCs;
And the control module is used for controlling the first NPC to execute target tactical actions.
According to another aspect of the present application, there is provided a computer device comprising: a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the control method of the non-player character NPC as above.
According to another aspect of the present application, there is provided a computer-readable storage medium storing a computer program loaded and executed by a processor to implement the control method of the non-player character NPC as above.
The beneficial effects that technical scheme that this application embodiment provided include at least:
the target tactical action required to be executed by the first NPC is determined according to the tactical action execution conditions of other NPCs and the cooperative tactical information, so that the degree of intellectualization of the first NPC is improved, and further, the competition between NPCs and player characters in a cooperative combat mode is realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an implementation environment of a method for controlling a non-player character NPC provided in an exemplary embodiment of this application;
FIG. 2 is a flow chart of a method for controlling a non-player character NPC provided in one exemplary embodiment of this application;
FIG. 3 is a schematic diagram of NPC synergy combat provided in an illustrative embodiment of the present application;
FIG. 4 is a schematic illustration of NPC co-operation provided in accordance with another exemplary embodiment of this application;
FIG. 5 is a schematic illustration of NPC co-operation provided in accordance with another exemplary embodiment of this application;
FIG. 6 is a schematic diagram of NPC co-operation provided in accordance with another exemplary embodiment of this application;
FIG. 7 is a schematic diagram of NPC synergy combat provided in accordance with another illustrative embodiment of the present application;
FIG. 8 is a flow chart of a method for controlling a non-player character NPC provided in another exemplary embodiment of this application;
FIG. 9 is a flowchart of a method for controlling a non-player character NPC provided in another exemplary embodiment of this application;
FIG. 10 is a flowchart of a method for controlling a non-player character NPC provided in another exemplary embodiment of this application;
FIG. 11 is a schematic diagram of a state machine+behavior tree mode in which a first NPC is located, provided in an example embodiment of this application;
FIG. 12 is a schematic diagram of a control device for a non-player character NPC provided in an exemplary embodiment of this application;
fig. 13 shows a block diagram of a computer device according to an exemplary embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
First, the terms involved in the embodiments of the present application will be briefly described:
athletic environment: in this application, the context in which NPC plays a game with a player character may be a virtual environment, which is a virtual environment that an application program displays (or provides) while running on a terminal, in one embodiment. The virtual environment may be a simulation environment for the real world, a semi-simulation and semi-imaginary environment, or a pure imaginary environment. The virtual environment may be any one of a two-dimensional virtual environment, a 2.5-dimensional virtual environment, and a three-dimensional virtual environment, which is not limited in this application.
NPC: in this application, the NPC is a movable object in the virtual environment in the case where the competition environment is a virtual environment. The movable object may be a virtual character, a virtual animal, a cartoon character, etc., such as: characters and animals displayed in the three-dimensional virtual environment. Optionally, the virtual object is a three-dimensional stereoscopic model created based on animated skeleton techniques. Each virtual object has its own shape and volume in the three-dimensional virtual environment, occupying a portion of the space in the three-dimensional virtual environment.
Athletic status: indicating a behavior mode of the first NPC in the competitive environment, wherein the competitive states are in one-to-one correspondence with the behavior tree, and optionally, the first competitive state is any one of a leisure state, an alert state and a fight state. The second competitive state is any one of a leisure state, an armed state, and a combat state except for the first competitive state.
Optionally, the leisure state is a behavior mode of the first NPC under the condition that the first NPC is not disturbed by the player character, the alert state is a behavior mode of the first NPC under the condition that the first NPC is slightly disturbed by the player character, and the fight state is a behavior mode of the first NPC under the condition that the first NPC is severely disturbed by the player character.
The following describes the implementation environment in which embodiments of the present application are implemented:
FIG. 1 is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application: fig. 1 shows a leisure state behavior tree 101, an alert state behavior tree 102, a combat state behavior tree 103, and a state machine 104.
The behavioral tree 101 of the leisure state is executed when the first NPC is in the leisure state, the behavioral tree 102 of the armed state is executed when the first NPC is in the armed state, and the behavioral tree 103 of the combat state is executed when the first NPC is in the combat state. The athletic status in which the first NPC is located may be switched by the state machine 104.
In one embodiment, the leisure state behavior tree 101, the alert state behavior tree 102, the combat state behavior tree 103, and the state machine 104 shown in fig. 1 are stored and run in servers including at least one of a server, a plurality of servers, a cloud computing platform, and a virtualization center. The server includes a processor and a memory, where the memory further includes a receiving module, a control module, and a sending module, where the receiving module is configured to receive a request sent by an application program, for example, a request for switching athletic status; the control module is used for controlling the rendering of the athletic pictures; the sending module is used for sending a response to the application program, such as sending an instruction for switching the competitive state to the application program.
In one embodiment, the leisure state behavior tree 101, the alert state behavior tree 102, the combat state behavior tree 103 and the state machine 104 shown in fig. 1 are stored and run in a terminal, on which an application supporting a competitive environment is installed and run, and optionally, the device types of the terminal supporting the application supporting the competitive environment are the same or different, and the device types include: at least one of a smart phone, a tablet computer, an electronic book reader, an MP3 player, an MP4 player, a laptop portable computer, and a desktop computer.
In one embodiment, the leisure state behavior tree 101, the alert state behavior tree 102, the combat state behavior tree 103 and the state machine 104 shown in fig. 1 are partially stored and run in a server, and partially stored and run in a terminal, and the storage and running positions of the leisure state behavior tree 101, the alert state behavior tree 102, the combat state behavior tree 103 and the state machine 104 are not limited in this application.
The following embodiments are illustrated with the leisure state behavior tree 101, the alert state behavior tree 102, the combat state behavior tree 103, and the state machine 104 all stored and running at the terminal.
In order to implement the collaborative combat of multiple NPCs in the NPC team, fig. 2 shows a flowchart of a control method of the NPC of the non-player character according to an exemplary embodiment of the present application, and the method is illustrated by a behavior tree running in the combat state (i.e. the second competitive state) shown in fig. 1, where in the embodiment shown in fig. 2, the control method of the NPC of the non-player character is applied to a terminal, and the terminal runs control logic of the first NPC, where the first NPC belongs to the NPC team, and the method includes:
step 220, acquiring cooperative tactical information of the NPC team;
the collaborative tactical information is used to indicate at least one tactical action that a plurality of NPCs in the NPC team need to perform, each NPC in the plurality of NPCs is used to perform one of the at least one tactical action, the same tactical action being performed by the at least one NPC.
In one embodiment, the NPC team is partitioned based on the distance of the NPC in the athletic environment, or, the NPC team is pre-partitioned based on the athletic performance prior to the start. Alternatively, the terminal may divide NPC teams according to the distance of NPCs in the athletic environment, e.g., several NPCs that are not more than L apart from each other may constitute an NPC team that performs tactical actions according to the indication of collaborative tactical information. Optionally, the NPC team is preset based on division of the developer or the user before the athletic starts, for example, the developer or the user sets the NPC for performing the attack task to form an NPC team, and sets the NPC for performing the rescue task to form an NPC team.
Tactical actions: NPC is an action performed in expanding a competition with a player character, and tactical actions include, but are not limited to, shooting, moving, performing, commanding, competing for a shelter, squatting, avoiding mines, post-detour attacks, searching for enemies, and evading friends.
Optionally, each tactical action includes at least one tactical sub-action.
By way of example, the shots include three tactical actions of standing shots, shelter shots, and mobile shots; specifically, the movements include two tactical actions of shelter movement and non-shelter movement; specifically, the performances comprise six tactical actions of skill performances, bullet changing performances, oppositional activities, strengthening performances, rolling performances and firestopping performances; specifically, commanding includes commanding an NPC team to a tactical sub-action; specifically, competing for a shelter includes competing for a tactical action of the current shelter; specifically, squatting includes both tactical actions of squatting inside the shelter and squatting outside the shelter; specifically, the avoidance of the mine includes avoidance of a tactical action of the current mine; specifically, post-wraparound attacks include a tactical action of a attack; specifically, searching for enemies includes searching for a tactical sub-action on the front; specifically, avoiding the friend party includes the friend party attacking a tactical action.
Collaborative tactical information: at least one tactical action required to be performed for indicating a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs for performing one of the at least one tactical action, the same tactical action being performed by the at least one NPC;
illustratively, the collaborative tactical information indicates that 3 NPCs in the NPC team need to shoot (tactical action), and 2 NPCs need to move (tactical action). Optionally, the collaborative tactical information further indicates that 2 NPCs in the NPC team perform standing shots (tactical sub-actions under shots), 1 NPC performs shelter shots (tactical sub-actions under shots), 1 NPC performs movement along a shelter (tactical sub-actions under movements), 1 NPC performs non-shelter movements (tactical sub-actions under movements).
Illustratively, the collaborative tactical information indicates a length of time for which a plurality of NPCs in the NPC team respectively perform n tactical actions; illustratively, the collaborative tactical information indicates that the NPC team performs shooting (tactical action) for a period of time t1, and indicates that the NPC team performs movement (tactical action) for a period of time t2. Optionally, the collaborative tactical information further indicates that the NPC in the NPC team performs standing shots for a period of time t3, performs shelter shots for a period of time t4, performs movement along the shelter for a period of time t5, and performs non-shelter movement for a period of time t6, wherein t3+t4=t1, t5+t6=t2.
In one embodiment, the terminal obtains collaborative tactical information for a pre-set NPC team. Optionally, collaborative tactical information of the NPC team is preset by a developer through codes, and cannot be changed by a user; optionally, the collaborative tactic information of the NPC team may be manually changed by the user, and the user may adjust the collaborative tactic information of the NPC team, thereby reducing or improving the athletic difficulty.
For example, there is an adjustment control of cooperative tactical information of NPC team on an application running with a competitive environment, the cooperative tactical information of the initial NPC team includes 3 NPC performing shots, 2 NPC performing movements, and the user can modify to 1 NPC performing shot, 4 NPC performing movements through the adjustment control.
Step 240, obtaining tactical action execution conditions of other NPCs except the first NPC in the NPC team;
tactical action execution case: for indicating the type of tactical action being performed by the other NPCs;
illustratively, the tactical action performance includes n tactical actions performance indicating n tactical actions being performed by other NPCs.
In one embodiment, the performance of the first tactical action indicates a number of NPCs in the other NPCs that are performing the first tactical action, and illustratively, the performance of the shooting tactical action indicates a number of NPCs in the other NPCs that are performing the shooting (tactical action) of 3.
In one embodiment, the performance of the first tactical action indicates a duration that the other NPCs are performing the first tactical action, illustratively, the performance of the shooting tactical action indicates a duration t7 that the shooting (tactical action) is being performed in the other NPCs.
In one embodiment, the terminal acquires the execution of n tactical actions of other NPCs in the NPC team than the first NPC at the same time, or the terminal acquires the execution of n tactical actions of other NPCs in the NPC team than the first NPC one by one according to a preset acquisition priority.
Step 260, determining a target tactical action to be performed by the first NPC according to the collaborative tactical information and tactical action performance of other NPCs;
in one embodiment, the terminal determines, according to the cooperative tactical information and tactical action execution conditions of other NPCs, a tactical action category of the other NPCs that does not conform to the cooperative tactical information, where the tactical action category is an ith tactical action in the cooperative tactical information, and the terminal determines that the first NPC executes the ith tactical action, where the ith tactical action is a target tactical action.
Alternatively, the tactical actions of the other NPCs are performed in a manner not conforming to the collaborative tactical information, meaning that the number of NPCs of the other NPCs performing the ith tactical action is less than the number of NPCs performing the ith tactical action indicated by the collaborative tactical information.
Optionally, the tactical actions of the other NPCs are performed in a manner that is not in compliance with the collaborative tactical information, meaning that the other NPCs perform the ith tactical action for a period of time less than the period of time the collaborative tactical information indicates that the ith tactical action is performed.
In step 280, the first NPC is controlled to perform a target tactical action.
The manner in which the terminal controls the first NPC to perform the target tactical action includes at least three of:
the first terminal controls the first NPC to randomly execute tactical sub-actions in the ith tactical action;
from the above, the ith tactical action is a tactical action class in which the tactical action execution situation of the other NPCs does not conform to the cooperative tactical information, and the terminal randomly selects one tactical sub-action from the ith tactical action for the first NPC to execute.
And the second terminal controls the first NPC to execute the j-th tactical sub-action of the i-th tactical action based on the fact that the third NPC number is smaller than the fourth NPC number, wherein the third NPC number is the NPC number of the j-th tactical sub-action of the i-th tactical action in other NPCs, the fourth NPC number is the NPC number of the j-th tactical sub-action of the i-th tactical action indicated by the cooperative tactical information, and j is a positive integer.
The j-th tactical sub-action is one of the tactical sub-actions under the i-th tactical action. The cooperative tactical information is further used for indicating the NPC to execute the tactical sub-action of the ith tactical action, and on the premise that the terminal determines that the first NPC executes the ith tactical action, the terminal controls the first NPC to execute the jth tactical action of the ith tactical action based on the number of NPCs of the jth tactical sub-action of the other NPCs, which is smaller than the number of NPCs of the jth tactical sub-action of the ith tactical action.
Third, the terminal controls the first NPC to perform the j-th tactical sub-action of the i-th tactical action based on the duration of the j-th tactical sub-action of the i-th tactical action performed by the other NPCs being less than the duration of the j-th tactical sub-action of the i-th tactical action indicated by the cooperative tactical information.
In one embodiment, fig. 3 shows a schematic diagram of NPC collaborative combat provided by an exemplary embodiment of the present application, where a first NPC sub-team 301, a second NPC sub-team 302, and a third NPC sub-team 303 constitute one NPC team, the first NPC sub-team 301 is to shield the third NPC sub-team 303 in the vicinity of the shelter and primarily defend against attacks initiated by the player character from the left side, and the second NPC sub-team 302 is to shield the third NPC sub-team 303 in the vicinity of the shelter and primarily defend against attacks initiated by the player character from the right side, according to indications of collaborative tactic information of the NPC teams. The third NPC team 303 initiates an attack from the front towards the player character.
In one embodiment, fig. 4 shows a schematic diagram of NPC collaborative combat provided by an exemplary embodiment of the present application, according to collaborative tactical information, the NPC team performs the tactical shown in fig. 4, wherein the first NPC team 301 transitions to initiating an attack from the left side to the player character, the second NPC team 302 initiates an attack from the right side to the player character, and the third NPC team 303 still initiates an attack from the front to the player character.
In one embodiment, FIG. 5 illustrates a schematic diagram of NPC collaborative combat provided by an exemplary embodiment of the present application, where NPC team 304 successfully encloses player character 305, based on collaborative tactical information, performing the tactical illustrated in FIG. 5.
In one embodiment, FIG. 6 illustrates a schematic diagram of NPC collaborative combat provided by an exemplary embodiment of the present application, where NPC team performs the tactics illustrated in FIG. 6 based on collaborative tactical information, and NPC team 304 initiates an attack from the front toward player character 305 as a whole.
In one embodiment, fig. 7 shows a schematic diagram of NPC collaborative combat provided by an exemplary embodiment of the present application, according to collaborative tactical information, it can be seen that the 1 st NPC 701 is performing movement along a shelter (tactical sub-action), the 2 nd NPC 702 is performing non-shelter movement (tactical sub-action), the 3 rd NPC 703 is performing squat (tactical sub-action) in the shelter, and it is worth noting that fig. 7 only observes tactical actions of the NPC team from the perspective of player characters, and that in reality there are other NPCs in the athletic environment, and fig. 7 cannot be fully displayed.
It should be noted that the transformation of the NPC team matrix shown in fig. 3, 4, 5, 6 and 7 is generated by combining the cooperative tactical information and tactical action change rules of the NPC set by the developer, for example, when the developer sets a period of time for each time the NPC performs shelter movement (tactical sub-action) to reach a threshold value, then the NPC performs standing shooting (tactical sub-action), and based on the above setting, the NPC team realizes transformation of the matrix.
In summary, by acquiring tactical action execution conditions of other NPCs and determining target tactical actions to be executed by the first NPC according to differences between tactical action execution conditions of other NPCs and cooperative tactical information, the first NPC can flexibly select target tactical actions, the degree of intellectualization of the first NPC is improved, and the competition between NPCs and player characters in a cooperative combat manner is ensured.
The method further sets that the tactical actions at least comprise one tactical action, and provides a manner that the first NPC executes the tactical action under the target tactical action, enriches cooperative tactical information of NPC team, further improves flexibility of the first NPC executing the tactical action, and intelligence degree of the first NPC.
To determine the target tactical actions that the first NPC needs to perform, steps 240 and 260 may be replaced with steps 251, 252, 253, and 254 based on the embodiment shown in fig. 2, and fig. 8 shows steps 251, 252, 253, and 254. Wherein the collaborative tactical information includes n tactical actions, n being an integer greater than 1.
Step 251, obtaining the execution condition of the ith tactical action of other NPCs except the first NPC in the NPC team;
Wherein i is an integer not greater than n, and the initial value of i is 1.
Wherein, the tactical actions execution cases include n kinds of tactical actions execution cases, and the n kinds of tactical actions are ordered into 1 st kind of tactical actions execution cases to n kinds of tactical actions execution cases according to tactical priorities. That is, the terminal acquires the execution of the ith tactical action in preference to the execution of the (i+1) th tactical action.
It should be noted that, in the case where i is not equal to 1, the terminal acquires the execution of the ith tactical action of the NPC other than the first NPC in the NPC team based on the terminal acquiring the execution of the ith-1 th tactical action, and the execution of the ith-1 th tactical action is executed after conforming to the cooperative tactical information. In the case where i is equal to 1, the terminal acquires the execution of the 1 st tactical action of the other NPCs in the NPC team except the first NPC.
Step 252, the terminal judges whether the execution condition of the ith tactical action does not conform to the cooperative tactical information;
if the execution of the ith tactical action does not conform to the cooperative tactical information, the procedure goes to step 253; in the case where the execution of the ith tactical action matches the cooperative tactical information, step 254 is entered.
Step 253, determining that the first NPC performs the ith tactical action in case the performance of the ith tactical action does not conform to the collaborative tactical information;
illustratively, in the case where the performance of the 1 st tactical action (firing) does not conform to the collaborative tactical information, the terminal determines that the first NPC performs the firing.
In one embodiment, the first NPC is determined to perform the ith tactical action if the first NPC number is less than the second NPC number, the first NPC number being the number of NPCs performing the ith tactical action among the other NPCs, the second NPC number being the number of NPCs performing the ith tactical action indicated by the collaborative tactical information.
Illustratively, the number of NPCs performing the 1 st tactical action (shooting) among the other NPCs is 2, the cooperative tactical information indicates that the number of NPCs performing the 1 st tactical action is 3, i.e., the number of NPCs performing the 1 st tactical action (shooting) among the other NPCs is less than the number of NPCs performing the 1 st tactical action, and the terminal determines that the first NPC performs the 1 st tactical action.
Step 254, in the case where the execution of the ith tactical action conforms to the cooperative tactical information and i is not equal to n, updating i+1 to i, and executing the step of acquiring the execution of the ith tactical action of the NPC other than the first NPC in the NPC team again.
In one embodiment, in the case that the number of NPCs performing the 1 st tactical action among the other NPCs is not less than the number of NPCs performing the i-th tactical action indicated by the cooperative tactical information, the i+1 is updated to i, and the terminal performs the step of acquiring the performance of the i-th tactical action of the other NPCs except the first NPC in the NPC team again.
Illustratively, the number of NPCs performing the 1 st tactical action (shooting) among other NPCs is 3, the cooperative tactical information indicates that the number of NPCs performing the 1 st tactical action is 3, i.e., the number of NPCs performing the 1 st tactical action (shooting) among other NPCs is equal to the number of NPCs performing the 1 st tactical action, and the terminal acquires the performance of the 2 nd tactical action.
It should be noted that, because the tactical actions include n kinds of tactical actions, the collaborative tactical information includes n kinds of tactical actions, that is, it is ensured that the first NPC must determine the target tactical action to be performed from among the n kinds of tactical actions.
In one embodiment, the steps 251, 252, 253 and 254 may be described as the following procedure:
the collaborative tactical information instructs 3 NPCs to perform shots (tactical action 1), 2 NPCs to perform movements (tactical action 2), and 2 NPCs to perform performances (tactical action 3).
The terminal acquires that the number of NPCs performing the 1 st tactical action among the other NPCs is 3, that is, the performance of the 1 st tactical action conforms to the cooperative tactical information, and then the terminal acquires the performance of the 2 nd tactical action of the other NPCs.
The terminal acquires that the number of NPCs of other NPCs performing the 2 nd tactical action is 2, that is, the performance of the 2 nd tactical action conforms to the cooperative tactical information, and then the terminal acquires the performance of the 3 rd tactical action of other NPCs.
The terminal obtains that the number of NPCs of other NPCs for executing the 3 rd tactical action is 1, that is, the execution situation of the 3 rd tactical action does not accord with cooperative tactical information, and the terminal determines that the first NPC executes the 3 rd tactical action.
In summary, the method provides the number of NPCs executing the ith tactical action according to the tactical action execution conditions of the other NPCs, and the difference of the number of NPCs executing the ith tactical action indicated by the cooperative tactical information, determines that the other NPCs execute the ith tactical action, and further provides the first NPC to determine the target tactical action, so that the first NPC can flexibly select the target tactical action, the degree of intellectualization of the first NPC is improved, and the development of competition between the NPCs and player characters through the cooperative combat mode is ensured.
In order to implement the collaborative combat of multiple NPCs in the NPC team, step 240 may be replaced with step 241 based on the embodiment shown in fig. 2, and fig. 9 shows a flowchart of a control method of NPCs provided in an exemplary embodiment of the present application, where each NPC in the NPC team corresponds to an action information table, and the action information table is used to record the tactical action being performed by the NPC.
Step 220, acquiring cooperative tactical information of the NPC team;
the collaborative tactical information is used to indicate at least one tactical action that a plurality of NPCs in the NPC team need to perform, each NPC in the plurality of NPCs being used to perform one of the at least one tactical action, the same tactical action being performed by the at least one NPC;
in one embodiment, the terminal obtains collaborative tactical information for a pre-set NPC team. Optionally, collaborative tactical information of the NPC team is preset by a developer through codes, and cannot be changed by a user; optionally, the collaborative tactic information of the NPC team may be manually changed by the user, and the user may adjust the collaborative tactic information of the NPC team, thereby reducing or improving the athletic difficulty.
For example, there is an adjustment control of cooperative tactical information of NPC team on an application running with a competitive environment, the cooperative tactical information of the initial NPC team includes 3 NPC performing shots, 2 NPC performing movements, and the user can modify to 1 NPC performing shot, 4 NPC performing movements through the adjustment control.
Step 241, inquiring the number of NPCs executing the ith tactical action in other NPCs through the number inquiry interfaces of the action information tables of other NPCs;
action information table: the system comprises at least one tactical action, wherein each tactical action comprises at least one tactical sub-action, the action information table is provided with action values corresponding to the tactical sub-actions one by one, and the action values are used for identifying the tactical sub-actions being executed by the NPC.
Optionally, the action information table includes at least one tactical action of shooting, moving, performing, commanding, competing for shelter, squatting, evading a mine, post-detour attack, searching for enemies and evading friends;
the action information table includes n kinds of tactical actions of the cooperative tactical information. Illustratively, table 1 below shows a table of action information.
TABLE 1
Tactical action Action value
Shooting 1
Movement of 0
The action information table shown in table 1 is provided with two tactical actions (shooting and moving), the shooting includes 3 tactical actions, namely standing shooting (action value of 1), shelter shooting (action value of 2) and moving shooting (action value of 3), and the moving includes 2 tactical actions, namely shelter moving (action value of 1) and non-shelter moving (action value of 2). 0 indicates that the current tactical action category is not performed.
From table 1 it can be derived that the first NPC is currently performing standing shots. At this time, the cooperative tactical information includes (shooting and moving) two tactical actions.
Illustratively, table 2 below shows a table of action information.
TABLE 2
Figure GDA0004177922850000121
Figure GDA0004177922850000131
The action information table shown in table 2 is provided with 10 tactical actions (shooting, moving, performing, commanding, competing for shelter, squatting, avoiding grenade, post-detour attack, searching enemy and avoiding friend party), the shooting comprises 3 tactical actions, namely standing shooting (action value is 1), shelter shooting (action value is 2) and moving shooting (action value is 3);
the movements included 2 tactical sub-movements, along the shelter (action value 1) and non-shelter (action value 2), respectively. The performances include 6 tactical sub-actions, namely a skill performance (action value 1), a projectile change performance (action value 2), an aggressive performance (action value 3), an anger performance (action value 4), a tumbling performance (action value 5) and a firestopping performance (action value 6), respectively; competing shelter includes 1 tactical action to compete for the current shelter (action value 1); squat included 2 tactical actions, squat inside the shelter (action value 1) and squat outside the shelter (action value 2), respectively. The avoidance grenade comprises 1 tactical action, which is to avoid the current grenade (the action value is 1); the post-wraparound attack comprises 1 tactical action, which is a sudden attack (the action value is 1); searching for enemy includes 1 tactical action, which is a frontal search (action value 1); the friend evasion party comprises 1 tactical action, which is the attack of the friend evasion party (the action value is 1);
It should be noted that 0 indicates that the current tactical action category is not performed, and the tactical action category indicated by the cooperative tactical information is n kinds of tactical action categories on the action information table.
As can be taken from table 2, the first NPC is currently performing standing shots, shelter-outside squats, assaults, and friend-evading attacks.
It should be noted that, the action information table can also set other kinds of tactical actions according to the mind of the planner, or set other tactical actions under one tactical action, so that the tactical actions and tactical actions of the planner for setting the NPC become very simple and convenient, and the tactical system of the NPC team is greatly enriched.
Another point to be explained is that n kinds of tactical actions of the cooperative tactical information are n kinds of tactical actions of the several kinds of tactical actions shown as the action information table, and the tactical action being performed by the first NPC shown in the action information table should be two kinds of tactical actions that are not mutually exclusive, for example, the first NPC is performing movement (tactical action), and the action value of the shooting (tactical action) of the first NPC is not 1 (standing shooting).
In one embodiment, the terminal may query the number of NPCs performing the ith tactical action in the other NPCs through the number query interface of the action information table of the other NPCs, by including the steps of:
S1, acquiring an action value of an ith tactical action of each NPC in other NPCs through an action query interface of an action information table, and determining and acquiring tactical sub-actions which are being executed by each NPC in the ith tactical action in other NPCs;
the action information table of each NPC is provided with an action query interface, through the action query interface, the terminal obtains action values of ith tactical actions of each NPC in other NPCs, the action values correspond to tactical sub-actions under the ith tactical actions one by one, and the terminal determines and obtains the tactical sub-actions being executed by each NPC in the other NPCs in the ith tactical actions through the action values.
Illustratively, the terminal obtains an action value of 2 under the firing (tactical action) of the second NPC from the other NPCs, and determines that the second NPC is performing mobile firing; the terminal obtains an action value of 3 at the firing (tactical action) of the third NPC among the other NPCs, and determines that the second NPC is performing shelter firing.
S2, obtaining the number of NPCs for executing the ith tactical action in the other NPCs by counting the number of NPCs for executing each tactical sub-action in the ith tactical action in the other NPCs;
in connection with the example of S2, the terminal counts the number of NPCs performing standing shots among other NPCs performing shots (tactical actions) as 0, the number of NPCs performing moving shots as 1, and the number of NPCs performing shelter shots as 1. The terminal further counts the number of NPCs performing shots among the other NPCs as 2.
S3, acquiring the number of NPCs executing the ith tactical action in other NPCs through the number query interface of the action information table.
In one embodiment, all action information tables of the NPC team are jointly provided with a quantity query interface, the quantity query interface is used for acquiring the number of NPCs executing the ith tactical action in other NPCs by the terminal, and in combination with the example of S2, the terminal can acquire the number of NPCs executing shooting in other NPCs as 2 through the quantity query interface.
Step 260, obtaining tactical action execution conditions of other NPCs except the first NPC in the NPC team, and determining a target tactical action to be executed by the first NPC;
wherein the tactical action performance is used to indicate the kind of tactical action being performed by other NPCs;
in one embodiment, the terminal determines, according to the cooperative tactical information and tactical action execution conditions of other NPCs, a tactical action category of the other NPCs, where the tactical action category is an ith tactical action in the cooperative tactical information, and the terminal determines that the first NPC executes the ith tactical action, and further determines that the first NPC needs to execute a tactical sub-action under the ith tactical action, where the tactical sub-action is a target tactical action.
Alternatively, the tactical actions of the other NPCs are performed in a manner not conforming to the collaborative tactical information, meaning that the number of NPCs of the other NPCs performing the ith tactical action is less than the number of NPCs performing the ith tactical action indicated by the collaborative tactical information.
Step 280, controlling the first NPC to perform a target tactical action;
the manner in which the terminal controls the first NPC to perform the target tactical action includes at least two of:
the method comprises the steps that a first terminal determines that a first NPC randomly executes tactical actions in an ith tactical action;
from the above, the ith tactical action is a tactical action class in which the tactical action execution situation of the other NPCs does not conform to the cooperative tactical information, and the terminal randomly selects one tactical sub-action from the ith tactical action for the first NPC to execute.
The second, terminal determines that the first NPC performs the j-th tactical sub-action of the i-th tactical action based on the number of NPCs of other NPCs performing the j-th tactical sub-action of the i-th tactical action being less than the number of NPCs of the cooperative tactical information indicating the j-th tactical sub-action of the i-th tactical action.
The j-th tactical sub-action is one of the tactical sub-actions under the i-th tactical action. On the premise that the terminal determines that the first NPC performs the ith tactical action, the terminal determines that the first NPC performs the jth tactical action of the ith tactical action based on the number of NPCs performing the jth tactical action of the ith tactical action in other NPCs being less than the number of NPCs of the cooperative tactical information indicating the jth tactical action performing the ith tactical action.
In step 290, the action value of the ith tactical action in the action information table of the first NPC is modified.
After the terminal controls the first NPC to perform the target tactical action, the terminal changes an action value of the ith tactical action in the action information table of the first NPC to an action value corresponding to the target tactical action.
In summary, according to the method, by setting the action information table corresponding to each NPC, the terminal can acquire the tactical action or tactical sub-action being executed by the NPC more quickly and conveniently, and setting the action information table corresponding to each NPC greatly facilitates the developer to modify (delete, correct and increase) the tactical action or tactical sub-action to be executed by the NPC, so that the workload of the developer to modify the tactical action or tactical sub-action of the NPC is greatly reduced, the labor cost and the machine cost are reduced, and the method can realize various tactical coordination by the NPC team.
In order to realize the collaborative combat of multiple NPCs in the NPC team, step 220 further includes step 211 and step 212 before step 220 based on the embodiment shown in fig. 2, and fig. 10 is a flowchart illustrating a control method of NPCs according to an exemplary embodiment of the present application.
Step 211, configuring state switching conditions of a state machine;
The state machine is used for switching an athletic state of the first NPC, the athletic state indicates a behavior mode of the first NPC in the athletic environment, and optionally, the first athletic state is any one of a leisure state, an alert state and a fight state. The second competitive state is any one of a leisure state, an armed state, and a combat state except for the first competitive state.
Optionally, the leisure state is a behavior mode of the first NPC under the condition that the first NPC is not disturbed by the player character, the alert state is a behavior mode of the first NPC under the condition that the first NPC is slightly disturbed by the player character, and the fight state is a behavior mode of the first NPC under the condition that the first NPC is severely disturbed by the player character.
The state switching condition is an operation logic for controlling the state machine to switch, and in the embodiment of the present application, the state switching condition can be obtained through configuration of a developer.
In step 212, based on the first NPC satisfying the state switching condition, the first NPC is switched from the first competitive state to the second competitive state by the state machine, and the first NPC is controlled to start executing the behavioral tree of the second competitive state.
The athletic status corresponds to the action tree one by one, and the action tree of the second athletic status is used to execute steps 220 to 280 of the embodiment shown in fig. 2.
Optionally, in response to the distance between the first NPC and the player character being in the second distance range, switching the first NPC from the first athletic status to the second athletic status by the state machine;
the second distance range includes an alert range and a combat range.
Optionally, based on the time length that the distance between the first NPC and the player character is in the second distance range reaching a second time length threshold, switching the first NPC from the first athletic status to the second athletic status by the state machine;
the second duration threshold includes a duration threshold for which the player character is in the alert range (i.e., alert duration threshold), and a duration threshold for which the player character is in the combat range (i.e., combat duration threshold).
Optionally, in response to the biological attribute of the first NPC being curtailed, the first NPC is switched from the first competitive state to the second competitive state by a state machine.
The biological attribute includes, but is not limited to, at least one of a life value, an energy value, a movement speed, and a physical strength value of the first NPC.
In one embodiment, the first competitive state is a casual state and the second competitive state is an alert state, and the state machine switches the casual state to the alert state when the player character is present in the alert range of the first NPC, or switches the casual state to the alert state when the duration of the player character present in the alert range of the first NPC reaches an alert duration threshold.
In one embodiment, the first competitive state is a recreational state and the second competitive state is a combat state, and the state machine switches the recreational state to the combat state in the event that the first NPC is attacked by the player character and the biological properties of the first NPC are reduced.
In one embodiment, the first competitive state is a armed state, the second competitive state is a combat state, the state machine switches the armed state to the combat state if the first NPC is attacked by the player character and the biological attribute of the first NPC is reduced, or the state machine switches the armed state to the combat state if the player character is present in the combat zone of the first NPC, or the state machine switches the armed state to the combat state if the length of time the player character is present in the combat zone of the first NPC reaches a combat duration threshold.
In one embodiment, the first competitive state is an armed state and the second competitive state is a casual state, and the state machine switches the armed state to the casual state in the event that the duration of the disappearance of the player character within the armed range of the first NPC reaches the armed disappearance duration.
In one embodiment, the first competitive state is a combat state and the second competitive state is an alert state, and the state machine switches the combat state to the alert state in the event that the length of time the player character disappears within the combat range of the first NPC reaches the combat disappearance length.
FIG. 11 is a schematic diagram of an implementation environment of a "state machine+behavioral tree" by which the competitive state of the first NPC may be switched to a recreational state, an armed state, and a combat state, according to an example embodiment of this application. In the leisure state, the first NPC is controlled to perform the leisure state behavior tree 1101, and illustratively, the first NPC performs patrol 1104 (tactical action). In the armed state, the first NPC performs an armed state action tree 1102, illustratively, the first NPC performs an armed performance action 1105 (tactical action), or searches for an enemy (tactical action) 1106.
In the combat state, the first NPC performs the combat state behavior tree 1103, first, the terminal determines the target tactical action 1107, the terminal acquires the number of NPCs performing shooting 1110, the terminal determines whether the number of NPCs performing shooting does not conform to the tactical collaboration information 1111, the first NPC performs shooting 1112 if the number of NPCs performing shooting does not conform to the tactical collaboration information, and the terminal acquires the number of NPCs performing shooting 1113 if the number of NPCs performing shooting conforms to the tactical collaboration information.
The terminal determines whether the number of NPCs performing the movement does not conform to the tactical coordination information 1114, and in the case where the number of NPCs performing the movement does not conform to the tactical coordination information, the first NPC performs the movement 1115.
By analogy, the terminal obtains the number of NPCs 1116 that perform the n-1 st tactical action, the terminal determines whether the number of NPCs that perform the n-1 st tactical action does not conform to the tactical collaboration information 1117, the first NPC performs the n-1 st tactical action 1118 if the number of NPCs that perform the n-1 st tactical action does not conform to the tactical collaboration information, the terminal obtains the number of NPCs 1119 that perform the n-1 st tactical action if the number of NPCs that perform the n-1 st tactical action conforms to the tactical collaboration information, and the first NPC performs the n-th tactical action 1120.
The terminal then controls the first NPC to perform the target tactical action 1108, and finally, the terminal updates the action information table 1109 of the first NPC.
In summary, by setting the mode of the state machine and the behavior tree, and the state switching condition of the state machine is configurable, the first NPC is ensured to flexibly switch the competitive state, the intelligent degree of the first NPC is improved, the mode of the state machine and the behavior tree also greatly reduces the working difficulty of planners, developers and operation and maintenance personnel, and the whole working logic is clearer and more visual.
Fig. 12 is a schematic structural diagram of a control device of a non-player character NPC according to an exemplary embodiment of the present application, where the device operates with control logic of a first NPC, and the first NPC belongs to an NPC team, and the device includes:
An obtaining module 1201 configured to obtain collaborative tactical information of an NPC team, the collaborative tactical information being configured to indicate at least one tactical action to be performed by a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs being configured to perform one of the at least one tactical action, the same tactical action being performed by the at least one NPC;
an obtaining module 1201, configured to obtain tactical action performance of other NPCs in the NPC team except the first NPC, where the tactical action performance is used to indicate a tactical action category being performed by the other NPCs;
a determining module 1202, configured to determine, according to the collaborative tactical information and tactical action performance of other NPCs, a target tactical action to be performed by the first NPC;
a control module 1203 is configured to control the first NPC to perform the target tactical action.
In an alternative embodiment, the collaborative tactical information includes n tactical actions, n being an integer greater than 1.
In an alternative embodiment, the acquiring module 1201 and the determining module 1202 are configured to acquire, together, performance of an ith tactical action of other NPCs in the NPC team, except for the first NPC, where i is a positive integer no greater than n, and the initial i has a value of 1.
In an alternative embodiment, the acquiring module 1201 and the determining module 1202 are configured to determine that the first NPC performs the ith tactical action if the performance of the ith tactical action does not conform to collaborative tactical information.
In an alternative embodiment, the obtaining module 1201 and the determining module 1202 are used together to update i+1 to i and to re-perform the step of obtaining the execution of the ith tactical action of the NPC team other than the first NPC if the execution of the ith tactical action meets the collaborative tactical information and i is not equal to n.
In an alternative embodiment, the determining module 1202 is configured to determine that the first NPC performs the ith tactical action if the first NPC number is less than the second NPC number, the first NPC number being the number of NPCs performing the ith tactical action among the other NPCs, the second NPC number being the number of NPCs performing the ith tactical action indicated by the collaborative tactical information.
In an alternative embodiment, the tactical action performance includes performance of n tactical actions, the n tactical actions ordered by tactical priority.
In an alternative embodiment, each NPC in the NPC team corresponds to a table of action information for recording tactical actions being performed by the NPC.
In an alternative embodiment, the obtaining module 1201 is further configured to query, through the number query interface of the action information table of the other NPCs, the number of NPCs that perform the ith tactical action in the other NPCs.
In an alternative embodiment, the action information table includes action values of at least one tactical action, each tactical action including at least one tactical sub-action, the action information table being provided with action values in one-to-one correspondence with the tactical sub-actions, the action values being used to identify the tactical sub-action being performed by the NPC.
In an alternative embodiment, the obtaining module 1201 is further configured to obtain, through the action query interface of the action information table, an action value of the ith tactical action of each of the other NPCs, and determine and obtain a tactical sub-action that each of the other NPCs is performing in the ith tactical action.
In an alternative embodiment, the obtaining module 1201 is further configured to obtain the number of NPCs performing the ith tactical action in the other NPCs by counting the number of NPCs performing each of the ith tactical actions in the other NPCs.
In an alternative embodiment, the obtaining module 1201 is further configured to obtain, through the quantity query interface of the action information table, the number of NPCs that perform the ith tactical action among the other NPCs.
In an alternative embodiment, the apparatus further comprises a modification module 1204.
In an alternative embodiment, the modification module 1204 is configured to modify the action value of the ith tactical action in the action information table of the first NPC.
In an alternative embodiment, the control module 1203 is further configured to control the first NPC to randomly perform a tactical sub-action of the ith tactical action.
In an alternative embodiment, the control module 1203 is further configured to control the first NPC to perform the j-th tactical sub-action of the i-th tactical action based on the third NPC number being the number of NPCs of the other NPCs performing the j-th tactical sub-action of the i-th tactical action being smaller than the fourth NPC number, where the fourth NPC number is the number of NPCs of the collaborative tactical information indicating the j-th tactical sub-action performing the i-th tactical action, j being a positive integer.
In an alternative embodiment, the obtaining module 1201, the determining module 1202, the controlling module 1203 and the modifying module 1204 together form a behavior tree of the second athletic status; the athletic status corresponds to the action tree one by one; the athletic status indicates a mode of behavior the first NPC is in an athletic environment.
In an alternative embodiment, the apparatus further comprises a switching module 1205. The switching module 1205 is configured to switch the first NPC from the first athletic status to the second athletic status through the state machine based on the first NPC satisfying the status switching condition, and control the first NPC to start executing the behavioral tree of the second athletic status.
In an alternative embodiment, the switching module 1205 is further configured to switch the first NPC from the first athletic status to the second athletic status via the state machine in response to the distance between the first NPC and the player character being within the second distance range.
In an alternative embodiment, the switching module 1205 is further configured to switch, by the state machine, the first NPC from the first athletic status to the second athletic status based on the duration that the distance between the first NPC and the player character is within the second distance range reaching a second duration threshold.
In an alternative embodiment, the switching module 1205 is further configured to switch the first NPC from the first competitive state to the second competitive state via the state machine in response to the biological attribute of the first NPC being clipped.
In an alternative embodiment, the apparatus further comprises a configuration module 1206.
In an alternative embodiment, configuration module 1206 is configured to configure state switching conditions of the state machine.
In an alternative embodiment, the NPC team is partitioned based on the distance of the NPC in the athletic environment, or the NPC team is pre-partitioned based on the athletic performance prior to the start.
In summary, the device determines the target tactical actions to be executed by the first NPC according to the tactical action execution conditions of other NPCs and the cooperative tactical information, so that the first NPC can flexibly select the target tactical actions, the degree of intellectualization of the first NPC is improved, and the NPC and player characters are ensured to develop competition in a cooperative combat mode.
Fig. 13 shows a block diagram of an electronic device 1300 provided in an exemplary embodiment of the present application. The electronic device 1300 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion picture expert compression standard audio plane 3), an MP4 (Moving Picture Experts Group Audio Layer IV, motion picture expert compression standard audio plane 4) player, a notebook computer, or a desktop computer. The electronic device 1300 may also be referred to by other names as user device, portable terminal, laptop terminal, desktop terminal, etc.
In general, the electronic device 1300 includes: a processor 1301, and a memory 1302.
Processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. Processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). Processor 1301 may also include a main processor, which is a processor for processing data in an awake state, also called a CPU (Central Processing Unit ), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, processor 1301 may integrate a GPU (Graphics Processing Unit, image processor) for taking care of rendering and rendering of content that the display screen needs to display. In some embodiments, processor 1301 may also include an AI processor for processing computing operations related to machine learning.
Memory 1302 may include one or more computer-readable storage media, which may be non-transitory. Memory 1302 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 1302 is used to store at least one instruction for execution by processor 1301 to implement the control method of the non-player character NPC provided by the method embodiments herein.
In some embodiments, the electronic device 1300 may further optionally include: a peripheral interface 1303 and at least one peripheral. The processor 1301, the memory 1302, and the peripheral interface 1303 may be connected by a bus or signal lines. The respective peripheral devices may be connected to the peripheral device interface 1303 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 1304, a display screen 1305, a camera assembly 1306, audio circuitry 1307, and a power supply 1308.
A peripheral interface 1303 may be used to connect I/O (Input/Output) related at least one peripheral to the processor 1301 and the memory 1302. In some embodiments, processor 1301, memory 1302, and peripheral interface 1303 are integrated on the same chip or circuit board; in some other embodiments, either or both of the processor 1301, the memory 1302, and the peripheral interface 1303 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 1304 converts an electrical signal to an electromagnetic signal for transmission, or converts a received electromagnetic signal to an electrical signal. Optionally, the radio frequency circuit 1304 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuit 1304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the world wide web, metropolitan area networks, intranets, generation mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity ) networks. In some embodiments, the radio frequency circuit 1304 may also include NFC (Near Field Communication ) related circuits, which are not limited in this application.
The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 1305 is a touch display, the display 1305 also has the ability to capture touch signals at or above the surface of the display 1305. The touch signal may be input to the processor 1301 as a control signal for processing. At this point, the display 1305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 1305 may be one and disposed on the front panel of the electronic device 1300; in other embodiments, the display screen 1305 may be at least two, respectively disposed on different surfaces of the electronic device 1300 or in a folded design; in other embodiments, the display 1305 may be a flexible display disposed on a curved surface or a folded surface of the electronic device 1300. Even more, the display screen 1305 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The display screen 1305 may be made of LCD (Liquid Crystal Display ), OLED (Organic Light-Emitting Diode) or other materials.
The camera assembly 1306 is used to capture images or video. Optionally, camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal and the rear camera is disposed on the rear surface of the terminal. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments, camera assembly 1306 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuit 1307 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and environments, converting the sound waves into electric signals, and inputting the electric signals to the processor 1301 for processing, or inputting the electric signals to the radio frequency circuit 1304 for voice communication. For purposes of stereo acquisition or noise reduction, the microphone may be multiple, and disposed at different locations of the electronic device 1300. The microphone may also be an array microphone or an omni-directional pickup microphone. The speaker is then used to convert electrical signals from the processor 1301 or the radio frequency circuit 1304 into sound waves. The speaker may be a conventional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to humans, but also the electric signal can be converted into a sound wave inaudible to humans for ranging and other purposes. In some embodiments, the audio circuit 1307 may also comprise a headphone jack.
The power supply 1308 is used to power the various components in the electronic device 1300. The power source 1308 may be alternating current, direct current, a disposable battery, or a rechargeable battery. When the power source 1308 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the electronic device 1300 also includes one or more sensors 1309. The one or more sensors 1309 include, but are not limited to: acceleration sensor 1310, gyroscope sensor 1311, pressure sensor 1312, optical sensor 1313, and proximity sensor 1314.
The acceleration sensor 1310 may detect the magnitudes of accelerations on three coordinate axes of the coordinate system established with the electronic device 1300. For example, the acceleration sensor 1310 may be used to detect components of gravitational acceleration in three coordinate axes. Processor 1301 may control display screen 1305 to display a user interface in either a landscape view or a portrait view based on the gravitational acceleration signal acquired by acceleration sensor 1310. Acceleration sensor 1310 may also be used for the acquisition of motion data for games or users.
The gyro sensor 1311 may detect a body direction and a rotation angle of the electronic apparatus 1300, and the gyro sensor 1311 may collect a 3D motion of the user on the electronic apparatus 1300 in cooperation with the acceleration sensor 1310. Processor 1301 can implement the following functions based on data collected by gyro sensor 1311: motion sensing (e.g., changing UI according to a tilting operation by a user), image stabilization at shooting, game control, and inertial navigation.
Pressure sensor 1312 may be disposed on a side frame of electronic device 1300 and/or on an underlying layer of display screen 1305. When the pressure sensor 1312 is disposed on a side frame of the electronic device 1300, a grip signal of the user on the electronic device 1300 may be detected, and the processor 1301 may perform left-right hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 1312. When the pressure sensor 1312 is disposed at the lower layer of the display screen 1305, the processor 1301 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
The optical sensor 1313 is used to collect ambient light intensity. In one embodiment, processor 1301 may control the display brightness of display screen 1305 based on the intensity of ambient light collected by optical sensor 1313. Specifically, when the intensity of the ambient light is high, the display brightness of the display screen 1305 is turned up; when the ambient light intensity is low, the display brightness of the display screen 1305 is turned down. In another embodiment, processor 1301 may also dynamically adjust the shooting parameters of camera assembly 1306 based on the intensity of ambient light collected by optical sensor 1313.
A proximity sensor 1314, also referred to as a distance sensor, is typically provided on the front panel of the electronic device 1300. The proximity sensor 1314 is used to capture the distance between the user and the front of the electronic device 1300. In one embodiment, when proximity sensor 1314 detects a gradual decrease in distance between the user and the front of electronic device 1300, processor 1301 controls display screen 1305 to switch from a bright screen state to a inactive screen state; when the proximity sensor 1314 detects that the distance between the user and the front of the electronic device 1300 gradually increases, the processor 1301 controls the display screen 1305 to switch from the off-screen state to the on-screen state.
Those skilled in the art will appreciate that the structure shown in fig. 13 is not limiting of the electronic device 1300 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
The application further provides a computer readable storage medium, in which at least one instruction, at least one section of program, a code set or an instruction set is stored, where the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by a processor to implement the control method of the non-player character NPC provided by the above method embodiment.
The present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the control method of the non-player character NPC provided in the above method embodiment.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments is merely exemplary in nature and is in no way intended to limit the invention, since it is intended that all modifications, equivalents, improvements, etc. that fall within the spirit and scope of the invention.

Claims (12)

1. A method for controlling NPC of a non-player character, applied to a terminal, where the terminal operates control logic of a first NPC, and the first NPC belongs to an NPC team, the method comprising:
Obtaining collaborative tactical information of the NPC team, the collaborative tactical information being indicative of at least one tactical action to be performed by a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs being configured to perform one of the at least one tactical action, a same tactical action being performed by at least one NPC; the cooperative tactical information includes n tactical actions, n being an integer greater than 1;
acquiring tactical action performance cases of other NPCs except the first NPC in the NPC team, wherein the tactical action performance cases are used for indicating the types of tactical actions being executed by the other NPCs, the tactical action performance cases comprise n kinds of tactical action performance cases, and the n kinds of tactical actions are ordered according to tactical priority; determining a target tactical action to be executed by the first NPC according to the cooperative tactical information and tactical action execution conditions of the other NPCs;
the obtaining tactical action execution conditions of other NPCs except the first NPC in the NPC team, and determining a target tactical action to be executed by the first NPC according to the collaborative tactical information and the tactical action execution conditions of the other NPCs, including:
Acquiring the execution condition of the ith tactical action of other NPCs except the first NPC in the NPC team, wherein i is a positive integer not more than n, and the initial value of i is 1; determining that the first NPC performs the ith tactical action if the first NPC number is less than a second NPC number, the first NPC number being the number of NPCs performing the ith tactical action among the other NPCs, the second NPC number being the number of NPCs performing the ith tactical action indicated by the cooperative tactical information; updating i+1 to i under the condition that the number of the first NPCs is not less than the number of the second NPCs and i is not equal to n, and executing the step of acquiring the execution condition of the ith tactical action of other NPCs except the first NPC in the NPC team again;
controlling the first NPC to perform the target tactical action.
2. The method of claim 1, wherein each NPC in the NPC team corresponds to a table of action information for recording tactical actions being performed by the NPC;
the acquiring tactical action performance of other NPCs in the NPC team, except the first NPC, includes:
And querying the number of NPCs executing the ith tactical action in the other NPCs through a number query interface of the action information table of the other NPCs.
3. The method of claim 2, wherein the action information table includes action values of at least one tactical action, each tactical action including at least one tactical sub-action, the action information table being provided with action values in one-to-one correspondence with the tactical sub-actions, the action values being used to identify the tactical sub-action being performed by the NPC;
the querying, through a quantity query interface of the action information table of the NPC team, the number of NPCs performing the ith tactical action in the NPC team, including:
acquiring an action value of an ith tactical action of each NPC in the other NPCs through an action query interface of the action information table, and determining and acquiring a tactical sub-action being executed by each NPC in the other NPCs in the ith tactical action;
obtaining the number of NPCs performing the ith tactical action in the other NPCs by counting the number of NPCs performing each tactical sub-action in the ith tactical action in the other NPCs;
and acquiring the number of NPCs executing the ith tactical action in the other NPCs through the number query interface of the action information table.
4. The method of claim 3, wherein the controlling the first NPC to perform the target tactical action further comprises:
and changing the action value of the ith tactical action in the action information table of the first NPC.
5. The method of any one of claims 1 to 4, wherein the controlling the first NPC to perform the target tactical action comprises:
controlling the first NPC to randomly perform a tactical sub-action of the ith tactical action;
or alternatively, the first and second heat exchangers may be,
controlling the first NPC to perform the j-th tactical sub-action of the i-th tactical action based on the third NPC number being less than the fourth NPC number, the third NPC number being the NPC number of the other NPCs performing the j-th tactical sub-action of the i-th tactical action, the fourth NPC number being the NPC number of the collaborative tactical information indicating the j-th tactical sub-action performing the i-th tactical action, j being a positive integer.
6. The method according to any one of claims 1 to 4, characterized in that it is performed by a behavioral tree of a second competitive state; the athletic status corresponds to the action tree one by one; the athletic status indicates a behavioral pattern in which the first NPC is located in an athletic environment;
The method further comprises the steps of:
based on the first NPC meeting a state switching condition, switching the first NPC from a first competitive state to the second competitive state through a state machine, and controlling the first NPC to start executing a behavior tree of the second competitive state.
7. The method of claim 6, wherein switching the first NPC from a first competitive state to the second competitive state via a state machine based on the first NPC satisfying a state switch condition comprises:
responsive to the distance between the first NPC and the player character being in a second distance range, switching the first NPC from the first athletic state to the second athletic state by the state machine;
or alternatively, the first and second heat exchangers may be,
switching the first NPC from the first athletic state to the second athletic state through the state machine based on a time length of a distance between the first NPC and the player character in a second distance range reaching a second time length threshold;
or alternatively, the first and second heat exchangers may be,
switching, by the state machine, the first NPC from the first competitive state to the second competitive state in response to the biological attribute of the first NPC being curtailed.
8. The method of claim 6, wherein the method further comprises:
and configuring state switching conditions of the state machine.
9. The method of any one of claims 1 to 4, wherein the NPC team is partitioned based on a distance of the NPC in the athletic environment, or wherein the NPC team is pre-partitioned based on a pre-athletic start.
10. A control device for a non-player character NPC, the device operating with control logic for a first NPC, the first NPC belonging to a NPC team, the device comprising:
an acquisition module for acquiring collaborative tactical information of the NPC team, the collaborative tactical information being indicative of at least one tactical action that is required to be performed by a plurality of NPCs in the NPC team, each NPC in the plurality of NPCs being configured to perform one of the at least one tactical action, a same tactical action being performed by at least one NPC; the cooperative tactical information includes n tactical actions, n being an integer greater than 1;
the system comprises an acquisition module, a strategy action execution module and a strategy action management module, wherein the acquisition module is used for acquiring tactical action execution conditions of other NPCs except the first NPC in the NPC team, the tactical action execution conditions are used for indicating the types of tactical actions being executed by the other NPCs, the tactical action execution conditions comprise execution conditions of n tactical actions, and the n tactical actions are ordered according to tactical priorities; a determining module, configured to determine, according to the collaborative tactical information and tactical action execution conditions of the other NPCs, a target tactical action to be executed by the first NPC;
The acquiring module is further configured to acquire an execution condition of an ith tactical action of other NPCs except the first NPC in the NPC team, where i is a positive integer not greater than n, and an initial value of i is 1; the determining module is further configured to determine that the first NPC performs the ith tactical action if a first NPC number is less than a second NPC number, the first NPC number being a number of NPCs that perform the ith tactical action among the other NPCs, the second NPC number being a number of NPCs that the collaborative tactical information indicates to perform the ith tactical action; updating i+1 to i in case that the first number of NPCs is not smaller than the second number of NPCs and i is not equal to n, the obtaining module being further configured to re-execute the step of obtaining the execution of the ith tactical action of NPCs other than the first NPC in the NPC team;
and the control module is used for controlling the first NPC to execute the target tactical action.
11. A computer device, the computer device comprising: a processor and a memory storing a computer program that is loaded and executed by the processor to implement the control method of the non-player character NPC according to any one of claims 1 to 9.
12. A computer readable storage medium storing a computer program loaded and executed by a processor to implement the method of controlling a non-player character NPC according to any one of claims 1 to 9.
CN202110870050.5A 2021-07-30 2021-07-30 Non-player character NPC control method, device, equipment and medium Active CN113577781B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110870050.5A CN113577781B (en) 2021-07-30 2021-07-30 Non-player character NPC control method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110870050.5A CN113577781B (en) 2021-07-30 2021-07-30 Non-player character NPC control method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN113577781A CN113577781A (en) 2021-11-02
CN113577781B true CN113577781B (en) 2023-06-16

Family

ID=78252548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110870050.5A Active CN113577781B (en) 2021-07-30 2021-07-30 Non-player character NPC control method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN113577781B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114307150B (en) * 2022-01-07 2023-07-14 腾讯科技(深圳)有限公司 Method, device, equipment, medium and program product for interaction between virtual objects

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002325971A (en) * 2001-05-02 2002-11-12 Namco Ltd Game information, character information administering information, information storage medium, game system, and server system
JP2009136411A (en) * 2007-12-05 2009-06-25 Namco Bandai Games Inc Program, information storage medium, and game device
JP2011136128A (en) * 2010-01-04 2011-07-14 Konami Digital Entertainment Co Ltd Match game system, and game progress control method there
CN102136025A (en) * 2010-12-31 2011-07-27 北京像素软件科技股份有限公司 Intelligent controlling method of non player characters
JP5678368B1 (en) * 2014-08-12 2015-03-04 株式会社gloops GAME SERVER, GAME CONTROL METHOD, GAME PROGRAM, AND GAME PROGRAM RECORDING MEDIUM
CN106621334A (en) * 2016-09-27 2017-05-10 网易(杭州)网络有限公司 Control method and device of non-player-controlled character
CN107019912A (en) * 2017-04-20 2017-08-08 腾讯科技(深圳)有限公司 The collocation method and device of role

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5357230B2 (en) * 2011-09-14 2013-12-04 株式会社バンダイナムコゲームス PROGRAM, INFORMATION STORAGE MEDIUM, AND GAME DEVICE
US10315113B2 (en) * 2015-05-14 2019-06-11 Activision Publishing, Inc. System and method for simulating gameplay of nonplayer characters distributed across networked end user devices

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002325971A (en) * 2001-05-02 2002-11-12 Namco Ltd Game information, character information administering information, information storage medium, game system, and server system
JP2009136411A (en) * 2007-12-05 2009-06-25 Namco Bandai Games Inc Program, information storage medium, and game device
JP2011136128A (en) * 2010-01-04 2011-07-14 Konami Digital Entertainment Co Ltd Match game system, and game progress control method there
CN102136025A (en) * 2010-12-31 2011-07-27 北京像素软件科技股份有限公司 Intelligent controlling method of non player characters
JP5678368B1 (en) * 2014-08-12 2015-03-04 株式会社gloops GAME SERVER, GAME CONTROL METHOD, GAME PROGRAM, AND GAME PROGRAM RECORDING MEDIUM
CN106621334A (en) * 2016-09-27 2017-05-10 网易(杭州)网络有限公司 Control method and device of non-player-controlled character
CN107019912A (en) * 2017-04-20 2017-08-08 腾讯科技(深圳)有限公司 The collocation method and device of role

Also Published As

Publication number Publication date
CN113577781A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
US11471768B2 (en) User interface display method and apparatus, device and computer-readable storage medium
CN108434736B (en) Equipment display method, device, equipment and storage medium in virtual environment battle
JP7419382B2 (en) Method and apparatus and computer program for controlling a virtual object to mark a virtual item
WO2021143259A1 (en) Virtual object control method and apparatus, device, and readable storage medium
CN112494955B (en) Skill releasing method, device, terminal and storage medium for virtual object
WO2020244415A1 (en) Method and apparatus for controlling virtual object to discard virtual item, and medium
WO2021184806A1 (en) Interactive prop display method and apparatus, and terminal and storage medium
CN113426124B (en) Display control method and device in game, storage medium and computer equipment
CN113713383B (en) Throwing prop control method, throwing prop control device, computer equipment and storage medium
CN111589141B (en) Virtual environment picture display method, device, equipment and medium
CN112870699B (en) Information display method, device, equipment and medium in virtual environment
WO2021031765A1 (en) Application method and related apparatus of sighting telescope in virtual environment
CN111659117A (en) Virtual object display method and device, computer equipment and storage medium
WO2023029836A1 (en) Virtual picture display method and apparatus, device, medium, and computer program product
CN111921190A (en) Method, device, terminal and storage medium for equipping props of virtual objects
CN113134232B (en) Virtual object control method, device, equipment and computer readable storage medium
CN113577781B (en) Non-player character NPC control method, device, equipment and medium
KR20220088797A (en) Method and apparatus, device and storage medium for determining a selected target
CN111589117B (en) Method, device, terminal and storage medium for displaying function options
CN111921200B (en) Virtual object control method and device, electronic equipment and storage medium
CN111530075B (en) Method, device, equipment and medium for displaying picture of virtual environment
JPWO2021143259A5 (en)
US20230271087A1 (en) Method and apparatus for controlling virtual character, device, and storage medium
CN113680058B (en) Use method, device, equipment and storage medium for restoring life value prop
CN112402969B (en) Virtual object control method, device, equipment and storage medium in virtual scene

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40055288

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant