A tower defense method and system

By dividing the spatial area of ​​the tower defense system, calculating the threat coefficient, and performing dynamic scheduling, the problem of the inability of tower defense devices to be comprehensively managed is solved, thereby improving the win rate and flexibility of tower defense.

CN115569378BActive Publication Date: 2026-03-20NORTHWEST INST OF NUCLEAR TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing tower defense systems cannot guarantee the comprehensive management of multiple tower defense devices within the system when defending against a tower, resulting in a reduced success rate for the tower defense devices during defense.

Method used

By using a pre-set simulation system, spatial areas are divided, distribution information of tower defense devices and mobile objects is collected, threat coefficients are calculated, high-threat areas are ranked, and dynamic scheduling and defense are carried out based on the matching probability of threat coefficients and tower defense device types, so as to realize the comprehensive management of tower defense devices.

Benefits of technology

It enables comprehensive planning of multiple spatial areas during tower defense, avoiding defense failures caused by tower defense devices failing to aim and strike in time at a certain moment, and improving the success rate and flexibility of tower defense devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115569378B_ABST
    Figure CN115569378B_ABST
Patent Text Reader

Abstract

The present application relates to tower defense, in particular to a kind of tower defense method and system, to solve the technical problem that the existing tower defense system cannot be comprehensive in the defense of pagoda, leading to the win rate of tower defense device when defending is reduced, the present application provides a kind of tower defense method and system, the method comprises the following steps: preset initial data;Collect the distribution information of tower defense device and mobile body at current time, calculate the threat coefficient of multiple space regions, and obtain the high threat area at current time accordingly;Determine whether the high threat area obtained exists tower defense device, and whether reinforcement is needed;If there is no tower defense device and / or need reinforcement, then dispatch the tower defense device in idle state in adjacent space region;If there is tower defense device and does not need reinforcement, then determine whether tower defense confrontation is ended;If yes, then output confrontation result, if not, then collect the distribution information of tower defense device and mobile body at next time.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to tower defense, in particular to a tower defense method and system. BACKGROUND

[0002] Tower defense is a classic application scenario of game theory, and is also a hot field of current artificial intelligence algorithm research. The characteristics of tower defense are that both the attack and defense parties can take different actions at any time, so it is difficult for either party to predict the specific strategy of the other party at the next moment, and it is difficult to achieve the purpose of protecting the pagoda by a single defense strategy. In the prior art, when the flying zombies approach the pagoda from all around, the tower defense device rotates at a certain speed, aims at and attacks the flying zombies. If the density of the flying zombies far away is very large, and the tower defense device only aims at the flying zombies close, at a certain moment, when the flying zombies far away reach the pagoda, the tower defense device does not have enough time and number to aim and attack, which will lead to tower defense failure. Therefore, it is necessary to comprehensively arrange all the tower defense devices to obtain a more reasonable defense strategy. SUMMARY

[0003] The purpose of the present application is to solve the technical problem that the existing tower defense system cannot guarantee the comprehensive arrangement of multiple tower defense devices in the defense system when defending the pagoda, resulting in a decrease in the winning rate of the tower defense device during defense, and to provide a tower defense method and system.

[0004] To solve the above technical problems, the technical solution provided by the present application is as follows:

[0005] A tower defense method, characterized in that it comprises the following steps:

[0006] S1, a preset deduction system is provided, the deduction system is provided with a plurality of tower defense devices, a plurality of mobile bodies and a target tower body for tower defense, the tower defense devices and the mobile bodies each have one or more types; the target tower body is taken as the center, and its periphery is divided into N space regions along the circumference, N is an integer greater than or equal to 1, each of the space regions comprises a defense area and an attack-defense area, the plurality of tower defense devices are located in the defense area and are arranged along the periphery of the target tower body, the defense area is inside the attack-defense area, and the plurality of mobile bodies are preset in the attack-defense area;

[0007] The state of the tower defense device includes an idle state, an aiming state and an attack state, the type of the tower defense device includes an A-type tower defense device for point attack and a B-type tower defense device for surface attack, each type of tower defense device is matched with each type of mobile body, and a matching probability is preset;

[0008] S2, distribution information of the tower defense devices and the mobile bodies in each space region in the deduction system at the current moment is collected;

[0009] S3, calculating threat coefficient D of each space region at the current time according to distribution information of the moving body at the current time;

[0010] S4, according to threat coefficient D of each space region at the current time, sequentially ranking N space regions from high to low according to threat coefficient, defining the first M space regions as high threat regions at the current time, M≤N, and M is an integer;

[0011] S5, judging whether there is A type tower defense device or the B type tower defense device in the M current time high threat regions;

