CN113559517B - Control method and device for non-player virtual character, storage medium and electronic equipment - Google Patents

Control method and device for non-player virtual character, storage medium and electronic equipment Download PDF

Info

Publication number
CN113559517B
CN113559517B CN202110876206.0A CN202110876206A CN113559517B CN 113559517 B CN113559517 B CN 113559517B CN 202110876206 A CN202110876206 A CN 202110876206A CN 113559517 B CN113559517 B CN 113559517B
Authority
CN
China
Prior art keywords
npc
target
shelter
ith
score
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
CN202110876206.0A
Other languages
Chinese (zh)
Other versions
CN113559517A (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 CN202110876206.0A priority Critical patent/CN113559517B/en
Publication of CN113559517A publication Critical patent/CN113559517A/en
Application granted granted Critical
Publication of CN113559517B publication Critical patent/CN113559517B/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/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
    • 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/837Shooting of targets
    • 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/60Methods for processing data by generating or executing the game program
    • A63F2300/64Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car
    • A63F2300/646Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car for calculating the trajectory of an object

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a control method and device of a non-player virtual character, a storage medium and electronic equipment. Wherein the method comprises the following steps: displaying a game picture in a target game scene where the first virtual character is located in a target game application; acquiring a target position to which the NPC is to be moved in a target game application; the NPC is displayed in the target gaming application moving toward the target location. The invention solves the technical problem that NPC is difficult to execute attack operation on the virtual character controlled by the player.

Description

Control method and device for non-player virtual character, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for controlling a non-player virtual character, a storage medium, and an electronic device.
Background
Non-Player Character (NPC) is an important game Character in a game. The performance of an NPC in a game scene affects the game experience of a player.
In the prior art, NPCs are generally moved along a fixed designed route in a game scene, but the moving route of the NPCs in the game scene may affect game playability, and it is difficult for a fixed shooting route to satisfy various game scenes due to complexity in the game scene. For example, in a combat scene, if the NPC moves along a fixed design route, a player easily grasps the movement rule of the NPC, and thus it is easier to perform an attack operation on the NPC. Also, since the player grasps the movement rule of the NPC, the player can more easily avoid the attack operation of the NPC, so that the NPC is more difficult to perform the attack operation on the virtual character controlled by the player.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a control method and device for a non-player virtual character, a storage medium and electronic equipment, which at least solve the technical problem that NPC is difficult to execute attack operation on the virtual character controlled by a player.
According to an aspect of the embodiment of the present invention, there is provided a method for controlling a non-player virtual character, including: 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; 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 displaying the NPC moving to 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.
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.
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.
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; 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 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.
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; 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 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.
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.
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.
According to another aspect of the embodiment of the present invention, there is also provided a control device for a non-player avatar, including: the first display module is used for displaying game pictures 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 acquisition module is used for 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 the second display module is used for displaying the NPC to move 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.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-described control method of a non-player character when running.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device including a memory in which a computer program is stored, and a processor configured to execute the above-described control method of a non-player character by the computer program.
In the embodiment of the invention, the position set where the NPC can move is preset in the game scene, and the NPC can determine the target position where the fight attribute meets the preset condition in the position set according to the current situation, so that the player cannot grasp the movement rule of the NPC, the NPC can execute attack operation on the virtual character controlled by the player more easily, and the technical problem that the NPC is difficult to execute attack operation on the virtual character controlled by the player in the related technology is solved.
On the other hand, in the embodiment of the present invention, for the scene including the virtual shelter and the scene not including the virtual shelter in the game scene, the NPC selects an appropriate target position according to the different scenes, so that the movement of the NPC may change according to the scenes, which further increases the difficulty of the virtual character controlled by the player to perform the attack operation on the NPC, and reduces the difficulty of the NPC to perform the attack operation on the virtual character controlled by the player.
In yet another aspect, in the embodiment of the present invention, the target position is determined in the preset position set according to the parameters of the multiple dimensions, so that the determined target position can be more matched with the current game scene (for example, whether the shelter is included, the distance from the shelter, and the distance between the NPC and the virtual character controlled by the player), so that the difficulty of the virtual character controlled by the player to perform the attack operation on the NPC is further increased, and the difficulty of the NPC to perform the attack operation on the virtual character controlled by the player is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a schematic diagram of an alternative non-player character control system in accordance with embodiments of the present invention;
FIG. 2 is a flow chart of an alternative method of controlling a non-player character in accordance with embodiments of the present invention;
FIG. 3 is a schematic illustration of an alternative game screen according to an embodiment of the present invention;
FIG. 4 is a second schematic illustration of an alternative game play according to an embodiment of the present invention;
FIG. 5 is an alternate target game scenario intent one in accordance with an embodiment of the present invention;
FIG. 6 is an alternative target game scene intent II in accordance with an embodiment of the present invention;
FIG. 7 is an alternate target game scenario intent III in accordance with an embodiment of the present invention;
FIG. 8 is a schematic view of an alternative shelter angle, according to an embodiment of the present invention;
FIG. 9 is a schematic view of an alternative firing profile according to an embodiment of the present invention;
FIG. 10 is a schematic view of an alternative target shelter angle according to an embodiment of the invention;
FIG. 11 is a second alternative shelter angle schematic view, according to an embodiment of the invention;
FIG. 12 is a schematic view of an alternative combat distance according to an embodiment of the present invention;
FIG. 13 is a schematic illustration of an alternative position arrangement in accordance with an embodiment of the invention;
FIG. 14 is an alternative position setting schematic diagram II according to an embodiment of the invention;
FIG. 15 is a schematic structural view of an alternative non-player character control device in accordance with embodiments of the present invention;
fig. 16 is a schematic structural view of an alternative electronic device according to an embodiment of the present invention.
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 a playing terminal 101 and an intelligent 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. The server 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 first virtual 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 a virtual 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 first virtual character 502 and a preset location 503 in the target game scenario. Wherein, the preset 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 first virtual character 602, and a preset position 603 in the target game scenario. The preset 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 first virtual character 702, and a virtual shelter 700, where a shelter position is preset in the vicinity of the virtual shelter, and a preset non-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: a virtual shelter 801, a location 802 of a first virtual character, a shelter location 803, and a shelter orientation 804. The shelter orientation may be preset. In this embodiment, the i-th position is a shelter position 803 in the drawing, the shelter angle of the shelter position 803 is a value of a first parameter, the first direction is a shelter direction 804, and the second direction is a direction from the shelter position 803 to the first 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: the first avatar 901, the i- th positions 902, 903 and 904, and the obstacles 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 at location 902, the NPC is visible to the first virtual character 901 at that location, and the first virtual character 901 is visible to the NPC at location 902. If the NPC is in location 903, bin 905 does not block the line of sight of the NPC, but wall 906 blocks the line of sight of the NPC, in which case the first avatar 901 is not visible to the NPC in location 903. If the NPC is at location 904, box 907 does not obstruct the view of the NPC, in which case the first avatar 901 is visible to the NPC at location 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: a virtual shelter 1001, a first virtual character 1003, the first virtual character being located near the virtual shelter 1001, an ith location 1002, a center point 1005 of the virtual shelter, a shelter direction 1004, which may be preset. The third direction is a shelter direction 1004, and the fourth direction is a direction from a center 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: a virtual shelter 801, a location 802 of a first virtual character, a shelter location 803, and a shelter orientation 804. The shelter orientation may be preset. In this embodiment, the i-th position is a shelter position 803 in the drawing, the shelter angle of the shelter position 803 is a value of a first parameter, the first direction is a shelter direction 804, and the second direction is a direction from the shelter position 803 to the first 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 a shelter position 1103 in the figure, the shelter angle of the shelter 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 the shelter position 1103 to the first virtual 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:
Figure BDA0003190405930000171
Wherein, in the formula, T 1 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 position 2 The method comprises the following steps:
Figure BDA0003190405930000181
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:
Figure BDA0003190405930000191
wherein T is 3 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:
T 4 =T 41 +T 42 +T 43
Figure BDA0003190405930000192
Figure BDA0003190405930000201
Figure BDA0003190405930000202
wherein T is 4 Scoring for site contamination, T 41 Scoring enemy pollution, T 42 Score for friend pollution, T 43 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:
Figure BDA0003190405930000203
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 T 6 The specific calculation formula of (2) is as follows:
Figure BDA0003190405930000211
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 a position 1301 of the first virtual character and a non-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 a position 1401 of the first virtual character, and a non-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: a first 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 obtaining module 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; a second 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 a memory 1602 and a processor 1604, the memory 1602 having stored therein a computer program, the processor 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.
The memory 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 the processor 1604 executes the software programs and modules stored in the memory 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, the memory 1602 may further include memory located remotely from the processor 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. The memory 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, the memory 1602 may include, but is not limited to, a first display module 1502, an acquisition module 1504, and a second 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, the transmission 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, the transmission device 1606 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In addition, the electronic device further includes: a display 1608 for displaying a game screen in the target game scene; and a connection 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.

Claims (10)

1. A method for controlling a non-player character, comprising:
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;
determining a combat attribute of the NPC at each location in a set of target locations, wherein the combat attribute of the NPC at each location comprises parameters of one or more dimensions; determining the target position in the target position set according to the combat attribute of the NPC at each position;
Acquiring a target position to which the NPC is to be moved in the target game application, wherein the target position set is a preset position set in the target game scene;
displaying the NPC moving to the target position in the target game application, wherein the combat attribute of the NPC on the target position meets a 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 obtaining, in the target game application, a target location to which the NPC is to be moved, including: 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 the 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.
2. The method of claim 1, wherein said determining the combat attributes of said NPC at said each location comprises:
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;
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.
3. The method of claim 2, wherein said determining the target location from the set of target locations based on the combat attributes of the NPC at each location comprises:
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.
4. The method of claim 3, wherein said 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 comprises:
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;
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.
5. The method of claim 3 or 4, wherein said determining the target location in the set of target locations based on the scoring of the one or more dimensions of the NPC at each location comprises:
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.
6. The method of claim 5, wherein said weighting and summing 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 comprises:
and when the ith position is a shelter position, determining that the weighted sum of all or part of shelter angle score, combat distance score, shooting score, route finding score, position pollution score, regional distance score and target shelter included angle score at the ith position is the comprehensive score of the NPC at the ith position.
7. The method of claim 5, wherein said weighting and summing 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 comprises:
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 of the NPC at the ith position.
8. A control device for a non-player character, comprising:
the first display module is used for displaying game pictures 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 acquisition module is used for 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;
a second display module, 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;
the control device of the non-player character is further configured to: determining a combat attribute of the NPC at each location in a set of target locations, wherein the combat attribute of the NPC at each location comprises parameters of one or more dimensions; determining the target position in the target position set according to the combat attribute of the NPC at each position;
The obtaining, in the target game application, a target location to which the NPC is to be moved, including: 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 the 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.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein the program, when run, performs the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
CN202110876206.0A 2021-07-30 2021-07-30 Control method and device for non-player virtual character, storage medium and electronic equipment Active CN113559517B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110876206.0A CN113559517B (en) 2021-07-30 2021-07-30 Control method and device for non-player virtual character, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110876206.0A CN113559517B (en) 2021-07-30 2021-07-30 Control method and device for non-player virtual character, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113559517A CN113559517A (en) 2021-10-29
CN113559517B true CN113559517B (en) 2023-07-14

Family

ID=78169765

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110876206.0A Active CN113559517B (en) 2021-07-30 2021-07-30 Control method and device for non-player virtual character, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113559517B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114210067B (en) * 2021-12-07 2023-07-25 腾讯科技(深圳)有限公司 Virtual prop control method and device, storage medium and electronic equipment
CN114404944A (en) * 2022-01-20 2022-04-29 网易(杭州)网络有限公司 Method and device for controlling player character, electronic device and storage medium
CN117797479A (en) * 2022-09-26 2024-04-02 腾讯科技(深圳)有限公司 Non-player character control method and device, storage medium and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015024159A (en) * 2014-09-30 2015-02-05 株式会社カプコン Game program and game system
CN109999497A (en) * 2019-04-30 2019-07-12 腾讯科技(深圳)有限公司 The control method and device of virtual objects, storage medium and electronic device
CN110711382A (en) * 2019-10-21 2020-01-21 腾讯科技(深圳)有限公司 Control method and device of virtual operation object, storage medium and electronic device
CN111389007A (en) * 2020-03-13 2020-07-10 腾讯科技(深圳)有限公司 Game control method and device, computing equipment and storage medium
CN111433814A (en) * 2018-05-02 2020-07-17 深圳市大疆创新科技有限公司 Optically supported object navigation
CN112044074A (en) * 2020-09-04 2020-12-08 网易(杭州)网络有限公司 Method, device, storage medium and computer equipment for seeking path to non-player character
CN112807681A (en) * 2021-02-25 2021-05-18 腾讯科技(深圳)有限公司 Game control method, device, electronic equipment and storage medium
CN113069761A (en) * 2021-03-15 2021-07-06 广州三七互娱科技有限公司 Method and device for displaying virtual character in game scene and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5887458B1 (en) * 2015-11-04 2016-03-16 株式会社Cygames A game system for searching for a route of a non-player character based on a player's movement history

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015024159A (en) * 2014-09-30 2015-02-05 株式会社カプコン Game program and game system
CN111433814A (en) * 2018-05-02 2020-07-17 深圳市大疆创新科技有限公司 Optically supported object navigation
CN109999497A (en) * 2019-04-30 2019-07-12 腾讯科技(深圳)有限公司 The control method and device of virtual objects, storage medium and electronic device
CN110711382A (en) * 2019-10-21 2020-01-21 腾讯科技(深圳)有限公司 Control method and device of virtual operation object, storage medium and electronic device
CN111389007A (en) * 2020-03-13 2020-07-10 腾讯科技(深圳)有限公司 Game control method and device, computing equipment and storage medium
CN112044074A (en) * 2020-09-04 2020-12-08 网易(杭州)网络有限公司 Method, device, storage medium and computer equipment for seeking path to non-player character
CN112807681A (en) * 2021-02-25 2021-05-18 腾讯科技(深圳)有限公司 Game control method, device, electronic equipment and storage medium
CN113069761A (en) * 2021-03-15 2021-07-06 广州三七互娱科技有限公司 Method and device for displaying virtual character in game scene and electronic equipment

Also Published As

Publication number Publication date
CN113559517A (en) 2021-10-29

Similar Documents

Publication Publication Date Title
CN113559517B (en) Control method and device for non-player virtual character, storage medium and electronic equipment
US11291918B2 (en) Collaborative diplomacy mechanics
US11192035B2 (en) Method and apparatus for providing online shooting game
CN105935493B (en) Computer system, game device, and method for controlling character
US11529559B2 (en) Method and device for adjusting region, storage medium, and electronic device
WO2021135623A1 (en) Virtual prop control method and apparatus, storage medium and electronic device
CN111249735B (en) Path planning method and device for control object, processor and electronic device
US11266909B2 (en) Storage medium storing game program, information processing apparatus, game processing method, and game system
CN113181649B (en) Control method, device, equipment and storage medium for calling object in virtual scene
CN108619717B (en) Method and device for determining operation object, storage medium and electronic device
CN113262482B (en) Object control method and device, storage medium and electronic equipment
EP2952235A1 (en) Game device, game control method, game control program, matching server, matching control method, and matching control program
CN113599821B (en) Method and device for displaying current blood volume of virtual character
WO2024093941A1 (en) Method and apparatus for controlling virtual object in virtual scene, device, and product
JP2024500277A (en) Aiming mark display method, device, device and computer program
KR101570929B1 (en) Method and apparatus for detecting aimbot of online game
US20140364237A1 (en) Multiplayer network game notifications
CN111389007B (en) Game control method and device, computing equipment and storage medium
CN113633987B (en) Object control method and device, storage medium and electronic equipment
CN113599828B (en) Virtual prop control method and device, storage medium and electronic equipment
KR101003288B1 (en) Online game method and system
CN116099190A (en) Interaction method, device, equipment, medium and program product based on virtual scene
US20140364236A1 (en) System and method for trapping enemy units in a game
CN115581925A (en) Game role interaction control method and device, storage medium and electronic equipment
CN117085316A (en) Virtual character control method and device, storage medium and electronic equipment

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: 40053492

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant