Attackable object control method and device, storage medium and computer equipment
By obtaining the target player's character's location in a massively multiplayer online role-playing game and controlling the attackable target to move to an unoccupied space to attack, the problems of monster stacking and visual effects pollution are solved, improving the game's visual appeal and player experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
- Filing Date
- 2021-12-28
- Publication Date
- 2026-06-05
AI Technical Summary
In massively multiplayer online role-playing games, the stacking of monsters reduces the aesthetic appeal of the game graphics, the stacking of special effects causes light pollution, and it makes it difficult for players to accurately select attack targets.
By obtaining the target player's character position, determining whether it is outside the attack range, identifying unoccupied positions within the target's attack range, and controlling the attackable target to move to that position to attack, monster stacking is avoided, the aesthetics of the game screen are improved, and special effects light pollution is reduced.
It effectively avoids monster stacking, improves the aesthetics of the game screen, reduces light pollution from special effects, and solves the problems of special effects being difficult to see and difficult to select accurately.
Smart Images

Figure CN114259727B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer game technology, and in particular to a method and apparatus for controlling an attackable object, a storage medium, and a computer device. Background Technology
[0002] Massive Multiplayer Online Role-Playing Game (MMORPG) is a type of online game. In MMORPGs, when a player-controlled virtual character fights monsters, the monsters usually move directly towards the virtual character and attack once they enter the target's range. When the number of monsters in a scene / game mode is too high, they often pile up together. Excessive monster piling up not only affects the visual aesthetics but also reduces the number of special effects in the same location, easily causing effect stacking and creating light pollution. In addition, monster piling up makes it difficult for players to select their desired target, negatively impacting the player's gaming experience. Summary of the Invention
[0003] In view of this, this application provides a method and device for controlling attackable objects, a storage medium, and a computer device, which helps to avoid multiple monsters stacked in one location, improves the aesthetics of the game screen, avoids multiple special effects in the same location causing light pollution, and solves the problems of special effects being difficult to see and cannot be accurately selected.
[0004] According to one aspect of this application, a method for controlling an attackable object is provided, comprising:
[0005] When a target attackable object in the game is in combat with a target player character, the location of the target player character is obtained, and based on the target player character's location, it is determined whether the target player character is within the attackable range of the target attackable object;
[0006] If the target player character is outside the attack range of the target attackable object, then the target attack range of the target attackable object is determined, and the attack position of the target attackable object is determined in the unoccupied position within the target attack range;
[0007] Control the target attackable object to move to the attack position, and attack the target player character at the attack position.
[0008] Optionally, determining the attack location of the target attackable object within the unoccupied location of the target attack range specifically includes:
[0009] Obtain all attackable targets currently in combat against the target player character, as well as the occupied positions of all attackable targets;
[0010] Based on the occupied locations, determine the unoccupied locations within the target's attack range;
[0011] Obtain the current location of the target attackable object, and determine the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied location.
[0012] Optionally, when there are multiple unoccupied locations, determining the attack location of the target attackable object based on its current location and the unoccupied locations specifically includes:
[0013] Detect whether the line connecting the current position of the target attackable object to the position of the target player character contains any unoccupied space;
[0014] If included, the attack location is determined based on any of the unoccupied locations;
[0015] If not, the attack position is determined by selecting the unoccupied position closest to the current position, or by selecting the unoccupied position closest to any point on the line, or by randomly selecting one of the multiple unoccupied positions.
[0016] Optionally, controlling the target attackable object to move to the attack location specifically includes:
[0017] Based on the current location of the target attackable object and the attack location, determine the target pathfinding path of the target attackable object;
[0018] Control the target attackable object to move to the attack position according to the target pathfinding path.
[0019] Optionally, determining the target pathfinding path for the target attackable object based on its current location and the attack location specifically includes:
[0020] Based on the current position of the target attackable object and the walking surface of the attack position, path planning is performed to obtain the path to be detected, wherein the path to be detected starts from the current position of the target attackable object and ends at the attack position.
[0021] If the path to be detected does not contain a convex hull, then the path to be detected is taken as the target path.
[0022] If the target pathfinding path contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the path to be detected is taken as the target pathfinding path; when the height of the convex hull is greater than the travel height threshold, the path to be detected is modified to obtain the target pathfinding path so that the target path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the combat state of the target attackable object against the target player character is terminated.
[0023] Optionally, after obtaining the location of the target player character, the method further includes:
[0024] At preset intervals, the step of obtaining the location of the target player character is returned, wherein the preset interval is determined based on a preset number of frames and a frame rate, or the preset interval is a preset duration.
[0025] Optionally, the method further includes:
[0026] In the combat state of the target attackable object, in response to the random movement signal of the target attackable object, the random movement starting point position of the target attackable object is determined;
[0027] Within the random movement range corresponding to the random movement starting point position, determine the random movement ending point position of the target attackable object;
[0028] Based on the random starting point position and the random ending point position, determine the random movement path of the target attackable object;
[0029] Control the target attackable object to move towards the random movement endpoint position according to the random movement path.
[0030] Optionally, the random movement starting point position is the current position or a specified position of the target attackable object;
[0031] When the random movement starting point is the specified position, before controlling the target attackable object to move towards the random movement ending point according to the random movement path, the method further includes:
[0032] Control the target attackable object to move to the designated location.
[0033] Optionally, determining the random endpoint position of the attackable target within the random movement range corresponding to the random movement starting point position specifically includes:
[0034] Detect whether the random movement start point and the random movement end point are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height;
[0035] If they are on the same walking surface, then the random movement pathfinding path of the target attackable object is determined based on the random movement start position and the random movement end position.
[0036] If they are not on the same walking surface, the random movement endpoint position is re-determined within the random movement range until the random movement endpoint position and the random movement starting position are on the same walking surface.
[0037] Optionally, after controlling the target attackable object to move towards the random movement endpoint according to the random movement path, the method further includes:
[0038] During the process of controlling the target attackable object to move towards the random moving endpoint position, it is detected whether there is an interruption signal to the target attackable object;
[0039] If the interruption signal exists, and the target attackable object is of the interruptible type, then the target attackable object is controlled to execute the interruption feedback action corresponding to the interruption signal, and the target attackable object is controlled to stop moving.
[0040] If the interruption signal exists and the target attackable object does not belong to the interruptible type, then after controlling the target attackable object to execute the interruption feedback action corresponding to the interruption signal, the target attackable object is controlled to continue moving towards the random moving endpoint position.
[0041] Optionally, the method further includes:
[0042] When the target attackable object is configured with a distance-triggered effect, if the distance between the target attackable object and the target player character is less than a preset trigger distance during the process of controlling the target attackable object to move towards the random moving endpoint, then the distance-triggered effect of the target attackable object is triggered.
[0043] According to another aspect of this application, a control device for an attackable object is provided, comprising:
[0044] The location determination module is used to obtain the location of the target player character when the target attackable object in the game is in a combat state against the target player character, and to determine whether the target player character is within the attackable range of the target attackable object based on the target player character's location;
[0045] The attack position determination module is used to determine the target attack range of the target attackable object if the target player character is outside the attack range of the target attackable object, and to determine the attack position of the target attackable object in an unoccupied position within the target attack range;
[0046] The pursuit control module is used to control the target attackable object to move to the attack position, and attack the target player character at the attack position.
[0047] Optionally, the attack location determination module is specifically used for:
[0048] Obtain all attackable targets currently in combat against the target player character, as well as the occupied positions of all attackable targets;
[0049] Based on the occupied locations, determine the unoccupied locations within the target's attack range;
[0050] Obtain the current location of the target attackable object, and determine the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied location.
[0051] Optionally, the attack location determination module is further configured to:
[0052] When there are multiple unoccupied positions, it is detected whether any unoccupied position is included in the line connecting the current position of the target attackable object to the position of the target player character;
[0053] If included, the attack location is determined based on any of the unoccupied locations;
[0054] If not, the attack position is determined by selecting the unoccupied position closest to the current position, or by selecting the unoccupied position closest to any point on the line, or by randomly selecting one of the multiple unoccupied positions.
[0055] Optionally, the attack location determination module is further configured to:
[0056] Based on the current location of the target attackable object and the attack location, determine the target pathfinding path of the target attackable object;
[0057] Control the target attackable object to move to the attack position according to the target pathfinding path.
[0058] Optionally, the attack location determination module is further configured to:
[0059] Based on the current position of the target attackable object and the walking surface of the attack position, path planning is performed to obtain the path to be detected, wherein the path to be detected starts from the current position of the target attackable object and ends at the attack position.
[0060] If the path to be detected does not contain a convex hull, then the path to be detected is taken as the target path.
[0061] If the target pathfinding path contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the path to be detected is taken as the target pathfinding path; when the height of the convex hull is greater than the travel height threshold, the path to be detected is modified to obtain the target pathfinding path so that the target path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the combat state of the target attackable object against the target player character is terminated.
[0062] Optionally, the position determination module is specifically used for:
[0063] At preset intervals, the step of obtaining the location of the target player character is returned, wherein the preset interval is determined based on a preset number of frames and a frame rate, or the preset interval is a preset duration.
[0064] Optionally, the device further includes:
[0065] The starting point determination module is used to determine the random movement starting point position of the target attackable object in response to the random movement signal of the target attackable object during the combat state of the target attackable object;
[0066] The endpoint determination module is used to determine the random endpoint position of the target attackable object within the random movement range corresponding to the random movement starting position.
[0067] The random path planning module is used to determine the random movement path of the target attackable object based on the random movement start position and the random movement end position.
[0068] The random movement control module is used to control the target attackable object to move towards the random movement endpoint position according to the random movement path.
[0069] Optionally, the random movement starting point position is the current position or a specified position of the target attackable object;
[0070] The random movement control module is further configured to, when the random movement starting point is the designated position, control the target attackable object to move to the designated position before controlling the target attackable object to move to the random movement ending position according to the random movement path.
[0071] Optionally, the endpoint determination module is specifically used for:
[0072] Detect whether the random movement start point and the random movement end point are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height;
[0073] If they are on the same walking surface, then the random movement pathfinding path of the target attackable object is determined based on the random movement start position and the random movement end position.
[0074] If they are not on the same walking surface, the random movement endpoint position is re-determined within the random movement range until the random movement endpoint position and the random movement starting position are on the same walking surface.
[0075] Optionally, the device further includes:
[0076] An interruption control module is used to, after controlling the target attackable object to move towards the random movement endpoint according to the random movement path, detect whether there is an interruption signal for the target attackable object during the movement towards the random movement endpoint; and...
[0077] If the interruption signal exists, and the target attackable object is of an interruptible type, then the target attackable object is controlled to execute the interruption feedback action corresponding to the interruption signal, and the target attackable object is controlled to stop moving; and,
[0078] If the interruption signal exists and the target attackable object does not belong to the interruptible type, then after controlling the target attackable object to execute the interruption feedback action corresponding to the interruption signal, the target attackable object is controlled to continue moving towards the random moving endpoint position.
[0079] Optionally, the device further includes:
[0080] The effect triggering module is used to trigger the distance-triggered effect of the target attackable object when the target attackable object is configured with a distance-triggered effect and the target attackable object is moving towards the random moving endpoint position. If the distance between the target attackable object and the target player character is less than a preset trigger distance, the distance-triggered effect of the target attackable object will be triggered.
[0081] According to another aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described method for controlling an attackable object.
[0082] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described method for controlling an attackable object.
[0083] By employing the above technical solution, this application provides a method, apparatus, storage medium, and computer device for controlling an attackable object. After the target attackable object enters a combat state against a target player character, if it is detected that the target player character is outside the target attackable object's current attack range, the target attack range of the target attackable object is determined, and an unoccupied position within the target attack range is selected as the target attackable object's attack position. This allows the target attackable object to move towards the attack position and launch an attack on the target player character after reaching the attack position. This avoids multiple monsters stacking in one location, improving the aesthetics of the game screen, prevents multiple special effects from causing light pollution in the same location, and solves the problems of special effects being difficult to see and accurately select.
[0084] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0085] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0086] Figure 1 A flowchart illustrating a method for controlling an attackable object according to an embodiment of this application is shown.
[0087] Figure 2 A flowchart illustrating another method for controlling an attackable object provided in an embodiment of this application is shown.
[0088] Figure 3 A flowchart illustrating another method for controlling an attackable object provided in an embodiment of this application is shown.
[0089] Figure 4 A flowchart illustrating another method for controlling an attackable object provided in an embodiment of this application is shown.
[0090] Figure 5 A schematic diagram of the structure of a control device for an attackable object provided in an embodiment of this application is shown. Detailed Implementation
[0091] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0092] This embodiment provides a method for controlling attackable objects, such as... Figure 1 As shown, the method includes:
[0093] Step 101: When the target attackable object in the game is in a combat state against the target player character, obtain the target player character's location, and based on the target player character's location, determine whether the target player character is within the attackable range of the target attackable object;
[0094] Step 102: If the target player character is outside the attack range of the target attackable object, then determine the target attack range of the target attackable object, and determine the attack position of the target attackable object in the unoccupied position within the target attack range;
[0095] Step 103: Control the target attackable object to move to the attack position, and attack the target player character at the attack position.
[0096] This application can be applied to both online and offline game scenarios. Specifically, it can be implemented in the game client running an offline game, or in both the game client and the game server running an online game. This application embodiment is only explained using an online game scenario as an example. Online games have a "hate target" setting. Attacks by attackable targets, represented by monsters, are based on the hate target. The target with the highest hate value in the hate list is the monster's primary attack target. When that hate target disappears, the monster indexes the list and finds the second hate target within its warning range to attack. When there are no hate targets in the list, the monster disengages from combat.
[0097] When a monster (i.e., a target attackable object) enters combat with a target player character, meaning the target player character is currently the target with the highest aggro value, the location of the target player character is obtained. It is then determined whether the target player character is within the monster's attack range. The attack range can be specifically determined based on the monster's current position and its attack range. For example, the attack range can be a circular area with the monster's current position as the center and its attack range as the radius. If the player is within the monster's attack range, the monster will attack the target player character. If the player is outside the monster's attack range, the monster will first approach the target player character until the target player character enters its attack range before attacking. In this embodiment, when it is determined that the target player character is outside the monster's attack range, the monster's target attack range is first determined. This target attack range can be specifically determined based on the target player character's current position and the monster's attack range. For example, the target attack range can be a circular area with the target player character as the center and its attack range as the radius. Next, to avoid monster stacking, the monster's attack position is selected from an unoccupied area within the target's attack range. The monster is then controlled to move towards the attack position to pursue the target player character, finally stopping at the attack position to continue attacking, ensuring the monster ultimately remains in an unoccupied location. In practical applications, an unoccupied location can be one not occupied by other attackable targets, preventing multiple monsters from stacking in one spot. Alternatively, it can be a location not occupied by any non-player or player character, thus improving the game's visual appeal and preventing multiple special effects from causing light pollution in the same location. This mechanism effectively solves the problem of monster "wrapping" caused by multiple overlapping monsters, especially when there are significant size differences between them and no collision points. It also addresses the issue of players being unable to clearly see monsters during skill releases due to monster wrapping and the difficulty in accurately selecting the monster to attack.
[0098] It should be noted that larger monsters occupy more space. If the target monster moves near a larger monster, it may cause the larger monster to stack with the target monster. To further reduce the occurrence of monster stacking, in this embodiment, optionally, the method further includes: obtaining the space occupied by each object within the target attack range; projecting the occupied space onto a horizontal plane to obtain the occupied positions within the target attack range; and determining the unoccupied positions within the target attack range based on the occupied positions.
[0099] In this embodiment, all occupied objects within the target attack range are determined, and the occupied space of each occupied object is obtained. The occupied objects are game characters that need to be avoided from stacking with the target attackable objects. They can include player characters or non-player characters. To avoid the occupied objects being too large and easily stacking with nearby characters, the occupied space of the occupied objects is projected onto a horizontal plane. The projection of the occupied space onto the horizontal plane is taken as the occupied position. In the subsequent process of calculating the attack position for the target attackable object, the occupied positions are avoided to prevent the target attackable object from overlapping with the occupied objects within the attack range in space.
[0100] In this embodiment of the application, the target player character in the game can move in real time. After the target player character moves, it may move out of the attack range of some monsters. At this time, the monsters will chase the target player character. That is, the positions of the target player character and the monsters may change in real time. Therefore, the above steps can be executed once every certain period of time. Optionally, after step 101, the following is included: every preset interval, return to execute step 101. The preset interval is determined based on the preset number of frames and the frame rate, or the preset interval is a preset duration.
[0101] In this embodiment, after step 101, a timer can be started within the game, returning to step 101 at preset intervals. Specifically, this could be at preset time intervals or at preset frame intervals. Figure 2 As shown, after the monster enters combat and begins pursuit, it checks whether the player is within the monster's attack range. If not, based on the monster's attack range and the player's position, it determines the target attack range, controls the monster to move to an unoccupied position within the target attack range, and checks again whether the player is within the monster's attack range. If the player is within the monster's attack range, the monster begins to attack the player. If the player leaves the monster's attack range, it returns to pursuit mode.
[0102] By applying the technical solution of this embodiment, after a target attackable object enters a combat state against a target player character, if it is detected that the target player character is outside the target attackable object's current attack range, the target attack range of the target attackable object is determined, and an unoccupied position within the target attack range is selected as the target attackable object's attack position. This allows the target attackable object to move towards the attack position and launch an attack on the target player character after reaching it. This avoids multiple monsters stacked in one location, improving the aesthetics of the game screen, prevents multiple special effects from causing light pollution in the same location, and solves the problems of special effects being difficult to see and accurately select.
[0103] In this embodiment of the application, optionally, step 102, "determining the attack position of the target attackable object in the unoccupied position within the target attack range," specifically includes:
[0104] Step 102-1: Obtain all attackable targets currently in combat against the target player character, and the occupied positions of all attackable targets;
[0105] Step 102-2: Based on the occupied locations, determine the unoccupied locations within the target attack range;
[0106] Step 102-3: Obtain the current location of the target attackable object, and determine the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied location.
[0107] In this embodiment, since each monster's attack range may be different, all monsters targeting the player character as their primary aggro target can be identified, and the occupied position of each monster can be determined. Then, these occupied positions are removed from all positions within the target's attack range to obtain the unoccupied positions within the target's attack range. Further, one of these unoccupied positions is selected as the monster's attack position.
[0108] In this embodiment of the application, optionally, when the unoccupied locations include multiple locations, step 102-3, "determining the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied locations," specifically includes:
[0109] Detect whether the line connecting the current position of the target attackable object to the position of the target player character contains any unoccupied space;
[0110] If included, the attack location is determined based on any of the unoccupied locations;
[0111] If not, the attack position is determined by selecting the unoccupied position closest to the current position, or by selecting the unoccupied position closest to any point on the line, or by randomly selecting one of the multiple unoccupied positions.
[0112] In this embodiment, an attack position can be selected from unoccupied locations based on the monster's current position. Specifically, following the principle of prioritizing straight-line pursuit, a ray can be fired from the monster's current position to the target player's position. The ray is then checked to see if it contains any unoccupied locations. If it does, the first detected unoccupied location can be used as the attack position. Alternatively, all unoccupied locations on the ray can be identified, and the location with the fewest monsters within a preset range of each unoccupied location can be selected as the attack position. Of course, one of the multiple unoccupied locations on the ray can also be randomly selected as the attack position; this is not limited here. Furthermore, if the ray does not contain any unoccupied locations, the location closest to the monster's current position can be used as the attack position. Alternatively, the location closest to any point on the ray can be used as the attack position. Another option is to randomly select one of the unoccupied locations as the attack position; this is not limited here either.
[0113] Optionally, in this embodiment of the application, step 103, "controlling the target attackable object to move to the attack position," specifically includes:
[0114] Step 103-1: Based on the current location of the target attackable object and the attack location, determine the target pathfinding path of the target attackable object;
[0115] Step 103-2: Control the target attackable object to move to the attack position according to the target pathfinding path.
[0116] In this embodiment, before controlling the monster to move toward the target player character, path planning can be performed first to determine the target path, thereby controlling the monster to move along the planned target path.
[0117] Optionally, in this embodiment of the application, step 103-1 specifically includes:
[0118] S1, based on the walking surface containing the current position of the target attackable object and the attack position, perform path planning to obtain the path to be detected, wherein the path to be detected starts from the current position of the target attackable object and ends at the attack position;
[0119] S2, if the path to be detected does not contain a convex hull, then the path to be detected is taken as the target path.
[0120] S3, if the target pathfinding path contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the path to be detected is taken as the target pathfinding path; when the height of the convex hull is greater than the travel height threshold, the path to be detected is corrected to obtain the target pathfinding path so that the target path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the combat state of the target attackable object against the target player character is terminated.
[0121] In this embodiment, when performing path planning, a walking surface containing the monster's current position and attack position can be obtained first. The walking surface is specifically constructed based on all reachable positions in the game scene. Any two positions in the walking surface are mutually reachable. After determining the walking surface, path planning can be performed on the walking surface with the monster's current position as the starting point and the attack position as the ending point to obtain the path to be detected. In a specific game scene, the shortest path principle can be followed for path planning to obtain the shortest path from the starting point to the ending point as the path to be detected. Furthermore, although the positions on the walking surface are interconnected, the maximum height that each monster can cross may differ. After determining the path to be detected, it is also necessary to check whether the path contains a convex hull. If it does not contain a convex hull, the monster can move along the path, and the path to be detected is taken as the target path. If it contains a convex hull, it is necessary to check whether the monster can pass through it. Specifically, this can be done by comparing the height of the convex hull with the maximum height that the monster can cross (i.e., the travel height threshold). If the height of the convex hull is less than or equal to the travel height threshold, the monster can pass through it, and the path to be detected is taken as the target path. The monster can be controlled to pass through or move onto the convex hull based on its specific travel parameters. If the height of the convex hull is greater than the threshold, the monster cannot pass through it. The path to be detected can be modified to bypass the convex hull, thus determining the target path. Alternatively, if the monster cannot pass through the convex hull, it can be considered that the monster cannot pursue the target player character, and the monster's combat state can be terminated.
[0122] In this embodiment of the application, in order to add richer gameplay effects to the attackable target, optionally, such as Figure 3 As shown, it also includes:
[0123] Step 201: In the combat state of the target attackable object, in response to the random movement signal of the target attackable object, determine the random movement starting point position of the target attackable object;
[0124] Step 202: Within the random movement range corresponding to the random movement starting point position, determine the random movement ending point position of the target attackable object;
[0125] Step 203: Based on the random movement starting point position and the random movement ending point position, determine the random movement path of the target attackable object;
[0126] Step 204: Control the target attackable object to move towards the random movement endpoint position according to the random movement path.
[0127] In this embodiment, when the monster is in combat, it can be configured to move randomly. This random movement can occur during the monster's pursuit of the target player character or during its attack on the target player character. In a specific application scenario, in response to the monster's random movement signal, the starting point position of the monster's random movement is first determined. The starting point position can be the monster's current location, its spawn location, a pre-configured starting point position, or a randomly generated position within the current game scene. Then, within the random movement range corresponding to the starting point position, the ending point position of the random movement is determined. This random movement range can be a circular area centered on the starting point position and with a preset random movement distance as its radius. Further, path planning is performed based on the starting and ending points to obtain a random movement path. Finally, the monster is controlled to move along this path to achieve random movement during combat.
[0128] The random movement mechanism can be combined with other existing mechanisms, and multiple mechanisms can occur simultaneously in a level, enriching the gameplay content within the level. In addition, for rigid point-to-point random movement, developers need to place a large number of points in the level map to create a pseudo-random movement effect. The random mechanism in this application solves the developers' tedious work, saves development time, and reduces development costs.
[0129] In this embodiment of the application, optionally, the random movement starting point position is the current position or a specified position of the target attackable object; when the random movement starting point position is the specified position, the method further includes controlling the target attackable object to move to the specified position before step 204.
[0130] In this embodiment, the designated location can be the monster's spawn location, a pre-configured starting point location, or a randomly generated location within the current game scene. If the random movement starting point location is the designated location, then the monster will first move to the designated location and then move to the random movement endpoint location according to the planned random movement path.
[0131] In this embodiment of the application, in order to improve the success rate of the random movement mechanism and enrich the gameplay, optionally, after step 202, the method further includes: detecting whether the random movement starting point position and the random movement ending point position are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height; if they are located on the same walking surface, then step 203 is executed; if they are not located on the same walking surface, then the method returns to step 201, and within the random movement range, the random movement ending point position is re-determined until the random movement ending point position and the random movement starting point position are located on the same walking surface.
[0132] In the above embodiments, such as Figure 4 As shown, the system checks whether the starting and ending points of the random movement are on the same walking surface. If they are on the same walking surface, the path planning continues. If they are not on the same walking surface, the ending point is redefined until the starting and ending points are on the same walking surface. The walking surface can be a flat terrain with only one elevation or a terrain with varying elevations.
[0133] Additionally, the method for determining the random movement path in step 203 can be found in S1-S3 above, and can be specifically as follows:
[0134] P1. Based on the walking surface containing the random starting point position and the random ending point position, perform path planning to obtain the random path to be detected, wherein the random path to be detected starts from the random starting point position and ends at the random ending point position.
[0135] P2, if the random path to be detected does not contain a convex hull, then the random path to be detected is used as the random movement path; P3, if the random path to be detected contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the random path to be detected is used as the random movement path; when the height of the convex hull is greater than the travel height threshold, the random path to be detected is modified to obtain the random movement path so that the random movement path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the random movement of the target attackable object is terminated.
[0136] Under the random movement mechanism of this application, monsters can move smoothly and randomly in any small space without being restricted by the terrain. When monsters encounter low-lying mounds or shrub roots, they can easily climb the terrain. When facing tall trees or buildings, they can correctly and quickly detour around them, thus achieving the effect of truly disordered and random monster movement.
[0137] Optionally, after step 204, the method further includes:
[0138] Step 205: During the process of controlling the target attackable object to move towards the random moving endpoint position, detect whether there is an interruption signal to the target attackable object;
[0139] Step 206: If the interruption signal exists and the target attackable object is of the interruptible type, then control the target attackable object to execute the interruption feedback action corresponding to the interruption signal, and control the target attackable object to stop moving.
[0140] Step 207: If the interruption signal exists and the target attackable object does not belong to the interruptible type, then after controlling the target attackable object to execute the interruption feedback action corresponding to the interruption signal, the target attackable object is controlled to continue moving towards the random moving endpoint position.
[0141] In the above embodiment, when the monster randomly moves into the attack range of the target player character, the player can attack the monster. In the game scene, if the monster is interrupted during its random movement, that is, if an interruption signal is detected, then if the monster is of the interruptible type, the monster will stop moving randomly after being attacked. If the monster is of the uninterruptible type, such as a monster with super armor, then the monster will continue to move along the random path until it reaches the random movement endpoint.
[0142] Optionally, in this embodiment of the application, it further includes: when the target attackable object is configured with a distance-triggered effect, during the process of controlling the target attackable object to move towards the random moving endpoint position, if the distance between the target attackable object and the target player character is less than a preset trigger distance, then the distance-triggered effect of the target attackable object is triggered.
[0143] In this embodiment, when the monster itself has a continuous follow-damage effect (i.e., a distance-triggered effect), the monster will enter a random movement state. If the player approaches the monster, the effect will be triggered immediately. Due to the completely random movement of the monster, the uncertainty and playability of the level will be significantly increased in complex battle situations, thus improving the player's gaming experience.
[0144] Furthermore, as Figure 1 In terms of specific implementation of the method, this application provides a control device for attackable objects, such as... Figure 5 As shown, the device includes:
[0145] The location determination module is used to obtain the location of the target player character when the target attackable object in the game is in a combat state against the target player character, and to determine whether the target player character is within the attackable range of the target attackable object based on the target player character's location;
[0146] The attack position determination module is used to determine the target attack range of the target attackable object if the target player character is outside the attack range of the target attackable object, and to determine the attack position of the target attackable object in an unoccupied position within the target attack range;
[0147] The pursuit control module is used to control the target attackable object to move to the attack position, and attack the target player character at the attack position.
[0148] Optionally, the attack location determination module is specifically used for:
[0149] Obtain all attackable targets currently in combat against the target player character, as well as the occupied positions of all attackable targets;
[0150] Based on the occupied locations, determine the unoccupied locations within the target's attack range;
[0151] Obtain the current location of the target attackable object, and determine the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied location.
[0152] Optionally, the attack location determination module is further configured to:
[0153] When there are multiple unoccupied positions, it is detected whether any unoccupied position is included in the line connecting the current position of the target attackable object to the position of the target player character;
[0154] If included, the attack location is determined based on any of the unoccupied locations;
[0155] If not, the attack position is determined by selecting the unoccupied position closest to the current position, or by selecting the unoccupied position closest to any point on the line, or by randomly selecting one of the multiple unoccupied positions.
[0156] Optionally, the attack location determination module is further configured to:
[0157] Based on the current location of the target attackable object and the attack location, determine the target pathfinding path of the target attackable object;
[0158] Control the target attackable object to move to the attack position according to the target pathfinding path.
[0159] Optionally, the attack location determination module is further configured to:
[0160] Based on the walking surface containing the current position of the target attackable object and the attack position, path planning is performed to obtain the path to be detected, wherein the path to be detected starts from the current position of the target attackable object and ends at the attack position.
[0161] If the path to be detected does not contain a convex hull, then the path to be detected is taken as the target path.
[0162] If the target pathfinding path contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the path to be detected is taken as the target pathfinding path; when the height of the convex hull is greater than the travel height threshold, the path to be detected is modified to obtain the target pathfinding path so that the target path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the combat state of the target attackable object against the target player character is terminated.
[0163] Optionally, the position determination module is specifically used for:
[0164] At preset intervals, the step of obtaining the location of the target player character is returned, wherein the preset interval is determined based on a preset number of frames and a frame rate, or the preset interval is a preset duration.
[0165] Optionally, the device further includes:
[0166] The starting point determination module is used to determine the random movement starting point position of the target attackable object in response to the random movement signal of the target attackable object during the combat state of the target attackable object;
[0167] The endpoint determination module is used to determine the random endpoint position of the target attackable object within the random movement range corresponding to the random movement starting position.
[0168] The random path planning module is used to determine the random movement path of the target attackable object based on the random movement start position and the random movement end position.
[0169] The random movement control module is used to control the target attackable object to move towards the random movement endpoint position according to the random movement path.
[0170] Optionally, the random movement starting point position is the current position or a specified position of the target attackable object;
[0171] The random movement control module is further configured to, when the random movement starting point is the designated position, control the target attackable object to move to the designated position before controlling the target attackable object to move to the random movement ending position according to the random movement path.
[0172] Optionally, the endpoint determination module is specifically used for:
[0173] Detect whether the random movement start point and the random movement end point are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height;
[0174] If they are on the same walking surface, then the random movement pathfinding path of the target attackable object is determined based on the random movement start position and the random movement end position.
[0175] If they are not on the same walking surface, the random movement endpoint position is re-determined within the random movement range until the random movement endpoint position and the random movement starting position are on the same walking surface.
[0176] Optionally, the device further includes:
[0177] An interruption control module is used to, after controlling the target attackable object to move towards the random movement endpoint according to the random movement path, detect whether there is an interruption signal for the target attackable object during the movement towards the random movement endpoint; and...
[0178] If the interruption signal exists, and the target attackable object is of an interruptible type, then the target attackable object is controlled to execute the interruption feedback action corresponding to the interruption signal, and the target attackable object is controlled to stop moving; and,
[0179] If the interruption signal exists and the target attackable object does not belong to the interruptible type, then after controlling the target attackable object to execute the interruption feedback action corresponding to the interruption signal, the target attackable object is controlled to continue moving towards the random moving endpoint position.
[0180] Optionally, the device further includes:
[0181] The effect triggering module is used to trigger the distance-triggered effect of the target attackable object when the target attackable object is configured with a distance-triggered effect and the target attackable object is moving towards the random moving endpoint position. If the distance between the target attackable object and the target player character is less than a preset trigger distance, the distance-triggered effect of the target attackable object will be triggered.
[0182] It should be noted that other corresponding descriptions of the functional units involved in the control device for an attackable target provided in this application embodiment can be found by referring to... Figures 1 to 4 The corresponding descriptions in the method will not be repeated here.
[0183] Based on the above, Figures 1 to 4 Accordingly, this application also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described method. Figures 1 to 4 The method of controlling the attackable object is shown.
[0184] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), and includes several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.
[0185] Based on the above, Figures 1 to 4 The method shown, and Figure 5 To achieve the above objectives, the present application also provides a computer device, specifically a personal computer, server, network device, etc., as shown in the virtual device embodiment. This computer device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figures 1 to 4 The method of controlling the attackable object is shown.
[0186] 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, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Bluetooth interfaces, Wi-Fi interfaces), etc.
[0187] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0188] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software within the physical device.
[0189] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms, or it can be implemented using hardware. After the target attackable object enters a combat state against the target player character, if it is detected that the target player character is outside the target attackable object's current attack range, the target attack range of the target attackable object is determined, and an unoccupied position within the target attack range is selected as the target attackable object's attack position. This controls the target attackable object to move towards the attack position and launches an attack on the target player character after moving to the attack position. This avoids multiple monsters stacked in one location, improving the aesthetics of the game screen, avoids multiple special effects causing light pollution in the same location, and solves the problems of special effects being difficult to see and accurately select.
[0190] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0191] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for controlling an attackable object, characterized in that, include: When a target attackable object in the game is in combat with a target player character, the location of the target player character is obtained, and based on the target player character's location, it is determined whether the target player character is within the attackable range of the target attackable object; If the target player character is outside the attack range of the target attackable object, then the target attack range of the target attackable object is determined, and the attack position of the target attackable object is determined in the unoccupied position within the target attack range; Control the target attackable object to move to the attack position, and attack the target player character at the attack position; In the combat state of the target attackable object, in response to the random movement signal of the target attackable object, the random movement starting position of the target attackable object is determined; within the random movement range corresponding to the random movement starting position, the random movement ending position of the target attackable object is determined; wherein, the random movement starting position is the current position or a designated position of the target attackable object; The system detects whether the random movement start point and the random movement end point are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height. If they are not located on the same walking surface, the random movement end point is re-determined within the random movement range until the random movement end point and the random movement start point are located on the same walking surface. If they are located on the same walking surface, a random movement path is determined based on the random movement start point and the random movement end point. The system controls the target attackable object to move towards the random movement end point according to the random movement path. When the random movement start point is the designated location, before controlling the target attackable object to move towards the random movement end point according to the random movement path, the system further includes: controlling the target attackable object to move to the designated location.
2. The method according to claim 1, characterized in that, Determining the attack location of the target attackable object within the unoccupied location of the target attack range specifically includes: Obtain all attackable targets currently in combat against the target player character, as well as the occupied positions of all attackable targets; Based on the occupied locations, determine the unoccupied locations within the target's attack range; Obtain the current location of the target attackable object, and determine the attack location of the target attackable object based on the current location of the target attackable object and the unoccupied location.
3. The method according to claim 2, characterized in that, When there are multiple unoccupied locations, determining the attack location of the target attackable object based on its current location and the unoccupied locations specifically includes: Detect whether the line connecting the current position of the target attackable object to the position of the target player character contains any unoccupied space; If included, the attack location is determined based on any of the unoccupied locations; If not, the attack position is determined by selecting the unoccupied position closest to the current position, or by selecting the unoccupied position closest to any point on the line, or by randomly selecting one of the multiple unoccupied positions.
4. The method according to claim 1, characterized in that, The control of the target attackable object to move to the attack position specifically includes: Based on the current location of the target attackable object and the attack location, determine the target pathfinding path of the target attackable object; Control the target attackable object to move to the attack position according to the target pathfinding path.
5. The method according to claim 4, characterized in that, The step of determining the target pathfinding path of the target attackable object based on the current location of the target attackable object and the attack location specifically includes: Based on the current position of the target attackable object and the walking surface of the attack position, path planning is performed to obtain the path to be detected, wherein the path to be detected starts from the current position of the target attackable object and ends at the attack position. If the path to be detected does not contain a convex hull, then the path to be detected is taken as the target path. If the target pathfinding path contains a convex hull, then when the height of the convex hull is less than or equal to the travel height threshold of the target attackable object, the path to be detected is taken as the target pathfinding path; when the height of the convex hull is greater than the travel height threshold, the path to be detected is modified to obtain the target pathfinding path so that the target path does not contain the convex hull, or, when the height of the convex hull is greater than the travel height threshold, the combat state of the target attackable object against the target player character is terminated.
6. The method according to any one of claims 1 to 5, characterized in that, After obtaining the location of the target player character, the method further includes: At preset intervals, the step of obtaining the location of the target player character is returned, wherein the preset interval is determined based on a preset number of frames and a frame rate, or the preset interval is a preset duration.
7. The method according to claim 1, characterized in that, After controlling the target attackable object to move towards the random movement endpoint according to the random movement path, the method further includes: During the process of controlling the target attackable object to move towards the random moving endpoint position, it is detected whether there is an interruption signal to the target attackable object; If the interruption signal exists, and the target attackable object is of the interruptible type, then the target attackable object is controlled to execute the interruption feedback action corresponding to the interruption signal, and the target attackable object is controlled to stop moving. If the interruption signal exists and the target attackable object does not belong to the interruptible type, then after controlling the target attackable object to execute the interruption feedback action corresponding to the interruption signal, the target attackable object is controlled to continue moving towards the random moving endpoint position.
8. The method according to claim 7, characterized in that, The method further includes: When the target attackable object is configured with a distance-triggered effect, if the distance between the target attackable object and the target player character is less than a preset trigger distance during the process of controlling the target attackable object to move towards the random moving endpoint, then the distance-triggered effect of the target attackable object is triggered.
9. A control device for an attackable object, characterized in that, include: The location determination module is used to obtain the location of the target player character when the target attackable object in the game is in a combat state against the target player character, and to determine whether the target player character is within the attackable range of the target attackable object based on the target player character's location; The attack position determination module is used to determine the target attack range of the target attackable object if the target player character is outside the attack range of the target attackable object, and to determine the attack position of the target attackable object in an unoccupied position within the target attack range; The pursuit control module is used to control the target attackable object to move to the attack position, and attack the target player character at the attack position; The starting point determination module is used to determine the random movement starting point position of the target attackable object in response to the random movement signal of the target attackable object during the combat state of the target attackable object; wherein, the random movement starting point position is the current position or a specified position of the target attackable object; The endpoint determination module is used to determine the random endpoint position of the target attackable object within the random movement range corresponding to the random movement starting position; specifically, it is used to detect whether the random movement starting position and the random movement endpoint position are located on the same walking surface, wherein the walking surface corresponds to terrain of at least one height; if they are not located on the same walking surface, the random movement endpoint position is re-determined within the random movement range until the random movement endpoint position and the random movement starting position are located on the same walking surface; The random path planning module is used to determine the random movement path of the attackable target based on the random movement start position and the random movement end position if they are on the same walking surface. A random movement control module is used to control the target attackable object to move towards the random movement endpoint position according to the random movement path; wherein, when the random movement starting position is the designated position, the target attackable object is controlled to move to the designated position before controlling the target attackable object to move towards the random movement endpoint position according to the random movement path.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 8.
11. 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, When the processor executes the computer program, it implements the method of any one of claims 1 to 8.