[0012] If yes, judging whether the current time high threat region needs reinforcement, if needing reinforcement, executing S6, if not needing reinforcement, according to the matching probability of the A type tower defense device and the B type tower defense device, selecting the A type tower defense device or the B type tower defense device in the current time high threat region through probability, defending the target tower, and executing S7;

[0013] If no, executing S6;

[0014] S6, according to threat coefficient of the current time high threat region and the number of tower defense devices already pointing to the current time high threat region, calculating the number N of tower defense devices needed to reinforce the current time high threat region r , and scheduling the tower defense devices in the idle state in the space region adjacent to the current time high threat region, returning to S5;

[0015] S7, judging whether there is a moving body entering the defense area, and whether there is a moving body in all space regions; if there is a moving body entering the defense area or there is no moving body in all space regions, the tower defense confrontation ends, and the confrontation result is output; otherwise, according to the deduction environment parameters and the deduction model at the current time, generating the deduction environment at the next time, and returning to S2.

[0016] Further, in S6, scheduling the tower defense devices in the idle state in the space region adjacent to the current time high threat region includes the following steps:

[0017] S6.1, judging whether the number N r of required tower defense devices is less than the number of tower defense devices in the idle state in the space region;

[0018] If yes, according to the distribution information of the obtained tower defense devices and the moving body, selecting the multiple tower defense devices in the idle state in the space region, so that the number of selected tower defense devices is equal to the number N r of required tower defense devices, and scheduling the selected tower defense devices;

[0019] If no, continue to dispatch the tower defense devices in the next spatial region in the order from near to far to the target tower body, and execute S6.2;

[0020] S6.2, return to execute S6.1.

[0021] Further, in S2, the distribution information of the tower defense devices includes the number, type and survival rate of the tower defense devices in each spatial region; and the distribution information of the mobile bodies includes the number, type and speed of the mobile bodies in each spatial region.

[0022] Further, the selection of the plurality of tower defense devices in the spatial region in S6.1 includes the following steps:

[0023] S6.1.1, according to the obtained distribution information of the mobile bodies, and the matching probability of each type of mobile body and the survival rate of each tower defense device in the spatial region, calculate the dispatch probability of each tower defense device in the spatial region;

[0024] S6.1.2, according to the dispatch probability of each tower defense device, sort all the tower defense devices in the spatial region in descending order of the dispatch probability, and select the first N r tower defense devices as the selected tower defense devices, and dispatch them.

[0025] Further, the defense of the target tower body in S5 includes the following steps:

[0026] S5.1, according to the obtained distribution information of the mobile bodies, make the A-type tower defense devices in the high-threat region at the current time aim at the mobile body closest to them in the current region, or make the B-type tower defense devices in the high-threat region at the current time aim at the region with the highest spatial density of mobile bodies in the current region, to obtain the A-aiming association or B-aiming association at the current time;

[0027] S5.2, the deduction system makes the selected A-type tower defense devices or B-type tower defense devices sequentially access the aiming state and the attack state according to the A-aiming association or B-aiming association at the current time;

[0028] S5.3, determine whether the aiming association at the current time is the A-aiming association or the B-aiming association; if it is the A-aiming association, execute S5.4; if it is the B-aiming association, execute S5.5;

[0029] S5.4, determine whether the A-type tower defense device has hit a mobile body after aiming;

[0030] If yes, execute S5.1; if no, make it access the aiming state and the attack state again.

[0031] S5.5, judging whether more than half of the mobile bodies in the current space region are shot down by the tower defense device aiming at the current space region;

[0032] If yes, the tower defense device is in the idle state; if no, the tower defense device is in the aiming state and the attack state again.

[0033] Further, the threat coefficient D of each space region is calculated in S3, and the calculation formula is:

[0034]

[0035] Wherein, R represents the radius of the defense zone, r represents the distance between the mobile body and the target tower body, X is a constant, represents a distribution factor, and N represents the number of all mobile bodies in the space region at the current time.

[0036] Further, the number N of tower defense devices that need to be reinforced in the high-threat region at the current time is calculated in S6, and the calculation formula is: r

[0037]

[0038] Wherein, N t represents the number of mobile bodies in all space regions at the current time, and th is a constant, representing a dispatch intensity parameter.

[0039] Meanwhile, the application provides a tower defense confrontation system for implementing the tower defense confrontation method, and the special feature is that the system comprises a strategy unit, the strategy unit comprises a collection module and an output module, and a high-threat module, a first judgment module, a second judgment module, a reinforcement module and a third judgment module are connected with the output end of the collection module respectively.

