CN114259727A - Method and device for controlling attack object, storage medium and computer equipment - Google Patents

Method and device for controlling attack object, storage medium and computer equipment Download PDF

Info

Publication number
CN114259727A
CN114259727A CN202111628045.XA CN202111628045A CN114259727A CN 114259727 A CN114259727 A CN 114259727A CN 202111628045 A CN202111628045 A CN 202111628045A CN 114259727 A CN114259727 A CN 114259727A
Authority
CN
China
Prior art keywords
target
attack
path
player character
random movement
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.)
Pending
Application number
CN202111628045.XA
Other languages
Chinese (zh)
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.)
Perfect World Beijing Software Technology Development Co Ltd
Original Assignee
Perfect World Beijing Software Technology Development 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 Perfect World Beijing Software Technology Development Co Ltd filed Critical Perfect World Beijing Software Technology Development Co Ltd
Priority to CN202111628045.XA priority Critical patent/CN114259727A/en
Publication of CN114259727A publication Critical patent/CN114259727A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application discloses a method and a device for controlling an attack object, a storage medium and computer equipment, wherein the method comprises the following steps: when a target attack-able object in a game is in a fighting state for a target player character, acquiring the position of the target player character where the target player character is located, and judging whether the target player character is located in the attack-able range of the target attack-able object or not based on the position of the target player character; if the target player character is located outside the attack scope of the target attack-able object, determining the target attack scope of the target attack-able object, and determining the attack position of the target attack-able object in the unoccupied position in the target attack scope; and controlling the target attack-capable object to move to the attack position, and attacking the target player character at the attack position. The application helps to avoid stacking of multiple monsters in one position, and attractiveness of the game picture is improved.

Description

