A virtual role battle control method, device, equipment and storage medium

By introducing a quadtree mechanism into the card game, the target enemy character can be quickly filtered, solving the problem of high computational complexity in traditional automatic battle algorithms and achieving a smooth battle experience with hundreds of units on the same screen.

CN122124467APending Publication Date: 2026-06-02WUHU DOUZHAOWAN NETWORK TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHU DOUZHAOWAN NETWORK TECHNOLOGY CO LTD
Filing Date
2026-03-31
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Traditional automatic battle algorithms have high computational complexity in card games, which can easily cause lag in low-performance clients, especially when there are many enemy characters and many friendly characters, the amount of computation increases significantly.

Method used

A quadtree mechanism is introduced, which constructs a quadtree based on the map data and combat units of the game's battle scene. By querying the region and traversing the quadtree, the target enemy character can be quickly obtained, reducing the computational complexity of selecting the target enemy character.

Benefits of technology

It effectively supports smooth battles with hundreds of units on screen simultaneously, reduces computational complexity from O(N) to O(logN+K), and improves the game's compatibility with client hardware performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122124467A_ABST
    Figure CN122124467A_ABST
Patent Text Reader

Abstract

This application belongs to the field of computer technology and discloses a method, device, equipment, and storage medium for combat control of virtual characters. The method includes: in response to an automatic combat command, acquiring map data and combat units of the game combat scene; the combat units include multiple friendly characters and multiple enemy characters; constructing a quadtree based on the map data and combat units; when any friendly character's target enemy character dies, detecting whether the friendly character has a skill to be released; if so, acquiring the friendly character's current coordinates in the game combat scene and the attack range of the skill to be released; constructing a query region based on the current coordinates and attack range; traversing the quadtree based on the query region to obtain at least one target enemy character; and controlling the friendly character to use the skill to be released on the target enemy character. This application can reduce the computational complexity of target enemy character selection and support smooth combat with hundreds of units on the same screen.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for combat control of virtual characters. Background Technology

[0002] In card game gameplay, users can assemble their own characters upon entering a game level. After clicking "Start Auto-Battle," the game application will control the user's selected characters and enemy characters in the game level to fight based on an auto-battle algorithm. Each character can release multiple skills, and different skills require a certain waiting time before they can be used again. In traditional auto-battle algorithms, each character will determine the enemy characters within its attack range based on the attack range of its currently available skills (if multiple skills exist simultaneously, the skill to be released will be selected according to the preset skill type priority). It will then select the closest or lowest-health enemy character to release its skill. When there are no enemy characters within its attack range, the character will move towards the nearest enemy character until a target enemy character is identified.

[0003] However, traditional automatic battle algorithms need to iterate through and calculate the distance between all enemy characters and the current friendly character in order to filter out enemy characters that are within the skill's attack range, and then further check their remaining health. When there are many enemy characters in the scene or a large number of friendly characters on the field, the amount of calculation will increase significantly, and clients with poor performance are prone to lag. Summary of the Invention

[0004] This application provides a combat control method, device, equipment, and storage medium for virtual characters, which can reduce the computational complexity of target enemy character selection, support smooth combat with hundreds of units on the same screen, and improve the game's compatibility with client hardware performance.

[0005] In a first aspect, embodiments of this application provide a combat control method for a virtual character, applied to a client, including: In response to the automatic combat command, the system acquires map data and combat units of the game's combat scene; the combat units include multiple friendly characters and multiple enemy characters; a quadtree is constructed based on the map data and combat units; When any friendly character's target enemy character dies, check if the friendly character has any skills yet to be used; If so, obtain the current coordinates of your character in the game's battle scene and the attack range of the skill to be released; Construct a query region based on the current coordinates and attack range; Based on the query region, traverse the quadtree to obtain at least one target enemy character; Control your own character to use the skill to target the enemy character.

[0006] Furthermore, the above-mentioned quadtree construction based on map data and combat units includes: Obtain the preset maximum capacity of the node and construct the root node of the quadtree based on the map data; The leaf nodes of the quadtree are constructed based on the preset maximum capacity of the nodes and the combat units. The leaf nodes include the combat unit's unit attributes, unique ID, and current coordinates.