[0040] ​The output ends of the high-threat module and the reinforcement module are connected with the input end of the first judging module, two output ends of the first judging module are connected with the input ends of the reinforcement module and the second judging module respectively, two output ends of the second judging module are connected with the input ends of the reinforcement module and the third judging module respectively, two output ends of the third judging module are connected with the collection module and the output module respectively, the collection module and the second judging module are used for data connection with an external deduction system, the external deduction system is used for generating a deduction environment at a current time and deducing a plurality of tower defense devices in the deduction environment at the current time, a plurality of tower defense devices for tower defense confrontation, a plurality of mobile bodies and a target tower body are preset in the external deduction system, the plurality of tower defense devices are randomly preset at the periphery of the target tower body, the types of the tower defense devices include A-type tower defense devices for point attack and B-type tower defense devices for surface attack, the periphery of the target tower body is divided into N space regions, N is an integer greater than or equal to 1; the collection module is data-connected with the plurality of tower defense devices and the plurality of mobile bodies respectively;

[0041] The collection module is used for collecting distribution information of the tower defense devices and the mobile bodies in each space region in the deduction environment at the current time;

[0042] The high-threat module is used for obtaining a threat coefficient D of each space region at the current time according to the obtained distribution information of the mobile bodies at the current time, and obtaining M high-threat regions at the current time according to the threat coefficient D, M is an integer less than or equal to N;

[0043] The first judging module is used for judging whether there is an A-type tower defense device or a B-type tower defense device in the M high-threat regions at the current time; if yes, the second judging module is accessed; if not, the reinforcement module is accessed;

[0044] The second judging module is used for judging whether the high-threat region at the current time needs reinforcement; if yes, the reinforcement module is accessed; if not, an A-type tower defense device or a B-type tower defense device in the high-threat region at the current time is selected by probability according to the matching probabilities of the A-type tower defense device and the B-type tower defense device, the target tower body is defended, and the third judging module is accessed;

[0045] The reinforcement module is used for calculating a number N of tower defense devices needed for reinforcement in the high-threat region at the current time according to the threat coefficient of the high-threat region at the current time and the number of tower defense devices already pointed to the high-threat region at the current time, and dispatching tower defense devices in an idle state in a space region adjacent to the high-threat region at the current time according to the number N, and the first judging module is accessed; r

[0046] ​The third judging module is used for judging whether a mobile body enters the defense area and whether there is a mobile body in all space areas; if a mobile body enters the defense area or there is no mobile body in all space areas, it indicates that the tower defense confrontation ends, and the output module is accessed; otherwise, according to the external deduction system at the next moment, a deduction environment at the next moment is generated and the collection module is accessed;

[0047] The output module is used for outputting the tower defense confrontation result.

[0048] The present application has the beneficial effects compared with the prior art:

[0049] 1. The tower defense confrontation method provided by the present application realizes the comprehensive operation of all tower defense devices by collecting the distribution information of the tower defense devices and the mobile bodies at each moment, obtaining the threat coefficients of the multiple space areas around the target tower body, covering the distance, threat degree and other restriction factors in the tower defense process, and defending the high-threat areas in the multiple space areas at each moment, so as to avoid the situation that the tower defense devices do not have enough time and number to aim and attack when the flying zombies hit the pagoda at a moment, resulting in the failure of the target tower body defense.

[0050] 2. The tower defense confrontation method provided by the present application can make the tower defense more intelligent and flexible by flexibly selecting the scheduled tower defense device according to the real-time confrontation information when the number of the tower defense devices required to be reinforced in the high-threat area at the current moment is greater than the number of the idle tower defense devices in the adjacent area.

[0051] 3. The tower defense confrontation method provided by the present application is not only suitable for small-scale tower defense, but also suitable for large-scale tower defense, and can complete the tower defense confrontation in a short time, so it has high practicability. BRIEF DESCRIPTION OF DRAWINGS

[0052] Figure 1 The flowchart of the tower defense confrontation method provided by the present application is shown in the figure;

[0053] Figure 2 The principle diagram of the strategy unit in the tower defense confrontation system provided by the present application is shown in the figure;

[0054] Figure 3 The relationship diagram between the winning rate and the flying zombies in the small-scale defense instance in the tower defense confrontation method provided by the present application is shown in the figure;

[0055] Figure 4Part of the defense confrontation chart in a small-scale defense example of the tower defense confrontation method provided by the application, wherein (a), (b), (c) are part of the defense confrontation chart of the tower defense device and the flying zombie at 8 seconds, 13 seconds and 17 seconds, respectively;

[0056] Figure 5 The relationship chart of the winning rate and the flying zombie in the large-scale defense example (I) of the tower defense confrontation method provided by the application;