Method and device for controlling attack object, storage medium and computer equipment
Technical Field
The present application relates to the field of computer game technologies, and in particular, to a method and an apparatus for controlling an offensive object, a storage medium, and a computer device.
Background
A massively multiplayer Online Role playing game MMORPG (MMORPG), which is one of network games, is a kind of Online game. In a role playing game, when a virtual character controlled by a player fights with monsters, the monsters generally move radially towards the virtual character and attack the virtual character after entering a warning range, when the number of monsters in a scene/play is too high, the monsters are often stacked together, the appearance of the picture is affected by excessive monsters, the special effect number at the same position is also affected, the special effect stacking is easy to be caused, the special effect causes light pollution, and in addition, the monsters are stacked, so that the player is not easy to select a target to attack, and the game experience of the player is affected.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for controlling an offensive object, a storage medium, and a computer device, which are helpful for avoiding stacking of multiple monsters in one position, improving the aesthetic degree of a game screen, avoiding light pollution caused by multiple special effects generated in the same position, and solving the problems that the special effects are difficult to see and cannot be accurately selected.
According to an aspect of the present application, there is provided a method for controlling an offensive object, including:
when a target attack-able object in a game is in a fighting state for a target player character, acquiring the position of the target player character where the target player character is located, and judging whether the target player character is located in the attack-able range of the target attack-able object or not based on the position of the target player character;
if the target player character is located outside the attack scope of the target attack-able object, determining the target attack scope of the target attack-able object, and determining the attack position of the target attack-able object in the unoccupied position in the target attack scope;
and controlling the target attack-capable object to move to the attack position, and attacking the target player character at the attack position.
Optionally, the determining an attack position of the target attack-capable object in the unoccupied position within the target attack range specifically includes:
acquiring all the attack-able objects in a fighting state for the target player character and occupied positions of all the attack-able objects;
determining unoccupied positions within the target attack range based on the occupied positions;
and acquiring the current position of the target attacked object, and determining the attack position of the target attacked object based on the current position and the unoccupied position of the target attacked object.
Optionally, when the unoccupied location includes a plurality of locations, determining the attack location of the target offensive object based on the current location of the target offensive object and the unoccupied location specifically includes:
detecting whether a connecting line from the current position of the target attack-capable object to the position of the target player character contains any unoccupied position;
if yes, determining the attack position based on any unoccupied position;
if not, acquiring an unoccupied position closest to the current position as the attack position, or acquiring an unoccupied position closest to any point on the connecting line as the attack position, or randomly acquiring one of the unoccupied positions as the attack position.
Optionally, the controlling the target attacked object to move to the attack position specifically includes:
determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position;
and controlling the target attacked object and moving to the attack position according to the target routing path.
Optionally, the determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position specifically includes:
performing path planning based on a walking surface including the current position of the target attacked object and the attack position to obtain a path-finding path to be detected, wherein the path-finding path to be detected takes the current position of the target attacked object as a starting point and the attack position as an end point;
if the to-be-detected path-finding path does not contain a convex hull, taking the to-be-detected path-finding path as the target path-finding path;
if the target way finding path comprises a convex hull, taking the way finding path to be detected as the target way finding path when the height of the convex hull is less than or equal to the traveling height threshold value of the target attack object; and when the height of the convex hull is greater than the threshold value of the travel height, correcting the path-finding path to be detected to obtain the target path-finding path so as to enable the target path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travel height, terminating the fighting state of the target attack-capable object on the target player character.
Optionally, after obtaining the position of the target player character where the target player character is located, the method further includes:
and returning to the step of acquiring the position of the target player character where the target player character is located at every preset interval, wherein the preset interval is determined based on a preset frame number and a frame rate, or the preset interval is preset duration.
Optionally, the method further comprises:
in a combat state of the target offensive object, determining a random movement starting point position of the target offensive object in response to a random movement signal of the target offensive object;
determining a random movement end point position of the target attack-capable object in a random movement range corresponding to the random movement start point position;
determining a random movement routing path of the target attack object based on the random movement starting point position and the random movement end point position;
and controlling the target attacked object to move to the random moving end point position according to the random moving path finding path.
Optionally, the random movement starting point position is a current position or a designated position of the target attack-able object;
when the random movement starting position is the designated position, the method further includes, before controlling the target attacked object to move to the random movement ending position according to the random movement routing path, the target attacked object to move to the random movement ending position:
and controlling the target attack-capable object to move to the specified position.
Optionally, the determining a random movement end point position of the target attacked object within a random movement range corresponding to the random movement start point position specifically includes:
detecting whether the random movement starting point position and the random movement end point position are positioned on the same walking surface, wherein the walking surface corresponds to at least one height of terrain;
if the target attacked object is located on the same walking surface, executing the random movement path finding path based on the random movement starting point position and the random movement end point position to determine the target attacked object;
and if the random movement end point position and the random movement starting point position are not positioned on the same walking surface, re-determining the random movement end point position within the random movement range until the random movement end point position and the random movement starting point position are positioned on the same walking surface.
Optionally, after controlling the target attacked object and moving to the randomly moving end point position according to the randomly moving routing path, the method further includes:
detecting whether an interrupt signal for the target attack-able object exists or not in the process of controlling the target attack-able object to move to the random moving end point position;
if the interrupt signal exists and the target attacked object belongs to the type which can be interrupted, controlling the target attacked object to execute an interrupt feedback action corresponding to the interrupt signal and controlling the target attacked object to stop moving;
and if the interrupt signal exists and the target attacked object does not belong to the type which can be interrupted, controlling the target attacked object to continue to move to the random moving destination position after executing the interrupt feedback action corresponding to the interrupt signal.
Optionally, the method further comprises:
and under the condition that the target attack-capable object is configured with a distance trigger-type effect, in the process of controlling the target attack-capable object to move to the random movement end point position, if the distance between the target attack-capable object and the target player character is less than a preset trigger distance, triggering the distance trigger-type effect of the target attack-capable object.
According to another aspect of the present application, there is provided a control apparatus for an offensive object, including:
the position judgment module is used for acquiring the position of a target player character where the target player character is located when a target attack object in a game is in a fighting state on the target player character, and judging whether the target player character is located in an attack range of the target attack object or not based on the position of the target player character;
an attack position determination module, configured to determine a target attack range of the target offensive object if the target player character is outside the offensive range of the target offensive object, and determine an attack position of the target offensive object in an unoccupied position within the target attack range;
and the pursuit control module is used for controlling the target attack object to move to the attack position and attacking the target player character at the attack position.
Optionally, the attack location determining module is specifically configured to:
acquiring all the attack-able objects in a fighting state for the target player character and occupied positions of all the attack-able objects;
determining unoccupied positions within the target attack range based on the occupied positions;
and acquiring the current position of the target attacked object, and determining the attack position of the target attacked object based on the current position and the unoccupied position of the target attacked object.
Optionally, the attack location determining module is further configured to:
when the unoccupied positions comprise a plurality of positions, detecting whether a connecting line from the current position of the target attack-capable object to the position of the target player character comprises any unoccupied position;
if yes, determining the attack position based on any unoccupied position;
if not, acquiring an unoccupied position closest to the current position as the attack position, or acquiring an unoccupied position closest to any point on the connecting line as the attack position, or randomly acquiring one of the unoccupied positions as the attack position.
Optionally, the attack location determining module is further configured to:
determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position;
and controlling the target attacked object and moving to the attack position according to the target routing path.
Optionally, the attack location determining module is further configured to:
performing path planning based on a walking surface including the current position of the target attacked object and the attack position to obtain a path-finding path to be detected, wherein the path-finding path to be detected takes the current position of the target attacked object as a starting point and the attack position as an end point;
if the to-be-detected path-finding path does not contain a convex hull, taking the to-be-detected path-finding path as the target path-finding path;
if the target way finding path comprises a convex hull, taking the way finding path to be detected as the target way finding path when the height of the convex hull is less than or equal to the traveling height threshold value of the target attack object; and when the height of the convex hull is greater than the threshold value of the travel height, correcting the path-finding path to be detected to obtain the target path-finding path so as to enable the target path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travel height, terminating the fighting state of the target attack-capable object on the target player character.
Optionally, the position determining module is specifically configured to:
and returning to the step of acquiring the position of the target player character where the target player character is located at every preset interval, wherein the preset interval is determined based on a preset frame number and a frame rate, or the preset interval is preset duration.
Optionally, the apparatus further comprises:
the starting point determining module is used for responding to a random moving signal of the target attack object in a fighting state of the target attack object and determining a random moving starting point position of the target attack object;
the end point determining module is used for determining the random moving end point position of the target attack object in a random moving range corresponding to the random moving start point position;
a random path planning module, configured to determine a random movement routing path of the target attacked object based on the random movement starting point position and the random movement ending point position;
and the random movement control module is used for controlling the target attacked object to move to the random movement end point position according to the random movement path finding path.
Optionally, the random movement starting point position is a current position or a designated position of the target attack-able object;
the random movement control module is further configured to, when the random movement starting point is the designated position, control the target assault object to move to the designated position before moving to the random movement ending point according to the random movement routing path.
Optionally, the endpoint determination module is specifically configured to:
detecting whether the random movement starting point position and the random movement end point position are positioned on the same walking surface, wherein the walking surface corresponds to at least one height of terrain;
if the target attacked object is located on the same walking surface, executing the random movement path finding path based on the random movement starting point position and the random movement end point position to determine the target attacked object;
and if the random movement end point position and the random movement starting point position are not positioned on the same walking surface, re-determining the random movement end point position within the random movement range until the random movement end point position and the random movement starting point position are positioned on the same walking surface.
Optionally, the apparatus further comprises:
an interruption control module, configured to detect whether an interruption signal to the target attacked object exists or not in a process of controlling the target attacked object to move to the random movement destination position after the target attacked object is controlled to move to the random movement destination position according to the random movement routing path; and the number of the first and second groups,
if the interrupt signal exists and the target attacked object belongs to the type which can be interrupted, controlling the target attacked object to execute an interrupt feedback action corresponding to the interrupt signal and controlling the target attacked object to stop moving; and the number of the first and second groups,
and if the interrupt signal exists and the target attacked object does not belong to the type which can be interrupted, controlling the target attacked object to continue to move to the random moving destination position after executing the interrupt feedback action corresponding to the interrupt signal.
Optionally, the apparatus further comprises:
an effect triggering module, configured to, when the target attacker object is configured with a distance-triggered effect, trigger the distance-triggered effect of the target attacker object if a distance between the target attacker object and the target player character is smaller than a preset trigger distance in a process of controlling the target attacker object to move to the random movement destination position.
According to yet another aspect of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described method of controlling an offensive object.
According to yet another aspect of the present application, there is provided a computer device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, the processor implementing the above-mentioned control method for an offensive object when executing the program.
By means of the technical scheme, after the target attack target enters a fighting state for the target player character, if the target player character is identified to be located outside the current attack range of the target attack target, the target attack range of the target attack target is determined, and an unoccupied position in the target attack range is selected as an attack position of the target attack target, so that the target attack target is controlled to move towards the attack position, and the target player character is attacked after the target attack target moves to the attack position. The method has the advantages that the phenomenon that a plurality of monsters are stacked in one position is avoided, the attractiveness of a game picture is improved, light pollution caused by a plurality of special effects generated in the same position is avoided, and the problems that the special effects are difficult to see clearly and cannot be accurately selected are solved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 illustrates a flowchart of a method for controlling an offensive object according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating another control method for an offensive object according to an embodiment of the present application;
fig. 3 is a flowchart illustrating another control method for an offensive object according to an embodiment of the present application;
fig. 4 is a flowchart illustrating another control method for an offensive object according to an embodiment of the present application;
fig. 5 shows a schematic structural diagram of a control apparatus for an offensive object according to an embodiment of the present application.
Detailed Description
The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In this embodiment, a method for controlling an offensive object is provided, as shown in fig. 1, the method includes:
step 101, when a target attack-able object in a game is in a fighting state with respect to a target player character, acquiring a target player character position where the target player character is located, and determining whether the target player character is located within an attack-able range of the target attack-able object based on the target player character position;
step 102, if the target player character is located outside the attack scope of the target attack-able object, determining the target attack scope of the target attack-able object, and determining the attack position of the target attack-able object in the unoccupied position in the target attack scope;
and 103, controlling the target attack-capable object to move to the attack position, and attacking the target player character at the attack position.
The method and the device can be applied to the network game scene and the stand-alone game scene, particularly can be implemented in the game client for running the stand-alone game, and can also be implemented together in the game client and the game server for running the network game. The method comprises the steps of setting a hate target in the network game, setting the hate target as a target, taking the hate as a reference, carrying out attack behaviors of the offensive objects represented by the monsters, wherein the target with the highest hate value in the hate list is the primary attack target of the monsters, indexing the list by the monsters after the hate target disappears, searching a second hate target in the alert range for attack, and carrying out warfare on the monsters after no hate target exists in the list.
When a monster (i.e., a target-assailable object) enters a combat state for a target player character, i.e., the target player character is currently the highest hate value target of the monster, the location of the target player character is obtained, i.e., the target player character position, determines whether the target player character is within the offensive range, the attack range may be determined based on the current position of the monster and the range of the monster, for example, the attack range may be a circular area formed by taking the current position of the monster as a center of a circle and the range of the monster as a radius, if the player is within the attack range of the monster, the monster attacks the target player character, and if the player is not within the attack range of the monster, the monster approaches the target player character first and moves to the attack range of the monster, and then attacks the target player character. In the embodiment of the present application, when it is determined that the target player character is located outside the attack range of the monster, a target attack range of the monster is determined, where the target attack range may be specifically determined based on the current position of the target player character and the range of the monster, and for example, the target attack range may be a circular area formed by taking the target player character as a circle center and taking the range of the monster as a radius. Then, in order to avoid the stack of monsters, an attack position of a monster is selected from unoccupied positions within the target attack range, the monster is controlled to move to the attack position to chase the target player character, and finally, the attack on the target player character at the attack position is stopped, so that the monster is ensured to stay at the unoccupied position finally. In an actual application scene, the unoccupied position can be specifically a position which is not occupied by other attacking objects, so that stacking of multiple monsters on one position is avoided, and certainly, the unoccupied position can also be a position which is not occupied by any non-player character and any player character in the game, so that the attractiveness of a game picture is improved, and light pollution caused by multiple special effects generated on the same position is avoided. The mechanism can effectively solve the problem that the monsters are wrapped due to the fact that a plurality of monsters are overlapped, when the monsters are obviously different in size and body type and no collision bodies exist between the monsters, the problem that a player cannot see the monsters due to the fact that the monsters are released in skill and the problem that the player cannot accurately select the monsters to be attacked.
It should be noted that, the larger monsters occupy larger space, and if the target monster moves to the vicinity of the large monster, the large monster may be stacked with the target monster, in order to further reduce the occurrence of the monster stacking phenomenon, in this embodiment of the application, optionally, further comprising: acquiring the occupied space of each occupied object in the target attack range; projecting the occupied space onto a horizontal plane to obtain an occupied position in the target attack range; determining unoccupied locations within the target attack range based on the occupied locations.
In the embodiment, all occupied objects in the target attack range are determined, and the occupied space of each occupied object is acquired, wherein the occupied objects are game characters which need to be prevented from being stacked with the target attack object, and can comprise player characters or non-player characters.
In this embodiment, the target player character may be moved in real time in the game, and the target player character may be out of the attack range of some monsters after moving, and the monsters may chase the target player character, that is, the positions of the target player character and the monsters may change in real time, so the above steps may be performed at intervals, and optionally, step 101 includes: and returning to the step 101 at preset intervals, wherein the preset intervals are determined based on preset frame numbers and frame rates, or the preset intervals are preset duration.
In this embodiment, after step 101, a timer in the game may be started, and step 101 is executed at preset intervals, specifically, at preset time intervals, or at preset frame numbers. As shown in fig. 2, after the monster enters the combat state and starts the chase, it is determined whether the player is within the range of the monster, if not, the target attack range is determined based on the range of the monster and the position of the player, the monster is controlled to move to a position not occupied within the target attack range, it is determined again whether the player is within the range of the monster, if the player is within the range of the monster, the monster starts to attack the player, if the player leaves the range of the monster, it returns to the chase state.
By applying the technical scheme of the embodiment, after the target attack object enters the fighting state for the target player character, if the target player character is identified to be positioned outside the current attack range of the target attack object, the target attack range of the target attack object is determined, and the unoccupied position in the target attack range is selected as the attack position of the target attack object, so that the target attack object is controlled to move towards the attack position, and the target player character is attacked after the target attack object moves to the attack position. The method has the advantages that the phenomenon that a plurality of monsters are stacked in one position is avoided, the attractiveness of a game picture is improved, light pollution caused by a plurality of special effects generated in the same position is avoided, and the problems that the special effects are difficult to see clearly and cannot be accurately selected are solved.
In this embodiment of the application, optionally, the step 102 of "determining the attack position of the target attacked object in the unoccupied positions within the target attack range" specifically includes:
102-1, acquiring all the attack-able objects in the fighting state for the target player character and the occupied positions of all the attack-able objects;
step 102-2, determining unoccupied positions in the target attack range based on the occupied positions;
and 102-3, acquiring the current position of the target attacked object, and determining the attack position of the target attacked object based on the current position of the target attacked object and the unoccupied position.
In this embodiment, since the range of each monster may be different, all monsters that are hate targets of the target player character may be acquired, and the occupied position of each monster may be determined, and then the occupied positions may be removed from all positions within the target attack range, resulting in unoccupied positions within the target attack range. Further, an attack position as a monster is selected among the unoccupied positions.
In this embodiment of the application, optionally, when the unoccupied location includes a plurality of locations, the "determining the attack location of the target offensive object based on the current location of the target offensive object and the unoccupied location" in step 102-3 specifically includes:
detecting whether a connecting line from the current position of the target attack-capable object to the position of the target player character contains any unoccupied position;
if yes, determining the attack position based on any unoccupied position;
if not, acquiring an unoccupied position closest to the current position as the attack position, or acquiring an unoccupied position closest to any point on the connecting line as the attack position, or randomly acquiring one of the unoccupied positions as the attack position.
In this embodiment, an attack position in the unoccupied positions may be selected according to the current position of the monster, specifically, according to a principle of a preferential straight-line pursuit, a ray may be emitted to the target player character position with the current position of the monster as an endpoint, whether the ray includes an unoccupied position is detected, if the ray includes an unoccupied position, the first detected unoccupied position may be used as the attack position, all the unoccupied positions included in the ray may be determined first, and one with the smallest number of monsters included in a preset range of each unoccupied position may be determined as the attack position, or one of a plurality of unoccupied positions included in the ray may be randomly selected as the attack position, which is not limited herein. In addition, if the ray does not include an unoccupied position, one of the unoccupied positions closest to the current position of the monster may be obtained as an attack position, one of the unoccupied positions closest to any point on the ray may also be obtained as an attack position, and one of the unoccupied positions may also be directly randomly selected as an attack position, which is not limited herein.
In this embodiment of the application, optionally, the step 103 of "controlling the target attacked object to move to the attack position" specifically includes:
103-1, determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position;
and 103-2, controlling the target attacked object to move to the attack position according to the target routing path.
In this embodiment, before controlling the monster to move to the target player character, a path planning may be performed to determine a target path-finding path, so as to control the monster to move along the planned target path-finding path.
In this embodiment of the present application, optionally, step 103-1 specifically includes:
s1, performing path planning based on a walking surface including the current position of the target attacked object and the attack position to obtain a path to be detected, wherein the path to be detected takes the current position of the target attacked object as a starting point and the attack position as an end point;
s2, if the path to be detected does not contain a convex hull, the path to be detected is taken as the target path;
s3, if the target way-finding path includes a convex hull, when the height of the convex hull is less than or equal to the threshold of the traveling height of the target attack-able object, taking the way-finding path to be detected as the target way-finding path; and when the height of the convex hull is greater than the threshold value of the travel height, correcting the path-finding path to be detected to obtain the target path-finding path so as to enable the target path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travel height, terminating the fighting state of the target attack-capable object on the target player character.
In this embodiment, when performing path planning, a walking surface including a current position of a monster and an attack position may be obtained first, the walking surface is constructed based on all reachable positions in a game scene, any two positions in the walking surface are reachable with each other, after determining the walking surface, path planning may be performed on the walking surface with the current position of the monster as a starting point and the attack position as an end point, so as to obtain a path to be detected, and in a specific game scene, path planning may be performed according to a shortest path principle, so as to obtain a shortest path from the starting point to the end point as the path to be detected. Further, although the positions on the walking surface are mutually connected, the highest height that each monster can cross may be different, after determining the path to be detected, it may also be detected whether the path includes a convex hull, if not, the monster may move along the path, the path to be detected is taken as the target path, and if the path includes a convex hull, it is also detected whether the monster can pass through the convex hull, specifically, it may be detected whether the monster can pass through the convex hull by comparing the height of the convex hull with the maximum height that the monster can pass through (i.e., a traveling height threshold), wherein, if the height of the convex hull is less than or equal to the traveling height threshold, the path to be detected may pass through, the path to be detected may be taken as the target path to pass through the convex hull, the monster may be controlled to pass through the convex hull or move onto the convex hull to travel according to the specific traveling parameters of the monster, and if the height of the convex hull is larger than the threshold value, the monster can not pass through the convex hull, the path-finding path can be enabled to bypass the convex hull by correcting the path-finding path to be detected, so that the target path-finding path is determined, and under the condition that the monster can not pass through the convex hull, the monster can be considered to be incapable of realizing the pursuit of the target player character, and the fighting state of the monster is stopped.
In this embodiment of the application, in order to add a richer play effect to the offensive object, as shown in fig. 3, optionally, the method further includes:
step 201, in a combat state of the target offensive object, determining a random movement starting point position of the target offensive object in response to a random movement signal of the target offensive object;
step 202, determining a random movement end point position of the target attacked object within a random movement range corresponding to the random movement start point position;
step 203, determining a random movement routing path of the target attacked object based on the random movement starting point position and the random movement end point position;
and 204, controlling the target attacked object to move to the random moving end point position according to the random moving path finding path.
In the embodiment of the application, when the monster is in a fighting state, random movement can be configured for the monster, and the random movement can be in the process of chasing the monster to the target player character or in the process of attacking the monster to the target player character. In a specific application scenario, in response to a random movement signal of a monster, a random movement starting point position of the monster is determined, and the starting point position may select a current location of the monster, may also select a birth position of the monster, or may be a pre-configured starting point position, or may be a randomly generated position within a current game scenario. And then, determining a random movement end point position in a random movement range corresponding to the random movement starting point position, wherein the random movement range can be a circular area formed by taking the random movement starting point position as the center of a circle and a preset random movement distance as the radius. And further, planning a path based on the random movement starting position and the random movement end position to obtain a random movement path finding path, and finally controlling the monsters to move according to the path so as to realize the random movement of the monsters in the fighting process.
The random moving mechanism can be matched with other existing mechanisms, and one level can synchronously generate a plurality of mechanisms, so that the playing contents in the level are enriched; in addition, for a hard point-to-point random movement mode, in order to create a random movement effect, a developer needs to arrange a large number of point locations in a checkpoint map to create a pseudo-random movement effect.
In this embodiment of the application, optionally, the random movement starting point position is a current position or a specified position of the target offensive object; when the random movement starting point position is the designated position, step 204 further includes: and controlling the target attack-capable object to move to the specified position.
In this embodiment, the designated position may be a birth position of a monster, or a pre-configured starting position, or a randomly generated position within the current game scene, and if the randomly moved starting position is the designated position, the monster moves to the designated position first, and then moves to the randomly moved ending position according to the planned randomly moved routing path.
In this embodiment of the application, in order to improve the success rate of the random moving mechanism and enrich the game play, optionally, step 202 further includes: detecting whether the random movement starting point position and the random movement end point position are positioned on the same walking surface, wherein the walking surface corresponds to at least one height of terrain; if the two walking surfaces are positioned on the same walking surface, executing the step 203; if the random movement end point position and the random movement starting point position are not located on the same walking surface, the process returns to step 201, and the random movement end point position is determined again within the random movement range until the random movement end point position and the random movement starting point position are located on the same walking surface.
In the above embodiment, as shown in fig. 4, it is detected whether the random movement starting point position and the random movement ending point position are located on the same walking surface, if so, the routing path planning is continued, and if not, the random movement ending point position is determined again until the random movement starting point and the random movement ending point are located on the same walking surface. The walking surface can be a plane terrain with only one height or a terrain with different heights.
In addition, the method for determining the random movement routing path in step 203 may refer to the above S1-S3, and specifically may be:
p1, performing path planning based on the walking surface including the random movement starting point position and the random movement end point position to obtain a random path finding path to be detected, wherein the random path finding path to be detected takes the random movement starting point position as a starting point and the random movement end point position as an end point;
p2, if the random path-finding path to be detected does not include a convex hull, taking the random path-finding path to be detected as the random mobile path-finding path; p3, if the random path-finding path to be detected includes a convex hull, taking the random path-finding path to be detected as the random mobile path-finding path when the height of the convex hull is less than or equal to the threshold of the traveling height of the target attack-able object; and when the height of the convex hull is greater than the threshold value of the travelling height, correcting the random path-finding path to be detected to obtain the random mobile path-finding path so as to enable the random mobile path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travelling height, terminating the random movement of the target attacked object.
Under the random moving mechanism, monsters can smoothly and randomly move in any narrow space without being limited by the terrain, and climb up the terrain from loose when encountering natural terrains such as soil bags/shrub roots with low terrain; when facing tall trees and buildings, the device can accurately and quickly detour, thereby achieving the effect of disordered and random movement of monsters in the true sense.
In this embodiment of the present application, optionally, after step 204, further including:
step 205, in the process of controlling the target attacked object to move to the random moving end point position, detecting whether an interrupt signal for the target attacked object exists;
step 206, if the interrupt signal exists and the target attacked object belongs to the type that can be interrupted, controlling the target attacked object to execute an interrupt feedback action corresponding to the interrupt signal and controlling the target attacked object to stop moving;
step 207, if the interrupt signal exists and the target attacked object does not belong to the type that can be interrupted, controlling the target attacked object to continue to move to the random movement destination position after executing the interrupt feedback action corresponding to the interrupt signal.
In the above embodiment, when the monster moves randomly within the attack range of the target player character, the player may attack the monster, and in the game scene, if the monster is attacked by an interruption, that is, if an interruption signal to the monster is detected, the monster stops moving randomly after being attacked if the monster belongs to an interruptible type, and if the monster belongs to a non-interruptible type, for example, a bodice monster, the monster continues moving to the random movement destination according to the random movement path after being attacked.
In the embodiment of the present application, optionally, the method further includes: and under the condition that the target attack-capable object is configured with a distance trigger-type effect, in the process of controlling the target attack-capable object to move to the random movement end point position, if the distance between the target attack-capable object and the target player character is less than a preset trigger distance, triggering the distance trigger-type effect of the target attack-capable object.
In this embodiment, when a monster itself is added with a persistent follow-up injury effect (i.e., a distance trigger type effect), the monster enters random movement, and if the player approaches the monster, the effect is triggered immediately, and due to the full random mobility of the monster, in a complex battle format, the uncertainty and playability of the level are significantly increased, enhancing the player's gaming experience.
Further, as a specific implementation of the method in fig. 1, an embodiment of the present application provides a control apparatus for an attacker, as shown in fig. 5, the apparatus includes:
the position judgment module is used for acquiring the position of a target player character where the target player character is located when a target attack object in a game is in a fighting state on the target player character, and judging whether the target player character is located in an attack range of the target attack object or not based on the position of the target player character;
an attack position determination module, configured to determine a target attack range of the target offensive object if the target player character is outside the offensive range of the target offensive object, and determine an attack position of the target offensive object in an unoccupied position within the target attack range;
and the pursuit control module is used for controlling the target attack object to move to the attack position and attacking the target player character at the attack position.
Optionally, the attack location determining module is specifically configured to:
acquiring all the attack-able objects in a fighting state for the target player character and occupied positions of all the attack-able objects;
determining unoccupied positions within the target attack range based on the occupied positions;
and acquiring the current position of the target attacked object, and determining the attack position of the target attacked object based on the current position and the unoccupied position of the target attacked object.
Optionally, the attack location determining module is further configured to:
when the unoccupied positions comprise a plurality of positions, detecting whether a connecting line from the current position of the target attack-capable object to the position of the target player character comprises any unoccupied position;
if yes, determining the attack position based on any unoccupied position;
if not, acquiring an unoccupied position closest to the current position as the attack position, or acquiring an unoccupied position closest to any point on the connecting line as the attack position, or randomly acquiring one of the unoccupied positions as the attack position.
Optionally, the attack location determining module is further configured to:
determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position;
and controlling the target attacked object and moving to the attack position according to the target routing path.
Optionally, the attack location determining module is further configured to:
performing path planning based on a walking surface including the current position of the target attacked object and the attack position to obtain a path-finding path to be detected, wherein the path-finding path to be detected takes the current position of the target attacked object as a starting point and the attack position as an end point;
if the to-be-detected path-finding path does not contain a convex hull, taking the to-be-detected path-finding path as the target path-finding path;
if the target way finding path comprises a convex hull, taking the way finding path to be detected as the target way finding path when the height of the convex hull is less than or equal to the traveling height threshold value of the target attack object; and when the height of the convex hull is greater than the threshold value of the travel height, correcting the path-finding path to be detected to obtain the target path-finding path so as to enable the target path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travel height, terminating the fighting state of the target attack-capable object on the target player character.
Optionally, the position determining module is specifically configured to:
and returning to the step of acquiring the position of the target player character where the target player character is located at every preset interval, wherein the preset interval is determined based on a preset frame number and a frame rate, or the preset interval is preset duration.
Optionally, the apparatus further comprises:
the starting point determining module is used for responding to a random moving signal of the target attack object in a fighting state of the target attack object and determining a random moving starting point position of the target attack object;
the end point determining module is used for determining the random moving end point position of the target attack object in a random moving range corresponding to the random moving start point position;
a random path planning module, configured to determine a random movement routing path of the target attacked object based on the random movement starting point position and the random movement ending point position;
and the random movement control module is used for controlling the target attacked object to move to the random movement end point position according to the random movement path finding path.
Optionally, the random movement starting point position is a current position or a designated position of the target attack-able object;
the random movement control module is further configured to, when the random movement starting point is the designated position, control the target assault object to move to the designated position before moving to the random movement ending point according to the random movement routing path.
Optionally, the endpoint determination module is specifically configured to:
detecting whether the random movement starting point position and the random movement end point position are positioned on the same walking surface, wherein the walking surface corresponds to at least one height of terrain;
if the target attacked object is located on the same walking surface, executing the random movement path finding path based on the random movement starting point position and the random movement end point position to determine the target attacked object;
and if the random movement end point position and the random movement starting point position are not positioned on the same walking surface, re-determining the random movement end point position within the random movement range until the random movement end point position and the random movement starting point position are positioned on the same walking surface.
Optionally, the apparatus further comprises:
an interruption control module, configured to detect whether an interruption signal to the target attacked object exists or not in a process of controlling the target attacked object to move to the random movement destination position after the target attacked object is controlled to move to the random movement destination position according to the random movement routing path; and the number of the first and second groups,
if the interrupt signal exists and the target attacked object belongs to the type which can be interrupted, controlling the target attacked object to execute an interrupt feedback action corresponding to the interrupt signal and controlling the target attacked object to stop moving; and the number of the first and second groups,
and if the interrupt signal exists and the target attacked object does not belong to the type which can be interrupted, controlling the target attacked object to continue to move to the random moving destination position after executing the interrupt feedback action corresponding to the interrupt signal.
Optionally, the apparatus further comprises:
an effect triggering module, configured to, when the target attacker object is configured with a distance-triggered effect, trigger the distance-triggered effect of the target attacker object if a distance between the target attacker object and the target player character is smaller than a preset trigger distance in a process of controlling the target attacker object to move to the random movement destination position.
It should be noted that other corresponding descriptions of the functional units related to the control device for an attacker provided in the embodiment of the present application may refer to corresponding descriptions in the methods in fig. 1 to fig. 4, and are not described herein again.
Based on the methods shown in fig. 1 to 4, correspondingly, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for controlling an offensive object shown in fig. 1 to 4 is implemented.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Based on the above methods shown in fig. 1 to fig. 4 and the virtual device embodiment shown in fig. 5, in order to achieve the above object, an embodiment of the present application further provides a computer device, which may specifically be a personal computer, a server, a network device, and the like, where the computer device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the above-described control method for an offensive object as shown in fig. 1 to 4.
Optionally, the computer device may also include a user interface, a network interface, a camera, Radio Frequency (RF) circuitry, sensors, audio circuitry, a WI-FI module, and so forth. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., a bluetooth interface, WI-FI interface), etc.
It will be appreciated by those skilled in the art that the present embodiment provides a computer device architecture that is not limiting of the computer device, and that may include more or fewer components, or some components in combination, or a different arrangement of components.
The storage medium may further include an operating system and a network communication module. An operating system is a program that manages and maintains the hardware and software resources of a computer device, supporting the operation of information handling programs, as well as other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and other hardware and software in the entity device.
Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and also can be implemented by hardware, after the target offensive object enters a combat state for the target player character, if it is recognized that the target player character is located outside the current offensive range of the target offensive object, determining the target attack range of the target offensive object, and selecting an unoccupied position in the target attack range as an attack position of the target offensive object, thereby controlling the target offensive object to move towards the attack position, and initiating an attack to the target player character after moving to the attack position. The method has the advantages that the phenomenon that a plurality of monsters are stacked in one position is avoided, the attractiveness of a game picture is improved, light pollution caused by a plurality of special effects generated in the same position is avoided, and the problems that the special effects are difficult to see clearly and cannot be accurately selected are solved.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (14)