[0007] Furthermore, the method also includes: If it is detected that an allied character has two or more skills to be released, then obtain the skill release priority list of the allied characters; determine the current skill to be released based on the skill release priority list; The query region is constructed based on the current coordinates and the attack range of the skill to be released.

[0008] Furthermore, the above method, based on traversing the quadtree through the query region, yields at least one target enemy character, including: Recursively traverse the quadtree starting from the root node to obtain the leaf nodes that intersect with the query region. The combat units whose unit attributes are enemy are selected as the target enemy character in the intersecting leaf nodes.

[0009] Furthermore, the method also includes: If two or more target enemy characters are obtained after traversing the quadtree, then each target enemy character obtained is taken as a candidate enemy character, and the attribute data of each candidate enemy character is obtained; among which, the attribute data includes the current coordinates, remaining health, current aggro value and character type of the candidate enemy character. The attribute data is weighted and evaluated to obtain the target value of the corresponding candidate enemy character; Select the enemy character with the highest target value as the target enemy character.

[0010] Furthermore, the method also includes: After a friendly character receives an attack from any enemy character, check if the enemy character's aggro value exists in the friendly character's aggro value list. If it does, update the aggro value based on the enemy character's attack damage. If not, calculate the aggro value based on the enemy character's attack damage and add it to the friendly character's aggro value list.

[0011] Furthermore, the aforementioned weighted evaluation of attribute data yields the target value of the corresponding candidate enemy character, including: Calculate the distance between the enemy and friendly characters based on the current coordinates of the enemy character to be selected and the current coordinates of the friendly character; Use the ratio of the maximum attack range of the skill to be released to the distance between the enemy and the player as the distance factor; Calculate the skill counter coefficient based on the enemy character type to be selected and the skill to be released; The ratio of the enemy's maximum health to their remaining health is used as the health factor. The target value of the selected enemy character is calculated by weighting the distance factor, health factor, current aggro value, and skill counter coefficient according to the preset weighting factor.

[0012] Furthermore, the method also includes: Before your character uses a skill to target an enemy character, calculate the optimal attack position based on the skill to be used and the current coordinates of the enemy character; control your character to move to the optimal attack position and use the skill to target the enemy character.

[0013] Furthermore, the attribute data of the enemy characters to be selected also includes the current number locked by the player and the maximum allowed number locked; the method also includes: after obtaining the attribute data of each enemy character to be selected, removing enemy characters to be selected whose current number locked by the player is greater than or equal to the maximum allowed number locked.

[0014] Furthermore, the method also includes: After identifying the target enemy character, increase the number of friendly units currently locked on the target enemy character by 1.

[0015] Furthermore, the method also includes: If the target enemy character dies, the number of friendly units currently locked on the target enemy character is reset to zero; If an ally dies, the number of enemy ally characters currently locked by the ally dies will decrease by 1.

[0016] Secondly, embodiments of this application provide a combat control device for a virtual character, applied to a client, comprising: The quadtree module is used to respond to automatic combat commands, obtain map data and combat units of the game's combat scene; the combat units include multiple friendly characters and multiple enemy characters; and construct a quadtree based on the map data and combat units. The friendly detection module is used to detect whether a friendly character has a skill to be released after any friendly character's target enemy character dies; if so, it obtains the friendly character's current coordinates in the game's combat scene and the attack range of the skill to be released; and constructs a query area based on the current coordinates and attack range. The node traversal module is used to traverse the quadtree based on the query region to obtain at least one target enemy character; The player's control module is used to control player characters to use skills that are about to be released on target enemy characters.

[0017] Furthermore, the quadtree module is used to obtain the preset maximum capacity of the nodes and construct the root node of the quadtree based on the map data; it constructs the leaf nodes of the quadtree based on the preset maximum capacity of the nodes and the combat units; wherein, the leaf nodes include the unit attributes, unique ID and current coordinates of the combat units.

[0018] Furthermore, the self-detection module is also used to obtain the skill release priority list of the self-character when it detects that the self-character has two or more skills to be released; determine the current skill to be released based on the skill release priority list; and construct a query area based on the current coordinates and the attack range of the current skill to be released.