[0057] Figure 6 The relationship chart of the winning rate and the flying zombie in the large-scale defense example (II) of the tower defense confrontation method provided by the application. DETAILED DESCRIPTION

[0058] The application will be further described below in combination with the drawings and specific embodiments.

[0059] Reference Figure 1 The application provides a tower defense confrontation method based on a classic strategy, which comprises the following steps:

[0060] S1, a preset deduction system is provided, the deduction system is provided with a plurality of tower defense devices, a plurality of mobile bodies and a target tower body for tower defense confrontation, the tower defense devices and the mobile bodies each have one or more types;

[0061] The target tower body is taken as the center, and its periphery is divided into N space regions in the circumferential direction, N is an integer greater than or equal to 1, each space region comprises a defense region and an attack-defense region, the plurality of tower defense devices are located in the defense region and are arranged along the periphery of the target tower body, the defense region is inside the attack-defense region, and the plurality of mobile bodies are preset in the attack-defense region;

[0062] The state of the tower defense device in the embodiment comprises an idle state, a sighting state and an attack state, wherein the tower defense device in the idle state is a schedulable tower defense device, and the tower defense device in the sighting state or the attack state is a non-schedulable tower defense device; the type of the tower defense device comprises an A-type tower defense device for point attack and a B-type tower defense device for surface attack, each type of tower defense device is matched with each type of mobile body, and a matching probability is preset, which functions to select the type of the tower defense device used according to the type probability of the mobile body in the current space region.

[0063] In the embodiment, the type of the mobile body comprises a light-sensitive type, a signaling type and an attack type, wherein the light-sensitive type mobile body has a relatively large matching probability with the A-type tower defense device, and the attack type mobile body has a relatively large matching probability with the B-type tower defense device.

[0064] S2, collect distribution information of the tower defense device and the mobile body in each space region at the current time; in the embodiment, the distribution information of the tower defense device includes the number, type and survival rate of the tower defense device in each space region, and the distribution information of the mobile body includes the number, type and speed of the mobile body in each space region.

[0065] S3, according to the obtained distribution information of the mobile body at the current time, calculate the threat coefficient D of each space region at the current time, and the calculation formula is:

[0066]

[0067] wherein R represents the radius of the defense zone, r represents the distance between the mobile body and the target tower, X represents the distribution factor, and N represents the number of all mobile bodies in the space region at the current time, the distribution factor X in the embodiment is a constant, which is determined according to the preset distribution information of the tower defense device, and the value is not unique. As can be seen from the above formula, the smaller the distance r between the mobile body and the target tower in the space region, and the larger the number N of all mobile bodies, the greater the threat coefficient D of the space region. The threat coefficient in the embodiment covers the distance, threat degree and other restriction factors in the tower defense process, and has comprehensiveness. The distance here refers to the distance between the mobile body and the target tower, and the threat degree refers to the threat degree of the mobile body to the target tower. The arrangement of all tower defense devices is set in this way to realize intelligent defense of the target tower.

[0068] S4, according to the obtained threat coefficient D of each space region at the current time, sort the N space regions in order from high to low according to the threat coefficient, define the first M space regions as high threat regions, and M≤N and is an integer; the high threat region in the embodiment is selected according to the obtained threat coefficient, that is, according to the comprehensiveness of the threat coefficient, the selected high threat region also has comprehensiveness, and the threat degree is not only determined according to the distance.

[0069] S5, judge whether there is an A type tower defense device or the B type tower defense device in the obtained M current time high threat regions;

[0070] If yes, judge whether the current time high threat region needs reinforcement, if yes, execute S6; if no, select the A type tower defense device or the B type tower defense device in the current time high threat region according to the matching probability of the A type tower defense device and the B type tower defense device respectively, and defend the target tower by probability, and execute S7;

[0071] If no, execute S6;

[0072] After the high-threat area is screened out, the high-threat area is subjected to defense processing to change the high-threat area into a low-threat area. If there is no tower defense device in the current area or the number of tower defense devices is insufficient, other tower defense devices in other space areas are dispatched to provide defense.

[0073] The target tower body is subjected to defense in this embodiment, including the following steps:

[0074] S5.1, according to the distribution information of the mobile bodies, the A-type tower defense device in the high-threat area at the current time is aimed at the mobile body closest to it in the current area, or the B-type tower defense device in the high-threat area at the current time is aimed at the area with the highest spatial density of mobile bodies in the current area, to obtain the A-aiming association or B-aiming association at the current time;

[0075] S5.2, the deduction system causes the selected A-type tower defense device or B-type tower defense device to sequentially access the aiming state and the attack state according to the A-aiming association or B-aiming association at the current time;