1. A method of controlling an offensive object, comprising:
when a target attack-able object in a game is in a fighting state for a target player character, acquiring the position of the target player character where the target player character is located, and judging whether the target player character is located in the attack-able range of the target attack-able object or not based on the position of the target player character;
if the target player character is located outside the attack scope of the target attack-able object, determining the target attack scope of the target attack-able object, and determining the attack position of the target attack-able object in the unoccupied position in the target attack scope;
and controlling the target attack-capable object to move to the attack position, and attacking the target player character at the attack position.
2. The method according to claim 1, wherein the determining the attack position of the target offensive object from the unoccupied positions within the target attack range specifically includes:
acquiring all the attack-able objects in a fighting state for the target player character and occupied positions of all the attack-able objects;
determining unoccupied positions within the target attack range based on the occupied positions;
and acquiring the current position of the target attacked object, and determining the attack position of the target attacked object based on the current position and the unoccupied position of the target attacked object.
3. The method according to claim 2, wherein when the unoccupied location includes a plurality of locations, the determining the attack location of the target offensive object based on the current location of the target offensive object and the unoccupied location specifically includes:
detecting whether a connecting line from the current position of the target attack-capable object to the position of the target player character contains any unoccupied position;
if yes, determining the attack position based on any unoccupied position;
if not, acquiring an unoccupied position closest to the current position as the attack position, or acquiring an unoccupied position closest to any point on the connecting line as the attack position, or randomly acquiring one of the unoccupied positions as the attack position.
4. The method according to claim 1, wherein the controlling the target offensive object to move to the attack location specifically includes:
determining a target routing path of the target attacked object based on the current position of the target attacked object and the attack position;
and controlling the target attacked object and moving to the attack position according to the target routing path.
5. The method according to claim 4, wherein the determining the target routing path of the target offensive object based on the current position of the target offensive object and the attack position specifically includes:
performing path planning based on a walking surface including the current position of the target attacked object and the attack position to obtain a path-finding path to be detected, wherein the path-finding path to be detected takes the current position of the target attacked object as a starting point and the attack position as an end point;
if the to-be-detected path-finding path does not contain a convex hull, taking the to-be-detected path-finding path as the target path-finding path;
if the target way finding path comprises a convex hull, taking the way finding path to be detected as the target way finding path when the height of the convex hull is less than or equal to the traveling height threshold value of the target attack object; and when the height of the convex hull is greater than the threshold value of the travel height, correcting the path-finding path to be detected to obtain the target path-finding path so as to enable the target path-finding path not to contain the convex hull, or when the height of the convex hull is greater than the threshold value of the travel height, terminating the fighting state of the target attack-capable object on the target player character.
6. The method of any of claims 1 to 5, wherein after obtaining the target player character position at which the target player character is located, the method further comprises:
and returning to the step of acquiring the position of the target player character where the target player character is located at every preset interval, wherein the preset interval is determined based on a preset frame number and a frame rate, or the preset interval is preset duration.
7. The method of claim 6, further comprising:
in a combat state of the target offensive object, determining a random movement starting point position of the target offensive object in response to a random movement signal of the target offensive object;
determining a random movement end point position of the target attack-capable object in a random movement range corresponding to the random movement start point position;
determining a random movement routing path of the target attack object based on the random movement starting point position and the random movement end point position;
and controlling the target attacked object to move to the random moving end point position according to the random moving path finding path.
8. The method according to claim 7, wherein the random mobile starting point is a current position or a designated position of the target offensive object;
when the random movement starting position is the designated position, the method further includes, before controlling the target attacked object to move to the random movement ending position according to the random movement routing path, the target attacked object to move to the random movement ending position:
and controlling the target attack-capable object to move to the specified position.
9. The method according to claim 7, wherein after determining the randomly moving end point position of the target offensive object within the randomly moving range corresponding to the randomly moving start point position, the method further comprises:
detecting whether the random movement starting point position and the random movement end point position are positioned on the same walking surface, wherein the walking surface corresponds to at least one height of terrain;
if the target attacked object is located on the same walking surface, executing the random movement path finding path based on the random movement starting point position and the random movement end point position to determine the target attacked object;
and if the random movement end point position and the random movement starting point position are not positioned on the same walking surface, re-determining the random movement end point position within the random movement range until the random movement end point position and the random movement starting point position are positioned on the same walking surface.
10. The method of claim 7, wherein after controlling the target aggressor object to move to the randomly moving destination location according to the randomly moving path of travel, the method further comprises:
detecting whether an interrupt signal for the target attack-able object exists or not in the process of controlling the target attack-able object to move to the random moving end point position;
if the interrupt signal exists and the target attacked object belongs to the type which can be interrupted, controlling the target attacked object to execute an interrupt feedback action corresponding to the interrupt signal and controlling the target attacked object to stop moving;
and if the interrupt signal exists and the target attacked object does not belong to the type which can be interrupted, controlling the target attacked object to continue to move to the random moving destination position after executing the interrupt feedback action corresponding to the interrupt signal.
11. The method of claim 7, further comprising:
and under the condition that the target attack-capable object is configured with a distance trigger-type effect, in the process of controlling the target attack-capable object to move to the random movement end point position, if the distance between the target attack-capable object and the target player character is less than a preset trigger distance, triggering the distance trigger-type effect of the target attack-capable object.
12. An apparatus for controlling an offensive object, comprising:
the position judgment module is used for acquiring the position of a target player character where the target player character is located when a target attack object in a game is in a fighting state on the target player character, and judging whether the target player character is located in an attack range of the target attack object or not based on the position of the target player character;
an attack position determination module, configured to determine a target attack range of the target offensive object if the target player character is outside the offensive range of the target offensive object, and determine an attack position of the target offensive object in an unoccupied position within the target attack range;
and the pursuit control module is used for controlling the target attack object to move to the attack position and attacking the target player character at the attack position.
13. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of any of claims 1 to 11.
14. A computer device comprising a storage medium, a processor and a computer program stored on the storage medium and executable on the processor, characterized in that the processor implements the method of any one of claims 1 to 11 when executing the computer program.
CN202111628045.XA 2021-12-28 2021-12-28 Method and device for controlling attack object, storage medium and computer equipment Pending CN114259727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111628045.XA CN114259727A (en) 2021-12-28 2021-12-28 Method and device for controlling attack object, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111628045.XA CN114259727A (en) 2021-12-28 2021-12-28 Method and device for controlling attack object, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114259727A true CN114259727A (en) 2022-04-01