[0019] Furthermore, the node traversal module is specifically used to recursively traverse the quadtree starting from the root node, obtain the leaf nodes that intersect with the query region, and take the combat units with the enemy attribute in the intersecting leaf nodes as the target enemy characters.

[0020] Furthermore, the device also includes a multi-factor evaluation module, which, when two or more target enemy characters are obtained after traversing the quadtree, uses each target enemy character as a candidate enemy character and obtains the attribute data of each candidate enemy character. The attribute data includes the current coordinates, remaining health, current aggro value, and character type of the candidate enemy character. The attribute data is weighted and evaluated to obtain the target value of the corresponding candidate enemy character. The candidate enemy character with the highest target value is selected as the target enemy character.

[0021] Furthermore, the device also includes a hate value update module, which is used to determine whether the hate value of the enemy character exists in the hate value list of the friendly character after the friendly character receives an attack from any enemy character; if it does, the hate value is updated according to the damage value of the enemy character's attack; if not, the hate value is calculated according to the damage value of the enemy character's attack and added to the hate value list of the friendly character.

[0022] Furthermore, the attribute data of the enemy characters to be selected also includes the current number of characters locked by the player and the maximum allowed number of characters locked; the device also includes a lock number control module, which is used to remove enemy characters to be selected whose current number of characters locked by the player is greater than or equal to the maximum allowed number of characters locked after acquiring the attribute data of each enemy character to be selected.

[0023] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the steps of a combat control method for a virtual character as described in any of the above embodiments.

[0024] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a combat control method for a virtual character as described in any of the above embodiments.

[0025] In summary, compared with the prior art, the beneficial effects of the technical solution provided in this application include at least the following: This application provides a combat control method for virtual characters. To avoid calculating the distances of all enemy characters in the scene, this application introduces a quadtree mechanism. When the user activates the automatic combat mode, a quadtree is constructed based on the map data of the game's combat scene and the combat units in the scene. When a friendly character's target enemy character dies and the friendly character has a skill to be released, a query region is constructed based on the current coordinates and the attack range of the skill to be released. By traversing the quadtree through the query region, new attackable target enemy characters are quickly obtained. The above method, through the quadtree mechanism, reduces the computational complexity of target enemy character selection from O(N) to O(logN+K), where N is the total number of combat units in the game's combat scene and K is the number of enemy characters, thereby effectively supporting smooth combat with hundreds of units on screen simultaneously. Attached Figure Description

[0026] Figure 1 A flowchart illustrating a combat control method for a virtual character, provided as an exemplary embodiment of this application.

[0027] Figure 2 A flowchart illustrating the steps for determining the enemy character to be selected, provided as an exemplary embodiment of this application.

[0028] Figure 3 A flowchart of a multi-factor value assessment step provided for an exemplary embodiment of this application.

[0029] Figure 4 This is a structural diagram of a combat control device for a virtual character, provided as an exemplary embodiment of this application. Detailed Implementation

[0030] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0031] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0032] Please see Figure 1 This application provides a combat control method for virtual characters, applied to a client, including: Step S11: In response to the automatic battle command, obtain the map data and combat units of the game battle scene; the combat units include multiple friendly characters and multiple enemy characters; construct a quadtree based on the map data and combat units.

[0033] Specifically, the above-mentioned construction of a quadtree based on map data and combat units includes: Step S111: Obtain the preset maximum capacity of the node and construct the root node of the quadtree based on the map data.

[0034] Step S112: Construct the leaf nodes of the quadtree according to the preset maximum capacity of the node and the combat units.

[0035] The maximum capacity of a node is the number of combat units that a single leaf node can hold. A leaf node includes the unit attributes, unique ID, and current coordinates of the combat unit. The unit attributes are either friendly or enemy attributes.

[0036] In the actual implementation process, since combat units move, the quadtree needs to be updated periodically. To avoid full reconstruction every frame, this application adopts an incremental update strategy, that is, every frame or at fixed intervals, all moved combat units are traversed, removed from their original nodes, and re-inserted into the node corresponding to the current coordinates. If a combat unit dies, it is immediately removed from the quadtree.