[0076] S5.3, it is judged whether the aiming association at the current time is the A-aiming association or the B-aiming association; if it is the A-aiming association, S5.4 is executed; if it is the B-aiming association, S5.5 is executed;

[0077] S5.4, it is judged whether the A-type tower defense device has shot down a mobile body after aiming;

[0078] If yes, S5.1 is executed; if no, it is caused to again sequentially access the aiming state and the attack state;

[0079] S5.5, it is judged whether the B-type tower defense device has shot down more than half of the mobile bodies in the current space area after aiming;

[0080] If yes, it is caused to be in an idle state; if no, it is caused to again sequentially access the aiming state and the attack state.

[0081] S6, according to the threat coefficient of the high-threat area at the current time and the number of tower defense devices that have been pointed to the high-threat area at the current time, the number N of tower defense devices required for reinforcement of the high-threat area at the current time is calculated r , and according to the number N of tower defense devices required for reinforcement of the high-threat area at the current time, the tower defense devices in an idle state in the space area adjacent to the high-threat area at the current time are dispatched, and S5 is returned to; r

[0082] In this embodiment, the calculation formula of the number N of tower defense devices required for reinforcement of the high-threat area at the current time is: r

[0083] ​​

[0084] wherein, N t represents the number of mobile bodies in all spatial regions, th represents the dispatching intensity parameter, the dispatching intensity parameter th in the embodiment is a constant, which is determined according to the number threshold of the tower defense devices, and the value is not unique.

[0085] As described above, only the tower defense devices in the idle state can be dispatched, and the embodiment dispatches the tower defense devices in the idle state in the spatial region adjacent to the high-threat region at the current time, which specifically includes the following steps:

[0086] S6.1, judging whether the required number of tower defense devices N r is less than the number of tower defense devices in the idle state in the spatial region;

[0087] If yes, the multiple tower defense devices in the idle state in the spatial region are selected according to the obtained distribution information of the tower defense devices and the mobile bodies, so that the number of the selected tower defense devices is equal to the required number of tower defense devices N r , and the selected tower defense devices are dispatched; if no, the next tower defense device in the idle state in the next spatial region is dispatched in the order from the nearest to the farthest to the target tower, and S6.2 is executed;

[0088] S6.2, returning to execute S6.1 for continuously judging whether the required number of tower defense devices N r is less than the number of tower defense devices in the idle state in the next spatial region;

[0089] The selection of the multiple tower defense devices in the idle state in the spatial region in the embodiment includes the following steps:

[0090] S6.1.1, calculating the dispatch probability of each tower defense device in the idle state in the spatial region according to the obtained distribution information of the mobile bodies, and the matching probability of each type of mobile body and the survival rate of the tower defense device itself;

[0091] S6.1.2, according to the dispatch probability of each tower defense device, sequentially sorting all the tower defense devices in the idle state in the descending order of the dispatch probability, and taking the first N r tower defense devices as the selected tower defense devices, and dispatching the selected tower defense devices;

[0092] S7, judging whether a mobile body enters the defense zone, and whether there is a mobile body in all spatial regions;

[0093] If there is a mobile body entering the defense zone or there is no mobile body in all space regions, the tower defense confrontation ends, and the confrontation result is output; otherwise, the next moment of deduction environment is generated according to the deduction environment parameters and deduction model of the current moment, and the process returns to S2.

[0094] In the embodiment, after the high-threat region of the current moment has been processed, the embodiment only needs to determine whether the current tower defense confrontation has ended. If it has ended, the confrontation result is output. If it has not ended, the high-threat region of the current moment has changed to a low-threat region, the next moment of high-threat region is selected and processed, and the tower defense confrontation is determined again. If the tower defense confrontation ends, either the mobile body enters the defense zone or there is no mobile body in all space regions, and the tower defense confrontation result is output after the tower defense confrontation ends.

[0095] The following gives a small-scale defense example and a large-scale defense example of the embodiment:

[0096] Small-scale defense example:

[0097] Referring to Figure 3 , the horizontal coordinate represents the number of flying zombies, and the vertical coordinate represents the win rate of the tower defense device. The tower defense device in the embodiment is preset with 3 devices, and the mobile body is a flying zombie with a number threshold of 90. Among them, one is a class A tower defense device, and two are class B tower defense devices. A fixed number of flying zombies is selected, and the tower defense confrontation method in the embodiment is used for 30 parallel defense experiments, i.e. N 平行 = 30, and the number of defense successes N 成功 under different flying zombie numbers is counted. The win rate R 胜率 of the defense strategy under different flying zombie numbers is calculated by the formula R 胜率 = N 成功 / N 平行 . As shown in Figure 4 , when there is a tower defense device in an idle state, it can be dispatched for cooperative defense to achieve high-efficiency defense capability. When the number of tower defense devices is roughly equal to the number of flying zombies, the tower defense device can complete the defense target in a short time.

