Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiment of the present invention, there is provided a method for controlling a non-player virtual character, optionally, as an optional implementation manner, the method for controlling a non-player virtual character may be applied to, but not limited to, a control system for a non-player virtual character as shown in fig. 1.
The control of the non-player character includes a plurality of terminals and servers, and the number of the terminals and the servers is not limited in the embodiment of the present application. Wherein the terminal may include, but is not limited to: smart phones (such as Android phones, iOS phones, etc.), tablet computers, portable personal computers, mobile internet devices (Mobile Internet Devices, abbreviated as MID), smart televisions, vehicle-mounted devices, head-mounted devices, and other smart devices. In this embodiment of the present application, the terminal includes aplaying terminal 101 and anintelligent terminal 102, where target game applications are installed on the playing terminal and the intelligent terminal, where the target game applications may be shooting games, racing games, and the like, and specific game types may be determined according to actual situations. Theserver 103 may be a background server of any terminal (or application deployed in a terminal) for interacting with a terminal running the any terminal (or application deployed in a terminal) to provide computing and application service support for the any terminal (or application deployed in a terminal). The server may be a separate physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers. The intelligent device and the server may be directly or indirectly connected in a communication manner through a wired or wireless manner, and the connection manner between the intelligent device and the server is not limited in the embodiments of the present application.
The control of the non-player virtual character can be used for realizing the control scheme of the non-player virtual character provided by the embodiment of the application. Alternatively, the control scheme of the non-player character may be executed by a playing terminal (i.e., any terminal that can be used to play multimedia information) in the control of the non-player character; optionally, the information processing scheme may also be executed by an intelligent terminal (i.e., any terminal capable of performing communication connection) in the information processing system; optionally, the information processing scheme may also be executed by interaction between the playing terminal and the intelligent terminal; optionally, the information processing scheme may also be performed by interaction among the playing terminal, the intelligent terminal and the server.
Optionally, as an optional implementation manner, as shown in fig. 2, the control method of the non-player virtual character includes the following steps:
step S201, displaying a game picture in a target game scene where a first virtual character is located in a target game application, wherein the target game scene comprises a non-player virtual character NPC, and the first virtual character is an attack object of the NPC;
the target game application may be installed on the playing terminal or the intelligent terminal, and a target game scene is displayed in the target game application, where the target game scene may be a game scene of a first virtual character, the first virtual character may be a virtual character controlled by a player who logs in the target game application through a game account number, and the player may control the first virtual character through a touch virtual key displayed in a game screen. The NPC is a non-player virtual character, and is a character that is not manipulated by a real player in a game. In the target game scene, the first virtual character and the NPC are in hostile relation and are mutually attack objects.
Step S202, obtaining a target position to which the NPC is to be moved in the target game application, wherein the target position is a position determined in a target position set, and the target position set is a preset position set in the target game scene;
wherein a plurality of positions are preset in the game map. The NPC may be moved to a preset location. The target location set may be a location set within a preset range of a current location of the NPC. The target location is a location determined in a set of target locations, and the target location may be determined by a server or by a target application.
And step S203, displaying that the NPC moves towards the target position in the target game application, wherein the combat attribute of the NPC on the target position meets the preset condition, and the NPC is used for executing attack operation on the first virtual character according to the combat attribute on the target position.
The combat attribute includes, but is not limited to, a shelter angle, a combat distance, shooting, a path finding, position pollution, a regional distance, a target shelter angle, and the preset condition may be that the shelter angle at the target position is smaller than or equal to a preset angle, and the distance between the NPC at the target position and the first virtual character satisfies a preset range, and the like. Compared to other locations in the set of target locations, the NPC has a higher hit rate for the first avatar to execute an attack on the target location, and a lower probability of being attacked by the first avatar.
As an alternative implementation manner, as shown in fig. 3, a schematic diagram of a game screen according to an alternative embodiment of the present invention is shown, where the game screen is a game screen under a first virtual character perspective, and the game screen includes a first virtual character NPC301 and a firstvirtual character 302, where the first virtual character is shown in a state of turning off a scope, that is, a scope-falling state. Fig. 4 is a second schematic diagram of a game screen according to an alternative embodiment of the present invention, where the second schematic diagram includes avirtual prop 401 and an NPC402 used by a first virtual character, where the first virtual character is in a state of turning on a scope, i.e., a scope-open state.
As an alternative embodiment, shown in FIG. 5 is a target game scenario intent-in accordance with an alternative embodiment of the present invention, including an NPC501 and a firstvirtual character 502 and apreset location 503 in the target game scenario. Wherein, thepreset position 503 in the target game scene is not displayed in the game interface, and the player cannot see the preset position in the game interface. The preset positions shown in the figures are non-shelter positions.
As an alternative implementation, FIG. 6 shows a second schematic diagram of a target game scenario according to an alternative embodiment of the present invention, where the second schematic diagram includes an NPC601 and a firstvirtual character 602, and apreset position 603 in the target game scenario. Thepreset position 603 in the target game scene is not displayed in the game interface, and the player cannot see the preset position in the game interface. The preset positions shown in the figure are shelter positions. If a shelter exists in the target game scene, the target position can be a shelter position or a non-shelter position.
As an alternative implementation, when designing the game, the position to which the NPC can move is preset on the game map, and the preset position can be a shelter position or a non-shelter position. For the case where there is a shelter in the game scene, the shelter position may be set in the vicinity of the shelter. The target position set can be determined according to the current position of the NPC in the target game scene, wherein the distance between the position in the target position set and the current position of the NPC is smaller than a preset distance threshold, namely, the position to which the NPC can move is searched near the current position of the NPC, and the position to which the NPC can move forms the target position set. Among a plurality of positions included in the target position set, a target position in which the combat attribute satisfies a preset condition may be determined. The combat attributes may include shelter angle, combat distance, shooting, road finding, location pollution, area distance, target shelter angle, etc., and the preset conditions may be based on actual conditions, e.g., shelter angle is less than preset angle, combat distance is less than preset distance, etc. Since the combat attribute of the NPC at the target location satisfies the preset condition, the hit rate of the NPC on the first virtual character is high and the probability of being attacked by the first virtual character is low at the target location.
Optionally, the acquiring, in the target game application, the target position to which the NPC is to be moved includes: when a first group of virtual shelters are included in the target game scene, target shelter positions are acquired in the target game application, wherein the target positions are the target shelter positions, and the target position set comprises shelter positions adjacent to the virtual shelters in the first group of virtual shelters; or when a first group of virtual shelters are included in the target game scene, acquiring a first non-shelter position in the target game application, wherein the target position is the first non-shelter position, the target position set comprises shelter positions adjacent to the virtual shelters in the first group of virtual shelters, and a group of non-shelter positions preset in the target game scene; or when the target game scene does not comprise a virtual shelter, acquiring a second non-shelter position in the target game, wherein the target position is the second non-shelter position, and the target position set comprises a group of non-shelter positions preset in the target game scene.
As an alternative embodiment, the target game scene may or may not include a virtual shelter. For a target game scenario that does not include a virtual shelter, the preset location is a non-shelter location. For a target game scenario that includes a virtual shelter, the preset locations include non-shelter locations and shelter locations.
As an alternative embodiment, taking the example that the target game scene includes a virtual shelter, as shown in fig. 7, which is a schematic diagram of a third target game scene according to an alternative embodiment of the present invention, the schematic diagram includes an NPC701, a firstvirtual character 702, and avirtual shelter 700, where a shelter position is preset in the vicinity of the virtual shelter, and a presetnon-shelter position 704 is also included in the game scene. In this embodiment, the target position set may include only the non-shelter position, or both the shelter position and the non-shelter position. Taking the example of a set of target locations including a shelter location and a non-shelter location, the target location may be selected based on a combat attribute of each location (including a shelter location and a non-shelter location) in the set of target locations, which may be a shelter location in the set of target locations or a non-shelter location in the set of target locations.
As an alternative implementation, the target position is selected according to the shelter position and the non-shelter position combat attribute in the target position set, and if the target position is the shelter position, the selected shelter position is determined to be the target shelter position. And if the target position is the non-shelter position, determining the selected non-shelter position as the target non-shelter position.
As an optional implementation manner, if no virtual shelter exists in the target game scene, the preset positions in the target game scene are all non-shelter positions, the positions in the target position set are all non-shelter positions, and the target position selected in the target game set is the target non-shelter position according to the combat attribute of each non-shelter position in the target game set.
In the above embodiment, according to whether a shelter exists in the game scene, the target position is selected from the preset shelter position and the non-shelter position, and since the combat attribute of the target position satisfies the preset condition, the hit rate of the NPC on the target position for executing the attack on the first virtual object is higher, and the probability of being attacked by the first virtual shelter is lower.
Optionally, the method further comprises: determining a combat attribute of the NPC at each location, wherein the combat attribute of the NPC at each location comprises parameters of one or more dimensions; and determining the target position in the target position set according to the combat attribute of the NPC at each position.
As an alternative embodiment, the combat attributes include multiple dimensions of shelter angle, combat distance, shooting, road finding, location pollution, zone distance, and target shelter angle. The plurality of dimensions may be one or more of shelter angle, combat distance, shooting, road finding, location pollution, zone distance, and target shelter angle, each location in the set of target locations corresponding to one or more of the plurality of dimensions. Parameters of the NPC in one or more dimensions of the shelter angle, the combat distance, the shooting, the road finding, the position pollution, the area distance and the target shelter angle at each position can be calculated respectively, and the target position is determined in the target position set according to the parameter values in one or more dimensions at each position. In this embodiment, because the target position is determined in the target position set according to the parameters of each position in one or more dimensions of the shelter angle, the combat distance, the shooting, the road finding, the position pollution, the area distance and the target shelter angle, the combat attribute of one or more dimensions of the plurality of dimensions is comprehensively considered by the target position, so that the attack force and the defense of the NPC on the first virtual character on the target position are stronger, the game playability of the game is increased, and the game experience of the player is improved.
Optionally, the determining the combat attribute of the NPC at each location includes: for the ith position in the target position set, executing at least one of the following steps to obtain the combat attribute of the NPC at the ith position, wherein i is a natural number: determining a value of a first parameter corresponding to the ith position according to the position of the first virtual character and the ith position, wherein the value of the first parameter represents an included angle between a first direction and a second direction, the first direction is a shelter orientation of a first virtual shelter adjacent to the ith position, and the second direction is a direction from the ith position to the position of the first virtual character;
as an alternative embodiment, the ith location may be any location in the target location set, and for a game scene where a virtual shelter exists, the ith location may be a shelter location or a non-shelter location. For a game scenario in which there is no shelter, the ith location is a non-shelter location.
As an alternative embodiment, the first parameter may be used to represent a shelter angle in the combat attribute, and when there is a shelter position adjacent to the virtual shelter in the game scene, it may be determined whether the shelter position meets the preset condition according to the shelter angle value of the shelter position. The above-described shelter angle is used to represent the angle of the shelter orientation of the virtual shelter from the line connecting the shelter location to the first virtual character. As shown in fig. 8, which is a schematic view of a shelter angle according to an alternative embodiment of the present invention, the shelter angle includes: avirtual shelter 801, alocation 802 of a first virtual character, ashelter location 803, and ashelter orientation 804. The shelter orientation may be preset. In this embodiment, the i-th position is ashelter position 803 in the drawing, the shelter angle of theshelter position 803 is a value of a first parameter, the first direction is ashelter direction 804, and the second direction is a direction from theshelter position 803 to thefirst avatar 802.
Optionally, determining the value of the second parameter corresponding to the ith position as the distance between the position of the first virtual character and the ith position;
as an alternative embodiment, the second parameter may be a combat distance in a combat attribute, where the combat distance is used to represent a distance between a location of the first avatar and an i-th location, where the i-th location may be a shelter location or a non-shelter location.
Optionally, determining a value of a third parameter corresponding to the ith position according to the position of the first virtual character and the ith position, where the value of the third parameter indicates whether the first virtual character is visible in the shooting range of the NPC when the NPC is at the ith position;
as an alternative embodiment, the third parameter may be a shooting attribute of the combat attribute, and the third parameter is used to indicate whether the first virtual character is visible in the shooting range of the NPC when in the ith position. The ith location may be a shelter location or a non-shelter location. As shown in fig. 9, a schematic view of shooting properties according to an alternative embodiment of the present invention includes: thefirst avatar 901, the i-th positions 902, 903 and 904, and theobstacles 905, 906 and 907, and the above 905, 906 and 907 may be any type of obstacle, such as a wall, a box, etc. Different types of obstacles vary in height, and for taller obstacles (e.g., walls) the view of the avatar is obscured, while for shorter obstacles (e.g., boxes) the view of the avatar is not obscured. Assuming that 905 and 907 in the figure are boxes, they do not block the view of the NPC, and 906 is a wall that blocks the view of the NPC. For the game scenario shown in fig. 9, if the NPC is atlocation 902, the NPC is visible to the firstvirtual character 901 at that location, and the firstvirtual character 901 is visible to the NPC atlocation 902. If the NPC is inlocation 903,bin 905 does not block the line of sight of the NPC, butwall 906 blocks the line of sight of the NPC, in which case thefirst avatar 901 is not visible to the NPC inlocation 903. If the NPC is atlocation 904,box 907 does not obstruct the view of the NPC, in which case thefirst avatar 901 is visible to the NPC atlocation 904.
Optionally, determining a value of a fourth parameter corresponding to the ith position according to the position of the NPC and the ith position, where the value of the fourth parameter represents a path finding distance from the position of the NPC to the ith position;
as an alternative embodiment, the seek distance refers to the total distance the NPC walks from the current location to the i-th location, not necessarily the straight line distance.
Optionally, determining a value of a fifth parameter corresponding to the ith position according to the ith position, wherein the value of the fifth parameter indicates whether an intersection exists between a preset range of the ith position and an explosion range of the thrown virtual explosion prop;
as an alternative embodiment, the virtual explosion prop may be an explosion prop such as a mine. The virtual explosion props can be thrown by enemy of the NPC or by friends of the NPC. Whether the preset range of the ith position (the specific range can be determined according to practical situations, for example, the range of 2 meters, 5 meters or 10 meters of the ith position) is within the explosion range of a certain explosive thrown by enemy and friends.
Optionally, determining a value of a sixth parameter corresponding to the ith position according to the ith position, wherein the value of the sixth parameter represents a distance between the ith position and a preset active area of the NPC;
As an alternative embodiment, the NPC may have multiple types of virtual roles, e.g., assault, medical, sniper, etc. The value of the sixth parameter may represent the distance between the i-th location and the center of the NPC active area, or the distance between the i-th location and the NPC active area boundary, for each type of NPC having a fixed active area.
Optionally, determining a value of a seventh parameter corresponding to the ith position according to the position of the first virtual character and the ith position, where the value of the seventh parameter represents an included angle between a third direction and a fourth direction, the third direction is a shelter orientation of a second virtual shelter adjacent to the position of the first virtual character, and the fourth direction is a direction from a center point of the second virtual shelter to the ith position.
As an alternative embodiment, the seventh parameter may be used to represent the target shelter angle in the combat attribute. In the target game scenario, the first virtual character may be located in the vicinity of the virtual shelter, and the target shelter angle is used to represent an angle of a shelter orientation of the virtual shelter from a line connecting the center of the virtual shelter to the ith position. A schematic diagram of the target shelter angle according to an alternative embodiment of the invention is shown in fig. 10, which includes: avirtual shelter 1001, a firstvirtual character 1003, the first virtual character being located near thevirtual shelter 1001, anith location 1002, acenter point 1005 of the virtual shelter, ashelter direction 1004, which may be preset. The third direction is ashelter direction 1004, and the fourth direction is a direction from acenter point 1005 of the virtual shelter to an i-th position 1002, where the i-th position may be a shelter position or a non-shelter position.
Optionally, the determining the target location in the target location set according to the combat attribute of the NPC at each location includes: determining a score for said one or more dimensions of said NPC at said each location based on a combat attribute of said NPC at said each location; and determining the target position in the target position set according to the scores of the one or more dimensions of the NPC at each position.
As an alternative embodiment, the score of the first dimension or dimensions may be one or more of a shelter angle score, a combat distance score, a shooting score, a way finding score, a location pollution score, and a zone distance score, and the target location is determined from the set of target locations according to the score of the one or more combat attributes at each location.
Optionally, the determining the score of the one or more dimensions of the NPC at each location according to the combat attribute of the NPC at each location includes: for an ith location in the set of target locations, performing the steps of obtaining a score for the one or more dimensions of the NPC at the ith location:
When the one or more parameters comprise the first parameter corresponding to the ith position, determining a shelter angle score of the NPC at the ith position according to the value of the first parameter and a first preset angle;
as an alternative embodiment, the first parameter may be used to represent a shelter angle in the combat attribute, and when there is a shelter position adjacent to the virtual shelter in the game scene, it may be determined whether the shelter position meets the preset condition according to the shelter angle value of the shelter position. The above-described shelter angle is used to represent the angle of the shelter orientation of the virtual shelter from the line connecting the shelter location to the first virtual character. A shelter angle schematic according to an alternative embodiment of the invention is shown in fig. 8, which comprises: avirtual shelter 801, alocation 802 of a first virtual character, ashelter location 803, and ashelter orientation 804. The shelter orientation may be preset. In this embodiment, the i-th position is ashelter position 803 in the drawing, the shelter angle of theshelter position 803 is a value of a first parameter, the first direction is ashelter direction 804, and the second direction is a direction from theshelter position 803 to thefirst avatar 802.
The range of the shelter angle is 0-180 degrees, and if a plurality of NPC attack objects exist in the target game scene, the NPC can select a first virtual character from the plurality of attack objects as an attack target. The closer the shelter angle is to 180 degrees, the more reasonable the shelter is positioned, the higher the score, and the score and angle are in a linear relationship. Since the shelter functions to shield the NPC, when the shelter angle is smaller, the shelter function is lost. Fig. 11 is a second view of a shelter angle according to an alternative embodiment of the present invention, comprising:virtual shelter 1101,location 1102 of the first virtual character,shelter location 1103 and shelter orientation 1104. The shelter orientation may be preset. In this embodiment, the i-th position is ashelter position 1103 in the figure, the shelter angle of theshelter position 1103 is a value of a first parameter, the first direction is a shelter direction 1104, and the second direction is a direction from theshelter position 1103 to the firstvirtual character 1102. It can be seen from the figure that the shelter angle is less than 90 degrees, in which case the shelter adjacent to the shelter is not protected against NPCs at the shelter site, which is not reasonable to choose and therefore requires a restriction on the shelter angle. In this embodiment, the first preset angle may be determined according to circumstances, for example, may be 100 degrees, 120 degrees, 115 degrees, and the like, and in this embodiment, taking 120 degrees as an example, the shelter angle score may be calculated by the following formula:
Wherein, in the formula, T1 Is a shelter angle score, θ is a shelter angle, and when the shelter angle is less than 120 degrees, the shelter angle score at the i-th position is 0. The score of the shelter angle is in the value range of 0,1]. This score can be used to assess the rationality of the shelter location, with the higher the shelter angle score, the more rational the shelter location, among other factors.
Optionally, when the one or more parameters include the second parameter corresponding to the ith position, determining a combat distance score of the NPC at the ith position according to a value of the second parameter and a preset combat distance of the NPC, where the preset combat distance of the NPC includes: a minimum combat distance of the NPC, a maximum combat distance of the NPC;
as an alternative embodiment, the second parameter may be a combat distance in a combat attribute, where the combat distance is used to represent a distance between a location of the first avatar and an i-th location, where the i-th location may be a shelter location or a non-shelter location. As shown in FIG. 12, a schematic diagram of combat distance according to an alternative embodiment of the present invention, the center point position is the position of the first avatar, the positions on the circles at a distance of A, B, C, D from the first avatar are combat distances, respectively, where C is the minimum combat distance of NPC, A is the minimum value of the optimal combat distance, B is the maximum value of the optimal combat distance, D is the maximum combat distance, and 0 <C<A<B<D, fight distance score T at each fight position2 The method comprises the following steps:
from the above formula, it can be seen that the NPC score is highest when it is within the optimal combat range, and the closer to the optimal combat range, the higher the score. The score of the combat distance is in the range of 0, 1. In a game scenario, where there may be multiple attack objects at the same time, the NPC may remain in the best combat range as possible with these attack objects when selecting the combat distance. The average value of the combat distance scores with all the hostile targets is directly adopted as the combat distance score of the tactical point.
Optionally, when the one or more parameters include the third parameter corresponding to the ith position, determining a shooting score of the NPC at the ith position to be equal to a value of the third parameter;
as an alternative embodiment, the shooting score is whether the NPC can shoot to the currently selected attack object (first virtual character) at each location, and if so, the score is 1, otherwise the score is 0.
Optionally, when the one or more parameters include the fourth parameter corresponding to the ith position, determining a path finding score of the NPC at the ith position according to a value of the fourth parameter and a preset path finding distance, where the preset path finding distance includes: presetting a shortest path finding distance and presetting a longest path finding distance;
As an alternative embodiment, the seek distance refers to the total distance the NPC walks from the current location to the i-th location, not necessarily the straight line distance. The higher the way score, the more reasonable the tactical point is explained. The specific calculation formula is as follows:
wherein T is3 Is the road searching score, X is the road searching distance from NPC to the ith position, C is the minimum value of the optimal road searching distance, A is the maximum value of the optimal road searching distance, B is the maximum road searching distance, and 0<=C<A<B. The parameters in C, A, B and combat distance scores here are not the same. As can be seen from the formula, the range of the path finding score is [0,1 ]]。
Optionally, when the one or more parameters include the fifth parameter corresponding to the ith position, determining a position pollution score of the NPC at the ith position according to the value of the fifth parameter, where the thrown virtual explosion prop includes a virtual explosion prop thrown by a virtual character in the same camp as the NPC, and/or a virtual explosion prop thrown by a virtual character in a different camp from the NPC;
as an alternative embodiment, the virtual explosion prop may be an explosion prop such as a mine. The virtual explosion props can be thrown by enemy of the NPC or by friends of the NPC. Whether the preset range of the ith position (the specific range can be determined according to practical situations, for example, the range of 2 meters, 5 meters or 10 meters of the ith position) is within the explosion range of a certain explosive thrown by enemy and friends.
By site contamination is meant that there is a hostile target, friend, or within a certain explosive of the ith site. The types of contamination are divided into three types: enemy pollution, friend pollution, and explosive pollution. Multiple contamination types may be present at the same location. The calculation formula of the position pollution score is as follows:
T4 =T41 +T42 +T43
wherein T is4 Scoring for site contamination, T41 Scoring enemy pollution, T42 Score for friend pollution, T43 The explosives pollution is scored. A is enemy pollution grading coefficient, B is friend pollution grading coefficient, C is explosive pollution grading coefficient, and A, B, C can be set according to practical conditions, wherein (A+B+C)>0. A score of 0 corresponds to no contamination type, i.e., the ith location has no intersection with the explosive range of the thrown explosive. If the intersection exists, calculating a position pollution score according to the corresponding scoring coefficient, wherein the value range of the position pollution score is also [0,1]The higher the score, the more severe the location contamination and the less reasonable the location.
Optionally, when the one or more parameters include the sixth parameter corresponding to the ith position, determining a regional distance score of the NPC at the ith position according to the value of the sixth parameter and a preset regional distance;
As an alternative embodiment, the preset area refers to an active area of the NPC, and in the game scene, the NPC needs to be fixed to be active as much as possible within a certain range, that is, an area to which the NPC belongs. The specific scoring formula is as follows:
where T5 is a zone distance score, and M is a preset zone distance configured by the system, where the value may be determined according to practical situations, for example, may be 100 meters, 150 meters, and so on. From the formula, as the ith location is closer to the area to which the NPC belongs, the area distance score of the location is higher, that is, the NPC can be made to select a location as close to the NPC active area as possible by the score. The range of values for the score of the zone distance is [0,1].
Optionally, when the one or more parameters include the seventh parameter corresponding to the ith position, determining a target shelter-inclusion-angle score of the NPC at the ith position according to the value of the seventh parameter and a second preset angle.
As an alternative embodiment, the target shelter angle score T6 The specific calculation formula of (2) is as follows:
wherein θ is a target shelter angle, α is a minimum target shelter angle limited by NPC, β is a maximum target shelter angle limited by NPC, and α < β, and the second preset angle includes values of α, β, α, and β, which may be set according to actual situations. As can be seen from the formula, the grading range of the included angle of the target shelter is 0,1, and the higher the grading is, the more reasonable the tactical point is.
Optionally, the determining the target location in the target location set according to the scores of the one or more dimensions of the NPC at each location includes: for the ith location in the target location set, performing the following steps to obtain a composite score of the NPC at the ith location: weighting and summing the scores of the one or more dimensions of the NPC at the ith position to obtain a comprehensive score of the NPC at the ith position; and determining the position with the highest comprehensive score in the target position set as the target position.
As an alternative embodiment, for each location in the set of target locations, the composite score for each location may be calculated by scoring one or more of the above-mentioned shelter angle score, combat distance score, shooting score, seek score, location pollution score, regional distance score, and the composite score for each location may be obtained by a weighted summation of any one or more of the above-mentioned shelter angle score, combat distance score, shooting score, seek score, location pollution score, regional distance score. And selecting the position with the highest comprehensive score from the target position set as the target position.
Optionally, the weighted summation of the scores of the one or more dimensions of the NPC at the ith location, to obtain a composite score of the NPC at the ith location, includes: and when the ith position is a shelter position, determining that all or part of a shelter angle score, a combat distance score, a shooting score, a road finding score, a position pollution score, a regional distance score and a target shelter included angle score at the ith position is a comprehensive score at the ith position.
As an alternative embodiment, the composite score for a shelter location may be derived from a weighted sum of all or part of a shelter angle score, a combat distance score, a shooting score, a way finding score, a location pollution score, a zone distance score, a target shelter angle score. For example, the composite score for each location may be calculated by the following formula:
comprehensive score for shelter location = shelter angle score + W2 combat distance score + W3 shooting distance score + W4 route finding distance score + W5 location pollution score + W6 zone distance score + W7 target shelter angle score
W1, W2, W3, W4, W5, W6 and W7 are scoring coefficients, representing the duty ratio of each scoring dimension, and can be set arbitrarily according to practical conditions. The parameters related in the formulas can be customized, and different parameters can be provided for different NPC types in the game, so that the NPC has different characteristics, and the diversity of the NPC is increased.
Optionally, the weighted summation of the scores of the one or more dimensions of the NPC at the ith location, to obtain a composite score of the NPC at the ith location, includes: and when the ith position is a non-shelter position, determining that all or part of a combat distance score, a shooting score, a road finding score, a position pollution score, a regional distance score and a target shelter included angle score at the ith position is a comprehensive score at the ith position.
As an alternative embodiment, the composite score for a non-shelter location may be derived from a weighted sum of all or part of the combat distance score, the shooting score, the way finding score, the location pollution score, the zone distance score, the target shelter angle score. For example, the composite score for each location may be calculated by the following formula:
composite score for non-shelter location = w2 combat distance score + w3 shooting score + w4 seek distance score + w5 location pollution score + w6 zone distance score + w7 target shelter angle score
W2, W3, W4, W5, W6 and W7 are scoring coefficients, representing the ratio of the scoring dimensions, and can be set arbitrarily according to actual conditions. The parameters related in the formulas can be customized, and different parameters can be provided for different NPC types in the game, so that the NPC has different characteristics, and the diversity of the NPC is increased.
As shown in fig. 13, a schematic diagram of a position setting according to an alternative embodiment of the present invention is shown, where the preset position is a non-shelter position, and includes aposition 1301 of the first virtual character and anon-shelter position 1302, where the left and right sides may be symmetrical for the position within the rectangular range when the non-shelter position is generated, that is, the scores obtained by the tactical points on the left and right sides are the same with a high probability. In this embodiment, the range of non-shelter positions can be adjusted to be half of the original, as shown in fig. 14, which is a schematic diagram of a position setting according to an alternative embodiment of the present invention, two, including aposition 1401 of the first virtual character, and anon-shelter position 1402. In this way, the number of preset non-shelter positions is reduced by half, and the calculation amount can be reduced by half. Therefore, the calculation speed is increased, and the efficiency is improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
According to another aspect of the embodiment of the present invention, there is also provided a control device for a non-player character for implementing the control method for a non-player character. As shown in fig. 15, the apparatus includes: afirst display module 1502, configured to display, in a target game application, a game screen in a target game scene where a first virtual character is located, where the target game scene includes a non-player virtual character NPC, and the first virtual character is an attack object of the NPC; an obtainingmodule 1504, configured to obtain, in the target game application, a target position to which the NPC is to be moved, where the target position is a position determined in a target position set, and the target position set is a preset position set in the target game scene; asecond display module 1506, configured to display, in the target game application, that the NPC moves to the target location, where a combat attribute of the NPC at the target location meets a preset condition, and the NPC is configured to perform an attack operation on the first virtual character according to the combat attribute at the target location.
Optionally, the above device is further configured to obtain a target shelter position in the target game application when the first set of virtual shelters is included in the target game scene, where the target position is the target shelter position, and the target position set includes shelter positions adjacent to the virtual shelters in the first set of virtual shelters; when a first group of virtual shelters are included in the target game scene, a first non-shelter position is acquired in the target game application, wherein the target position is the first non-shelter position, the target position set comprises shelter positions adjacent to the virtual shelters in the first group of virtual shelters, and a group of non-shelter positions preset in the target game scene; and when the virtual shelter is not included in the target game scene, acquiring a second non-shelter position in the target game, wherein the target position is the second non-shelter position, and the target position set comprises a group of non-shelter positions preset in the target game scene.
Optionally, the above device is further configured to determine a combat attribute of the NPC at each location, where the combat attribute of the NPC at each location includes parameters of one or more dimensions; and determining the target position in the target position set according to the combat attribute of the NPC at each position.
Optionally, the foregoing apparatus is further configured to perform at least one of the following steps for an i-th location in the target location set, to obtain a combat attribute of the NPC at the i-th location, where i is a natural number: determining a value of a first parameter corresponding to the ith position according to the position of the first virtual character and the ith position, wherein the value of the first parameter represents an included angle between a first direction and a second direction, the first direction is a shelter orientation of a first virtual shelter adjacent to the ith position, and the second direction is a direction from the ith position to the position of the first virtual character; determining the value of a second parameter corresponding to the ith position as the distance between the position of the first virtual character and the ith position; determining a value of a third parameter corresponding to the ith position according to the position of the first virtual character and the ith position, wherein the value of the third parameter indicates whether the first virtual character is visible in the shooting range of the NPC when the NPC is at the ith position; determining a value of a fourth parameter corresponding to the ith position according to the position of the NPC and the ith position, wherein the value of the fourth parameter represents a path finding distance from the position of the NPC to the ith position; determining a value of a fifth parameter corresponding to the ith position according to the ith position, wherein the value of the fifth parameter represents whether an intersection exists between a preset range of the ith position and an explosion range of the thrown virtual explosion prop; determining a value of a sixth parameter corresponding to the ith position according to the ith position, wherein the value of the sixth parameter represents the distance between the ith position and a preset active area of the NPC; and determining a value of a seventh parameter corresponding to the ith position according to the position of the first virtual character and the ith position, wherein the value of the seventh parameter represents an included angle between a third direction and a fourth direction, the third direction is a shelter orientation of a second virtual shelter adjacent to the position of the first virtual character, and the fourth direction is a direction from the center point of the second virtual shelter to the ith position.
Optionally, the above device is further configured to determine a score of the one or more dimensions of the NPC at each location according to a combat attribute of the NPC at each location; and determining the target position in the target position set according to the scores of the one or more dimensions of the NPC at each position.
Optionally, the above apparatus is further configured to perform, for an i-th location in the set of target locations, the following steps to obtain a score of the NPC in the one or more dimensions of the i-th location: when the one or more parameters comprise the first parameter corresponding to the ith position, determining a shelter angle score of the NPC at the ith position according to the value of the first parameter and a first preset angle; when the one or more parameters include the second parameter corresponding to the ith position, determining a combat distance score of the NPC at the ith position according to the value of the second parameter and a preset combat distance of the NPC, wherein the preset combat distance of the NPC includes: a minimum combat distance of the NPC, a maximum combat distance of the NPC; determining a shooting score of the NPC at the ith location as equal to a value of the third parameter when the one or more parameters include the third parameter corresponding to the ith location; when the one or more parameters include the fourth parameter corresponding to the ith position, determining a path finding score of the NPC at the ith position according to the value of the fourth parameter and a preset path finding distance, wherein the preset path finding distance includes: presetting a shortest path finding distance and presetting a longest path finding distance; when the one or more parameters comprise the fifth parameter corresponding to the ith position, determining a position pollution score of the NPC on the ith position according to the value of the fifth parameter, wherein the thrown virtual explosion prop comprises a virtual explosion prop thrown by a virtual role in the same camp as the NPC and/or a virtual explosion prop thrown by a virtual role in a different camp from the NPC; when the one or more parameters comprise the sixth parameter corresponding to the ith position, determining a regional distance score of the NPC at the ith position according to the value of the sixth parameter and a preset regional distance; and when the one or more parameters comprise the seventh parameter corresponding to the ith position, determining a target shelter-angle score of the NPC at the ith position according to the value of the seventh parameter and a second preset angle.
Optionally, the above device is further configured to perform, for an ith location in the target location set, the following steps to obtain a composite score of the NPC at the ith location: weighting and summing the scores of the one or more dimensions of the NPC at the ith position to obtain a comprehensive score of the NPC at the ith position; and determining the position with the highest comprehensive score in the target position set as the target position.
Optionally, the device is further configured to determine that, when the ith location is a shelter location, a weighted sum of all or part of a shelter angle score, a combat distance score, a shooting score, a road finding score, a location pollution score, a regional distance score, and a target shelter angle score at the ith location is a comprehensive score at the ith location.
Optionally, the device is further configured to determine that a weighted sum of all or part of a combat distance score, a shooting score, a road-finding score, a location pollution score, a regional distance score, and a target shelter-angle score at the ith location is a comprehensive score at the ith location when the ith location is a non-shelter location.
According to still another aspect of the embodiment of the present invention, there is also provided an electronic device for implementing the above-mentioned method for controlling a non-player character, which may be a terminal device or a server as shown in fig. 1. The embodiment takes the electronic device as an intelligent terminal as an example for explanation. As shown in fig. 16, the electronic device comprises amemory 1602 and aprocessor 1604, thememory 1602 having stored therein a computer program, theprocessor 1604 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, displaying a game picture in a target game scene where a first virtual character is located in a target game application, wherein the target game scene comprises a non-player virtual character NPC, and the first virtual character is an attack object of the NPC;
s2, acquiring a target position to which the NPC is to be moved in the target game application, wherein the target position is a position determined in a target position set, and the target position set is a preset position set in the target game scene;
And S3, displaying the NPC to move to the target position in the target game application, wherein the fight attribute of the NPC on the target position meets the preset condition, and the NPC is used for executing attack operation on the first virtual character according to the fight attribute on the target position.
Alternatively, as will be appreciated by those skilled in the art, the structure shown in fig. 16 is merely illustrative, and the electronic device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Fig. 16 is not limited to the structure of the electronic device and the electronic apparatus described above. For example, the electronics can also include more or fewer components (e.g., network interfaces, etc.) than shown in fig. 16, or have a different configuration than shown in fig. 16.
Thememory 1602 may be used to store software programs and modules, such as program instructions/modules corresponding to the methods and apparatuses for controlling a non-player character in the embodiments of the present invention, and theprocessor 1604 executes the software programs and modules stored in thememory 1602 to perform various functional applications and data processing, i.e., to implement the methods for controlling a non-player character.Memory 1602 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, thememory 1602 may further include memory located remotely from theprocessor 1604, which may be connected to the terminal by a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Thememory 1602 may be, but not limited to, for storing information such as a set of preset positions in a target game scene. As an example, as shown in fig. 16, thememory 1602 may include, but is not limited to, afirst display module 1502, anacquisition module 1504, and asecond display module 1506 in a control device including the non-player character. In addition, other module units in the control device of the non-player virtual character may be included, but are not limited to, and are not described in detail in this example.
Optionally, thetransmission device 1606 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 1606 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, thetransmission device 1606 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In addition, the electronic device further includes: adisplay 1608 for displaying a game screen in the target game scene; and aconnection bus 1610 for connecting the respective module parts in the above-described electronic device.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the plurality of nodes through a network communication. Among them, the nodes may form a Peer-To-Peer (P2P) network, and any type of computing device, such as a server, a terminal, etc., may become a node in the blockchain system by joining the Peer-To-Peer network.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternative implementations described above. Wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, displaying a game picture in a target game scene where a first virtual character is located in a target game application, wherein the target game scene comprises a non-player virtual character NPC, and the first virtual character is an attack object of the NPC;
s2, acquiring a target position to which the NPC is to be moved in the target game application, wherein the target position is a position determined in a target position set, and the target position set is a preset position set in the target game scene;
And S3, displaying the NPC to move to the target position in the target game application, wherein the fight attribute of the NPC on the target position meets the preset condition, and the NPC is used for executing attack operation on the first virtual character according to the fight attribute on the target position.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.