[0037] Step S12: When any friendly character's target enemy character dies, check if the friendly character has a skill to be released; if so, obtain the friendly character's current coordinates in the game battle scene and the attack range of the skill to be released.

[0038] Furthermore, the method also includes: if it is detected that a friendly character has two or more skills to be released, then obtain a list of skill release priorities for the friendly character; determine the current skill to be released based on the skill release priority list; and construct a query region based on the current coordinates and the attack range of the current skill to be released.

[0039] Specifically, when an allied character defeats the corresponding target enemy character, if the target still has a skill available, the player will proceed with the subsequent quadtree target acquisition process; otherwise, the player will remain stationary in the game's battle scene until the skill cooldown ends.

[0040] In practice, if a player character has multiple skills and has multiple skills available after defeating the target enemy character, the player character will select the highest priority skill from the available skills list based on the player character's skill release priority list.

[0041] Step S13: Construct a query region based on the current coordinates and the attack range.

[0042] Step S14: Traverse the quadtree based on the query region to obtain at least one target enemy character.

[0043] Specifically, the above method of traversing the quadtree based on the query region yields at least one target enemy character, including: Step S141: Recursively traverse the quadtree starting from the root node to obtain the leaf nodes that intersect with the query region.

[0044] Step S142: Select the combat units in the intersecting leaf nodes whose unit attributes are enemy as the target enemy character.

[0045] This application achieves faster and simpler enemy character filtering by constructing and traversing a quadtree, which is faster than the existing technology that calculates the distance between all enemy characters and friendly characters. The amount of computation is greatly reduced, and the performance requirements of the client are reduced accordingly.

[0046] Step S15: Control your own character to use the skill to be released on the target enemy character.

[0047] Furthermore, the method also includes: Before your character uses a skill to target an enemy character, calculate the optimal attack position based on the skill to be used and the current coordinates of the enemy character; control your character to move to the optimal attack position and use the skill to target the enemy character.

[0048] In the specific implementation process, considering that the mechanism of the skill to be released may limit the damage value to the target enemy character to the attack angle or attack distance, or there may be obstacles on the map between the friendly character and the target enemy character, which may cause the skill effect to penetrate the obstacle if the friendly character releases the skill directly at the current coordinates, this application calculates the best attack position based on the position of the skill to be released and the target enemy character after determining the target enemy character. If there are other combat units at the best attack position, the best attack position is recalculated. After determining the best attack position, A* or Flow Field path planning is used, combined with avoidance logic, to make the friendly character move to the best attack position before releasing the corresponding skill.

[0049] If a friendly character gains a new skill to use during the pursuit, it will not affect the priority of the currently available skill. If the identified enemy character is killed by another friendly character during the pursuit, the pursuit will be interrupted, and all friendly characters locked onto that enemy character will have to re-execute step S12.

[0050] It should be noted that the aforementioned enemy detection algorithm is executed on the player's client. The server does not participate in real-time combat calculations, but is only responsible for storing battle report commands and verifying results. Battle report commands refer to the client uploading the combat process to the server in the form of command streams (such as "Our character A releases skill X at time t, hitting enemy character B and causing damage Y").

[0051] The above embodiments provide a combat control method for virtual characters. To avoid calculating the distances of all enemy characters in the scene, this application introduces a quadtree mechanism. When the user activates the automatic combat mode, a quadtree is constructed based on the map data of the game's combat scene and the combat units in the scene. When a friendly character's target enemy character dies and the friendly character has a skill to be released, a query region is constructed based on the current coordinates and the attack range of the skill to be released. By traversing the quadtree through the query region, new attackable target enemy characters are quickly obtained. This method, through the quadtree mechanism, reduces the computational complexity of target enemy character selection from O(N) to O(logN+K), where N is the total number of combat units in the game's combat scene and K is the number of enemy characters, thus effectively supporting smooth combat with hundreds of units on screen simultaneously.

[0052] Please see Figure 2 and Figure 3 In some embodiments, the method further includes: Step S21: If two or more target enemy characters are obtained after traversing the quadtree, then each target enemy character obtained is taken as a candidate enemy character, and the attribute data of each candidate enemy character is obtained.