[0098] Large-scale defense example (one):

[0099] Referring to Figure 5, the horizontal coordinate represents the number of flying zombies, and the vertical coordinate represents the winning rate of the tower defense device, the tower defense device in the embodiment is preset with 9, the moving body is the flying zombie, the number threshold is 90, wherein the A type tower defense device is 3, the B type tower defense device is 6, it can be seen that compared with the small scale case, when the number of flying zombies is between 50-100, the winning rate of the defense strategy can be stabilized at about 90%, which is about 4 times the defense number threshold in the above small scale instance, therefore, it can be known that simply increasing the number of tower defense devices can greatly improve the defense winning rate.

[0100] Large-scale defense instance (two):

[0101] Referring to Figure 6 , the horizontal coordinate represents the number of tower defense devices, and the vertical coordinate represents the winning rate of the tower defense device, the moving body in the embodiment is the flying zombie, and the number of flying zombies is 300, it can be seen that the winning rate increases exponentially when the number of tower defense devices is less than 30, and then quickly enters the bottleneck period, at this time, the increase of the number of tower defense devices can only slightly improve the defense winning rate, that is, when the number of flying zombies is fixed, the winning rate of the defense strategy is not a linear relationship with the increase of the number of tower defense devices.

[0102] From the above, it can be known that when facing the two situations of sparse attack and saturation attack, the tower defense confrontation method provided by the application can effectively defend according to the density distribution and emergency degree of the moving body. At the same time, attention should be paid to the relationship between the number of tower defense devices and the number of moving bodies to prevent entering the bottleneck period and thus the winning rate decreases.

[0103] At the same time, referring to Figure 2 , the application provides a tower defense confrontation system for realizing the above-mentioned tower defense confrontation method, which comprises a strategy unit, the strategy unit comprises a collection module and an output module, and a high threat module, a first judgment module, a second judgment module, a reinforcement module and a third judgment module connected with the output end of the collection module respectively, the output ends of the high threat module and the reinforcement module are connected with the input end of the first judgment module, the two output ends of the first judgment module are connected with the input ends of the reinforcement module and the second judgment module respectively, the two output ends of the second judgment module are connected with the input ends of the reinforcement module and the third judgment module respectively, and the two output ends of the third judgment module are connected with the collection module and the output module respectively.

[0104] The collection module and the second judgment module are connected with an external deduction system, and are used for collecting information of the tower defense device and the mobile body in the external deduction environment, and scheduling the tower defense device according to the scheduling information output by the second judgment module; the external deduction system is used for generating a deduction environment at a current time, and deducing a plurality of tower defense devices in the deduction environment at the current time, a plurality of tower defense devices for tower defense confrontation, a plurality of mobile bodies and a target tower body are preset in the external deduction system, the plurality of tower defense devices are randomly arranged at the periphery of the target tower body, the types of the tower defense devices include A-type tower defense devices for point attack and B-type tower defense devices for surface attack, the periphery of the target tower body is divided into N space regions, N is an integer greater than or equal to 1;

[0105] The collection module is used for collecting distribution information of the tower defense device and the mobile body in each space region in the deduction environment at the current time;

[0106] The high-threat module is used for obtaining a threat coefficient D of each space region at the current time according to the obtained distribution information of the mobile body at the current time, and obtaining M high-threat regions at the current time according to the threat coefficient D, M is an integer less than or equal to N;

[0107] The first judgment module is used for judging whether the A-type tower defense device or the B-type tower defense device exists in the M high-threat regions at the current time; if yes, the second judgment module is accessed; if no, the reinforcement module is accessed;

[0108] The second judgment module is used for judging whether the high-threat region at the current time needs reinforcement;

[0109] If yes, the reinforcement module is accessed; if no, the distribution information of the mobile body is obtained, the matching probability of each type of mobile body is obtained according to the A-type tower defense device and the B-type tower defense device, the A-type tower defense device or the B-type tower defense device in the high-threat region at the current time is selected by probability, the target tower body is defended, and the third judgment module is accessed;

[0110] The reinforcement module is used for calculating the number N of tower defense devices needed for reinforcement in the high-threat region at the current time according to the threat coefficient of the high-threat region at the current time and the number of tower defense devices already pointed to the high-threat region at the current time r , and scheduling the tower defense devices in the space region adjacent to the high-threat region at the current time in an idle state, and the first judgment module is accessed;