Family

ID=80830918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111628045.XA Pending CN114259727A (en) 2021-12-28 2021-12-28 Method and device for controlling attack object, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114259727A (en)

Similar Documents

Publication Publication Date Title
CN108211358B (en) Information display method and device, storage medium and electronic device
CN111249735B (en) Path planning method and device for control object, processor and electronic device
US20140357356A1 (en) Character battle system controlled by user's flick motion
US20230013014A1 (en) Method and apparatus for using virtual throwing prop, terminal, and storage medium
JP2020103398A (en) Information processing system, information processing program, information processor and information processing method
TWI804032B (en) Method for data processing in virtual scene, device, apparatus, storage medium and program product
US20190262714A1 (en) Game system and method for controlling game system
US20140213332A1 (en) Target game incorporating strategy elements
US20230020032A1 (en) Method, apparatus, and terminal for transmitting message in multiplayer online battle program, and medium
US20170266556A1 (en) Program and system
CN112891932A (en) Method, device, equipment and medium for controlling virtual character to move
CN111450533B (en) Virtual object control method, device, terminal and storage medium in virtual scene
JP2023164787A (en) Picture display method and apparatus for virtual environment, and device and computer program
TWI803147B (en) Virtual object control method, device, apparatus, storage medium, and program product thereof
JP2019000153A (en) Game device, and program of game device
CN110102047B (en) Game operation processing method and device, and game effect display method and device
CN114042309B (en) Virtual prop using method, device, terminal and storage medium
US20230016383A1 (en) Controlling a virtual objectbased on strength values
CN114259727A (en) Method and device for controlling attack object, storage medium and computer equipment
WO2023284407A1 (en) Character control method, terminal, device and storage medium
CN112774189B (en) Picture display method, device, terminal and storage medium
CN112774204B (en) Role collision avoidance method, device, equipment and storage medium
US11395967B2 (en) Selective indication of off-screen object presence
CN113082713B (en) Game control method and device and electronic equipment
CN113769385B (en) Virtual object transfer method and related device

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