[0053] The attribute data includes the current coordinates, remaining health, current aggro value, and character type of the enemy character to be selected.

[0054] The current aggro value is calculated based on the cumulative attacks from the target enemy character against the current friendly character. Specifically, the method further includes: after a friendly character receives an attack from any enemy character, determining whether there is an enemy character's aggro value in the friendly character's aggro value list; if there is, updating the aggro value based on the enemy character's attack damage value; if not, calculating the aggro value based on the enemy character's attack damage value and adding it to the friendly character's aggro value list.

[0055] Specifically, the attack damage value can be directly used as the aggro value or a newly added aggro value, or the attack damage value can be multiplied by a preset aggro value conversion coefficient and then added to or used as the aggro value of the enemy character towards the player character.

[0056] The character type is determined based on which types of enemy characters each of your character's skills have additional effects against. In order to increase the target value, if the character type of a candidate enemy character meets the conditions for your character's skill to generate additional damage, the target value of the candidate enemy character will be increased.

[0057] Step S22: Perform a weighted evaluation on the attribute data to obtain the target value of the corresponding candidate enemy character.

[0058] Specifically, the above-mentioned weighted evaluation of attribute data yields the target value of the corresponding candidate enemy character, including: Step S221: Calculate the distance between the enemy and the player based on the current coordinates of the enemy character to be selected and the current coordinates of the player character.

[0059] Step S222: Use the ratio of the maximum attack range of the skill to be released to the distance between the enemy and the player as a distance factor.

[0060] Step S223: Calculate the skill counter coefficient based on the character type of the enemy character to be selected and the skill to be released.

[0061] Step S224: Use the ratio of the maximum health of the enemy to be selected to the remaining health as the health factor.

[0062] Step S225: Calculate the target value of the selected enemy character by weighting the distance factor, health factor, current aggro value, and skill counter coefficient according to the preset weighting factor.

[0063] Specifically, target value = α × distance factor + β × health factor + δ × current aggro value + ε × skill counter coefficient.

[0064] Here, α, β, δ and ε are the preset weighting factors for the corresponding attribute data. These preset weighting factors can be equal or selected according to user preferences. As long as the sum is 1, it is sufficient.

[0065] Step S23: Select the enemy character with the highest target value as the target enemy character.

[0066] In existing technologies, when facing multiple enemy characters, only a single parameter such as remaining health or distance is often considered, ignoring the strong threat posed by enemy characters with high values. This results in the automatic combat mode lacking tactical depth and wasting output skills.

[0067] Therefore, this application upgrades the selection mechanism from a single "lowest health" or "closest distance" to a multi-factor weighted evaluation, comprehensively considering multiple factors and dynamically calculating the priority of each candidate enemy character to achieve intelligent selection. Specifically, the multi-factor weighted evaluation mechanism can be understood as follows: the distance factor is inversely proportional to the distance between the player character and the candidate enemy character; the closer the player character is to the candidate enemy character, the higher the target value of the candidate enemy character. The health factor is inversely proportional to the remaining health of the candidate enemy character; the lower the remaining health, the higher the target value of the candidate enemy character. The skill counter coefficient is based on the player character's unreleased skills. The skill's effectiveness is determined by the enemy character type. For example, if the skill to be used has an additional damage effect on a certain type of enemy character, the corresponding skill effectiveness coefficient is the additional damage value of the skill due to the different character types. If the skill to be used does not have an additional damage effect on the enemy character, the skill effectiveness coefficient is 0. Since the current aggro value is related to the damage dealt by the enemy character to our characters, the current aggro value is directly proportional to the target value. This increases the target value of high-damage enemy characters, i.e., their threat level is high, causing our characters to prioritize attacking high-threat enemy characters.

[0068] In an automatic combat system, multiple friendly characters triggering the target acquisition algorithm simultaneously can indeed lead to multiple friendly characters selecting the same enemy character as their target, resulting in wasted firepower (overkill) or tactical imbalance.