[0111] The third judgment module is used for judging whether a mobile body enters a defense zone and whether there is a mobile body in all space regions;

[0112] If there is a mobile body entering the defense area or all space regions are not occupied by mobile bodies, it indicates that the tower defense confrontation ends and the output module is accessed; otherwise, according to the next moment of the external deduction system, the deduction environment of the next moment is generated and the collection module is accessed.

[0113] The output module is configured to output the tower defense confrontation result.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not limited thereto. For ordinary skilled persons in the art, the specific technical solutions described in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents, and these modifications or replacements do not change the essence of the corresponding technical solutions beyond the scope of the technical solutions protected by the present application.

Claims

1. A tower defense countermeasure method, characterized in that: Includes the following steps: S1, a pre-set simulation system, which includes multiple tower defense devices, multiple mobile bodies, and a target tower for tower defense confrontation. The tower defense devices and the mobile bodies are of one or more types. Centered on the target tower, its periphery is divided into N spatial regions along the circumference, where N≥1 and is an integer. Each spatial region includes a defense zone and an attack / defense zone. The multiple tower defense devices are located within the defense zone and are arranged along the periphery of the target tower. The defense zone is located inside the attack / defense zone. The multiple mobile bodies are pre-set within the attack / defense zone. The tower defense device has three states: idle, aiming, and attack. The tower defense device has three types: A-type tower defense device for point attack and B-type tower defense device for area attack. Each type of tower defense device is matched with each type of moving body, and a matching probability is preset. S2, Collect the distribution information of tower defense devices and mobile bodies in each spatial region of the simulation system at the current moment; S3, Based on the current distribution information of moving objects, calculate the threat coefficient D for each spatial region at the current moment: ; Where R represents the radius of the defense zone, r represents the distance between the moving body and the target tower, X is a constant representing the distribution factor, and N represents the number of all moving bodies in the spatial area at the current moment; S4. Based on the threat coefficient D of each spatial region at the current moment, sort the N spatial regions in descending order of threat coefficient. Define the first M spatial regions as high threat regions at the current moment, M≤N, and they are integers. S5, determine whether there is a Class A tower defense device or the Class B tower defense device in the M high-threat areas at the current moment; If so, determine whether the high-threat area at the current moment needs reinforcement. If reinforcement is needed, execute S6; if reinforcement is not needed, select either a Class A tower defense device or a Class B tower defense device in the high-threat area at the current moment based on the matching probability of the Class A tower defense device and the Class B tower defense device, defend the target tower, and execute S7. If not, then execute S6; S6, based on the threat coefficient of the high-threat area at the current moment and the number of tower defense devices already pointing to the high-threat area at the current moment, calculate the number of tower defense devices that need to be reinforced in the high-threat area at the current moment. Based on this, the tower defense devices that are idle in the spatial area adjacent to the high-threat area at the current moment are scheduled, and the process returns to S5; Number of tower defense devices The calculation formula is: ; in, This indicates the number of moving objects within all spatial regions at the current moment. This is a constant, representing the scheduling intensity parameter; S7, determine whether a moving object has entered the defense zone, and whether there is a moving object in all spatial areas; if a moving object has entered the defense zone or there is no moving object in all spatial areas, the tower defense confrontation ends and the confrontation result is output; otherwise, generate the simulation environment for the next moment based on the simulation environment parameters and simulation model at the current moment, and return to S2.

2. The tower defense countermeasure method according to claim 1, characterized in that: In S6, the scheduling of idle tower defense devices in the spatial area adjacent to the high-threat area at the current moment includes the following steps: S6.1, Determine the required number of tower defense devices. Whether it is less than the number of tower defense devices that are idle in the space area; If so, based on the obtained distribution information of tower defense devices and mobile bodies, select from the multiple tower defense devices that are idle in the spatial area, so that the number of selected tower defense devices matches the number of tower defense devices requiring reinforcement. The selected tower defense devices are then scheduled; If not, continue to schedule the idle tower defense devices in the next spatial area in order of distance from the target tower from the nearest to the farthest, and execute S6.2; S6.2, return to execute S6.

1.

3. The tower defense countermeasure method according to claim 2, characterized in that: In S2, the distribution information of the tower defense devices includes the number, type, and survival rate of the tower defense devices pointing to each spatial area; the distribution information of the mobile bodies includes the number, type, and speed of the mobile bodies in each spatial area.