[0069] To address the aforementioned issues, in some embodiments, the attribute data of the enemy characters to be selected also includes the current number of friendly targets locked and the maximum allowed number of targets locked; the method may further include: After obtaining the attribute data of each candidate enemy character, remove candidate enemy characters whose current locked number is greater than or equal to the maximum allowed locked number from the attribute data.

[0070] Here, `lockedByCount` represents the number of friendly characters currently targeting the enemy character, and `maxLockCount` represents the maximum number of friendly characters allowed to simultaneously target the enemy character. After friendly characters obtain multiple potential enemy characters through quadtree traversal, a check is performed on each potential enemy character to determine if `lockedByCount >= maxLockCount`. If the check is yes, the corresponding potential enemy character is released; otherwise, further target value calculation is performed.

[0071] Furthermore, the method also includes: After identifying the target enemy character, increase the number of friendly units currently locked on the target enemy character by 1.

[0072] If the target enemy character dies, the number of friendly units currently locked on the target enemy character is reset to zero.

[0073] If an ally dies, the number of enemy ally characters currently locked by the ally dies will decrease by 1.

[0074] Specifically, when an enemy character dies / is defeated, their lockedByCount is automatically reset to zero. When an allied character is defeated by an enemy character, the lockedByCount of the target enemy character is released.

[0075] It should be noted that since the combat logic is executed sequentially in a single thread, when multiple friendly characters are searching for enemies in the same frame, once the first friendly character locks in, subsequent friendly characters can see the updated lock count, thus avoiding duplicate locking and eliminating the need for additional synchronization.

[0076] Please see Figure 4 One embodiment of this application provides a combat control device for a virtual character, applied to a client, comprising: The quadtree module 101 is used to respond to automatic combat commands, obtain map data and combat units of the game combat scene; the combat units include multiple friendly characters and multiple enemy characters; and construct a quadtree based on the map data and combat units.

[0077] The friendly detection module 102 is used to detect whether a friendly character has a skill to be released after any friendly character's target enemy character dies; if so, it obtains the friendly character's current coordinates in the game battle scene and the attack range of the skill to be released; and constructs a query area based on the current coordinates and the attack range.

[0078] The node traversal module 103 is used to traverse the quadtree based on the query region to obtain at least one target enemy character.

[0079] The friendly control module 104 is used to control friendly characters to use skills to target enemy characters.

[0080] Furthermore, the quadtree module 101 is used to obtain the preset maximum capacity of the nodes and construct the root node of the quadtree according to the map data; construct the leaf nodes of the quadtree according to the preset maximum capacity of the nodes and the combat units; wherein, the leaf nodes include the unit attributes, unique ID and current coordinates of the combat units.

[0081] Furthermore, the self-detection module 102 is also used to obtain the skill release priority list of the self-character when it detects that the self-character has two or more skills to be released; determine the current skill to be released based on the skill release priority list; and construct a query area based on the current coordinates and the attack range of the current skill to be released.

[0082] Furthermore, the node traversal module 103 is specifically used to recursively traverse the quadtree starting from the root node, obtain the leaf nodes that intersect with the query area, and take the combat units with the enemy attribute in the intersecting leaf nodes as the target enemy characters.

[0083] Furthermore, the device also includes a multi-factor evaluation module, which, when two or more target enemy characters are obtained after traversing the quadtree, uses each target enemy character as a candidate enemy character and obtains the attribute data of each candidate enemy character. The attribute data includes the current coordinates, remaining health, current aggro value, and character type of the candidate enemy character. The attribute data is weighted and evaluated to obtain the target value of the corresponding candidate enemy character. The candidate enemy character with the highest target value is selected as the target enemy character.

[0084] Furthermore, the device also includes a hate value update module, which is used to determine whether the hate value of the enemy character exists in the hate value list of the friendly character after the friendly character receives an attack from any enemy character; if it does, the hate value is updated according to the damage value of the enemy character's attack; if not, the hate value is calculated according to the damage value of the enemy character's attack and added to the hate value list of the friendly character.

[0085] Furthermore, the attribute data of the enemy characters to be selected also includes the current number of characters locked by the player and the maximum allowed number of characters locked; the device also includes a lock number control module, which is used to remove enemy characters to be selected whose current number of characters locked by the player is greater than or equal to the maximum allowed number of characters locked after acquiring the attribute data of each enemy character to be selected.

[0086] The specific limitations of the combat control device for a virtual character provided in this embodiment can be found in the embodiment of the combat control method for a virtual character described above, and will not be repeated here. Each module in the aforementioned combat control device for a virtual character can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0087] This application provides a computer device that may include a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it causes the processor to perform the steps of a combat control method for a virtual character as described in any of the above embodiments.

[0088] The working process, working details, and technical effects of the computer device provided in this embodiment can be found in the embodiment of a combat control method for a virtual character described above, and will not be repeated here.

[0089] This application provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the steps of a combat control method for a virtual character as described in any of the above embodiments. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or memory sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The working process, details, and technical effects of the computer-readable storage medium provided in this embodiment can be found in the embodiments of a combat control method for a virtual character described above, and will not be repeated here.

[0090] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).

[0091] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0092] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A combat control method for a virtual character, characterized in that, Applied to the client side, including: In response to an automatic combat command, the system acquires map data and combat units of the game's combat scene; the combat units include multiple friendly characters and multiple enemy characters; a quadtree is constructed based on the map data and the combat units; When any friendly character's target enemy character dies, check if the friendly character has any skills yet to be used. If so, obtain the current coordinates of the player character in the game's battle scene and the attack range of the skill to be released; A query region is constructed based on the current coordinates and the attack range; Based on the query region, traverse the quadtree to obtain at least one target enemy character; Control your own character to use the skill to be released on the target enemy character.

2. The combat control method for virtual characters according to claim 1, characterized in that, The construction of a quadtree based on the map data and the combat units includes: Obtain the preset maximum capacity of the node, and construct the root node of the quadtree based on the map data; The leaf nodes of the quadtree are constructed based on the preset maximum capacity of the node and the combat unit; The leaf node includes the combat unit's unit attributes, unique ID, and current coordinates.

3. The combat control method for virtual characters according to claim 1, characterized in that, Also includes: If it is detected that the allied character has two or more skills to be released, then obtain the skill release priority list of the allied character. The skill to be released is determined based on the skill release priority list. The query region is constructed based on the current coordinates and the attack range of the skill to be released.

4. The combat control method for virtual characters according to claim 2, characterized in that, The step of traversing the quadtree based on the query region to obtain at least one target enemy character includes: Recursively traverse the quadtree starting from the root node to obtain the leaf nodes that intersect with the query region; The combat units whose unit attributes are enemy in the intersecting leaf nodes are taken as the target enemy character.

5. The combat control method for virtual characters according to claim 1, characterized in that, Also includes: If two or more target enemy characters are obtained after traversing the quadtree, then each of the target enemy characters obtained is taken as a candidate enemy character, and the attribute data of each candidate enemy character is obtained; wherein, the attribute data includes the current coordinates, remaining health, current aggro value and character type of the candidate enemy character. The attribute data is weighted and evaluated to obtain the target value of the corresponding candidate enemy character; The enemy character with the highest target value is selected as the target enemy character.

6. The combat control method for virtual characters according to claim 5, characterized in that, Also includes: After a friendly character receives an attack from any enemy character, check if the enemy character's aggro value exists in the friendly character's aggro value list. If so, the aggro value is updated based on the enemy character's attack damage value; otherwise, the aggro value is calculated based on the enemy character's attack damage value and added to the friendly character's aggro value list.

7. The combat control method for virtual characters according to claim 6, characterized in that, The weighted evaluation of the attribute data to obtain the target value of the corresponding candidate enemy character includes: The distance between the enemy and the player is calculated based on the current coordinates of the enemy character to be selected and the current coordinates of the player character. The ratio of the maximum attack range of the skill to be released to the distance between the enemy and the player is used as the distance factor; Calculate the skill counter coefficient based on the character type of the enemy character to be selected and the skill to be released; The ratio of the maximum health of the enemy to be selected to the remaining health is used as the health factor; The target value of the selected enemy character is obtained by weighting the distance factor, the health factor, the current aggro value, and the skill counter coefficient according to a preset weighting factor.