4. The tower defense countermeasure method according to claim 3, characterized in that: S6.1 involves selecting from multiple idle tower defense devices within the spatial area, including the following steps: S6.1.1 Based on the distribution information of the mobile bodies obtained, and the matching probability of each type of mobile body and the survival rate of each idle tower defense device in the spatial area, the scheduling probability of each idle tower defense device is calculated. S6.1.2, based on the obtained scheduling probabilities of each tower defense device, sort all idle tower defense devices in descending order of scheduling probability, and then... Each tower defense device is selected as a tower defense device and then scheduled.

5. A tower defense countermeasure method according to claim 4, characterized in that: S5 involves defending the target tower, including the following steps: S5.1, Based on the obtained distribution information of the mobile bodies, make the Class A tower defense device in the high-threat area at the current moment aim at the mobile body closest to it in the current area, or make the Class B tower defense device in the high-threat area at the current moment aim at the area with the highest spatial density of mobile bodies in the current area, so as to obtain the A aiming association or B aiming association at the current moment. S5.2, the simulation system, based on the current A aiming association or B aiming association, causes the selected A-type tower defense device or B-type tower defense device to sequentially connect to the aiming state and the attack state; S5.3, determine whether the current aiming association is A aiming association or B aiming association; if it is A aiming association, then execute S5.4; if it is B aiming association, then execute S5.

5. S5.4 Determine whether a moving object is shot down after the Class A tower defense device has been aimed; If yes, then execute S5.1; if no, then re-enter the aiming state and attack state in sequence. S5.5, Determine whether the Class B tower defense device has shot down more than half of the moving objects in the current space area after aiming; If yes, then put it into an idle state; if no, then put it back into aiming state and attack state in sequence.

6. A tower defense countermeasure system, used to implement the tower defense countermeasure method according to any one of claims 1-5, characterized in that: It includes a strategy unit, which includes a data acquisition module and an output module, as well as a high-threat module, a first judgment module, a second judgment module, a reinforcement module and a third judgment module, which are respectively connected to the output of the data acquisition module. The output terminals of the high-threat module and the reinforcement module are both connected to the input terminal of the first judgment module. The two output terminals of the first judgment module are respectively connected to the input terminals of the reinforcement module and the second judgment module. The two output terminals of the second judgment module are respectively connected to the input terminals of the reinforcement module and the third judgment module. The two output terminals of the third judgment module are respectively connected to the acquisition module and the output module. The acquisition module and the second judgment module are used to connect to an external simulation system for data exchange. The external simulation system is used to generate the simulation environment at the current moment and to perform simulations on multiple tower defense devices in the simulation environment at the current moment. The external simulation system is pre-set with multiple tower defense devices, multiple mobile bodies, and target towers for tower defense confrontation. Multiple tower defense devices are randomly pre-set around the target tower. The types of tower defense devices include Class A tower defense devices for point attacks and Class B tower defense devices for area attacks. The periphery of the target tower is divided into N spatial regions, where N≥1 and is an integer. The acquisition module is connected to multiple tower defense devices and multiple mobile bodies for data exchange. The acquisition module is used to acquire the distribution information of tower defense devices and mobile bodies in each spatial area of ​​the simulation environment at the current moment; The high-threat module is used to obtain the threat coefficient D of each spatial region at the current moment based on the distribution information of the moving body at the current moment, and thereby obtain M high-threat regions at the current moment, where M≤N and are integers; The first judgment module is used to determine whether there is a Class A tower defense device or the Class B tower defense device in the M high-threat areas at the current time; if yes, it connects to the second judgment module; if no, it connects to the reinforcement module. The second judgment module is used to determine whether the high-threat area at the current moment needs reinforcement; if so, the reinforcement module is connected. If not, based on the matching probability of the Class A tower defense device and the Class B tower defense device, the Class A tower defense device or the Class B tower defense device in the high-threat area at the current moment is selected by probability to defend the target tower and connected to the third judgment module. The reinforcement module is used to calculate the number of tower defense devices that need to be reinforced in the high-threat area at the current moment, based on the threat coefficient of the high-threat area at the current moment and the number of tower defense devices that have been directed to the high-threat area at the current moment. Based on this, the tower defense devices that are idle in the spatial area adjacent to the high-threat area at the current moment are scheduled and connected to the first judgment module. The third judgment module is used to determine whether a moving object has entered the defense zone and whether there is a moving object in all spatial areas; if a moving object has entered the defense zone or there is no moving object in all spatial areas, it indicates that the tower defense confrontation has ended and is connected to the output module; otherwise, based on the external simulation system of the next moment, the simulation environment of the next moment is generated and connected to the acquisition module. The output module is used to output the tower defense confrontation results.

Citation Information

Patent Citations

  • Combat resource scheduling method for attacking target

    CN111260229A

  • Intelligent confrontation target control method for defending close-range shooting behavior based on position

    CN115031586A