8. The combat control method for virtual characters according to claim 5, characterized in that, Also includes: Before the friendly character uses the skill to be released on the target enemy character, the optimal attack position is calculated based on the skill to be released and the current coordinates of the target enemy character; Control your own character to move to the optimal attack position and use the skill to be released on the target enemy character.

9. The combat control method for virtual characters according to claim 5, characterized in that, The attribute data of the enemy characters to be selected also includes the current number locked by the player and the maximum allowed number locked; it also includes: After obtaining the attribute data of each of the candidate enemy characters, remove the candidate enemy characters whose current number of locks is greater than or equal to the maximum allowed number of locks.

10. The combat control method for virtual characters according to claim 9, characterized in that, Also includes: After identifying the target enemy character, increment the number of friendly units currently locked on the target enemy character by 1.

11. The combat control method for virtual characters according to claim 10, characterized in that, Also includes: If the target enemy character dies, the current number of friendly units locked on the target enemy character is reset to zero. If the aforementioned friendly character dies, the number of friendly characters currently locked on by the target enemy character of the aforementioned friendly character is reduced by 1.

12. A combat control device for a virtual character, characterized in that, Applied to the client side, including: The quadtree module is used to respond to automatic combat commands by acquiring map data and combat units of the game's combat scene; the combat units include multiple friendly characters and multiple enemy characters; and a quadtree is constructed based on the map data and the combat units. The friendly detection module is used to detect whether a friendly character has a skill to be released after any friendly character's target enemy character dies; if so, it obtains the friendly character's current coordinates and the attack range of the skill to be released in the game's battle scene; and constructs a query region based on the current coordinates and the attack range. The node traversal module is used to traverse the quadtree based on the query region to obtain at least one target enemy character. The friendly control module is used to control the friendly character to use the skill to be released on the target enemy character.

13. The combat control device for virtual characters according to claim 12, characterized in that, The quadtree module is used to obtain the preset maximum capacity of the nodes and construct the root node of the quadtree according to the map data; construct the leaf nodes of the quadtree according to the preset maximum capacity of the nodes and the combat units; wherein, the leaf nodes include the unit attributes, unique ID and current coordinates of the combat units.

14. The combat control device for virtual characters according to claim 12, characterized in that, The self-detection module is also used to obtain a skill release priority list of the self-character when it detects that the self-character has two or more skills to be released. The skill to be released is determined based on the skill release priority list. The query region is constructed based on the current coordinates and the attack range of the skill to be released.

15. The combat control device for virtual characters according to claim 13, characterized in that, The node traversal module is specifically used to recursively traverse the quadtree starting from the root node, obtain the leaf nodes that intersect with the query region, and take the combat units with the enemy attribute in the intersecting leaf nodes as the target enemy characters.

16. The combat control device for virtual characters according to claim 12, characterized in that, It also includes a multi-factor evaluation module, used to, when two or more target enemy characters are obtained after traversing the quadtree, use each of the traversed target enemy characters as candidate enemy characters and obtain the attribute data of each candidate enemy character; wherein, the attribute data includes the current coordinates, remaining health, current aggro value and character type of the candidate enemy character; perform a weighted evaluation on the attribute data to obtain the target value of the corresponding candidate enemy character; and select the candidate enemy character with the highest target value as the target enemy character.

17. The combat control device for virtual characters according to claim 16, characterized in that, It also includes a hate value update module, which is used to determine whether the hate value of the enemy character exists in the hate value list of the friendly character after the friendly character receives an attack from any enemy character; if it does, the hate value is updated according to the attack damage value of the enemy character; if not, the hate value is calculated according to the attack damage value of the enemy character and added to the hate value list of the friendly character.

18. The combat control device for virtual characters according to claim 16, characterized in that, The attribute data of the enemy characters to be selected also includes the current number of characters locked by the player and the maximum allowed number of characters locked; the device also includes a lock number control module, which is used to remove enemy characters to be selected whose current number of characters locked by the player is greater than or equal to the maximum allowed number of characters locked after acquiring the attribute data of each enemy character to be selected.

19. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the combat control method for the virtual character as described in any one of claims 1 to 11.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the combat control method for the virtual character as described in any one of claims 1 to 11.