A method and device for generating a game scheme

By generating a method for generating game schemes, constraints are generated based on initial task objectives and basic information, and resource allocation and path planning are calculated. This solves the problems of high cost and high overhead of game data in existing technologies, and realizes low-cost generation of samples suitable for games or simulators.

CN114997053BActive Publication Date: 2026-03-24TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing technologies for acquiring game data are costly, expensive, and lack data diversity, making it difficult to generate a sufficiently rich and large number of samples at low cost.

Method used

The method for generating game solutions includes obtaining the initial task objective, generating constraints based on basic information, calculating resource allocation schemes and planning paths, and generating the planning path and resource allocation scheme as the target game solution.

Benefits of technology

It achieves low-cost generation of game data, reduces the overhead in the generation process, and the generated samples are suitable for games or simulators without relying on the original data for training or multiple interactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114997053B_ABST
    Figure CN114997053B_ABST
Patent Text Reader

Abstract

The application provides a playing scheme generation method and device, the method comprises the following steps: obtaining an initial task target; generating a constraint condition based on the initial task target, pre-stored first basic information of an attacking party and second basic information of a defending party; calculating a resource allocation scheme when the attacking party attacks the defending party based on the constraint condition; the resource allocation scheme at least includes initial positions of units in the attacking party; selecting an attack point as an end position randomly in a preset attack range with the initial position as a start position, and generating a planning path according to the start position and the end position; taking the resource allocation scheme and the planning path as a target playing scheme. The application effectively reduces the overhead of generating playing data samples of an instant strategy type game or a simulator, and can be used to generate samples required for reinforcement learning training based on the environment.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a playing scheme generation method and device. BACKGROUND

[0002] In recent years, the computing power of computers has rapidly improved, which has removed a major obstacle for the training of neural networks (DNN), enabling the rapid development of deep learning technology. For example, ResNet, Inception, YOLO model related to image processing, LSTM, BERT, GPT2.0 model related to natural language processing, and other models have shown unimaginable capabilities in various fields, but they often contain a large number of parameters. In recent years, some leading deep learning models have been proposed, such as the ViT-G / 14 image processing model with 1.5 billion parameters and the GPT-3 language model with 175 billion parameters. These huge models will require a large amount of data samples in the training process to prevent overfitting, but generating a large number of samples or labeling a large number of unlabeled samples is a relatively high-cost task. Therefore, how to obtain sufficient and abundant samples at low cost, or how to use fewer data samples for small sample learning, is a major challenge in many deep learning application scenarios. At the same time, in the field of reinforcement learning, multiple models are often combined to complete intelligent decision-making tasks, which undoubtedly requires a larger number of data samples. For example, the King's Glory AI collects sample data from hundreds of millions of user matches, and the alpha star collects a large number of game sample data from professional players.

[0003] In the training process of reinforcement learning, training samples are generally generated by collecting historical data of online user matches or by agent interaction with the environment or agent playing. For the former, only well-known network platforms with numerous users can achieve this, which is not suitable for most intelligent decision-making scenarios. For the latter, although it is a general method, the interaction overhead is relatively high in the entire training process. In addition, considering various reinforcement learning algorithms, the generated sample limitations are not high, and some algorithms require many ordinary samples to train a fast decision-making network before training, such as in the entire training process of Alpha GO, a fast move network was trained using a large number of ordinary data in the early stage. Therefore, how to quickly and low-cost generate playing data becomes the focus of the present application. SUMMARY

[0004] The present application provides a playing scheme generation method and device to solve the defects of high cost, high overhead, and poor data diversity in obtaining playing data in the prior art, and to reduce the cost of generating playing data and the overhead in the generation process.

[0005] The application provides a method for generating a game scheme, which comprises the following steps:

[0006] obtaining an initial task target;

[0007] generating a constraint condition based on the initial task target, pre-stored first basic information of an attacking party and second basic information of a defending party;

[0008] calculating a resource allocation scheme of the attacking party attacking the defending party based on the constraint condition; the resource allocation scheme at least comprises initial positions of units in the attacking party;

[0009] randomly selecting an attack point as an end position within a preset attack range with the initial position as a start position, and generating a planning path according to the start position and the end position;

[0010] taking the resource allocation scheme and the planning path as a target game scheme.

[0011] According to the method for generating a game scheme, the first basic information comprises weapon types corresponding to units of the attacking party, damage values of the corresponding weapon types, ammunition loading information of the corresponding weapon types and loading capacities of loading platforms of the corresponding weapon types; and / or,

[0012] the second basic information comprises types of units of the defending party and blood volume information of the units of the defending party; and / or,

[0013] the initial task target comprises blood volume damage degrees of the units of the defending party.

[0014] According to the method for generating a game scheme, the constraint condition comprises at least one of the following:

[0015] a constraint between ammunition loading capacities of the units of the attacking party corresponding to the weapon types, weapon quantities and blood volume damage degrees of the units of the defending party;

[0016] a constraint between the weapon types of the units of the attacking party and the ammunition loading capacities;

[0017] a constraint between the weapon types of the units of the attacking party and loading capacities of loading platforms;

[0018] non-negative value constraints and integer constraints of the weapon quantities, the ammunition loading capacities and the loading platform quantities.

[0019] According to the method for generating a game scheme, the resource allocation scheme of the attacking party attacking the defending party is calculated based on the constraint condition, and the calculation specifically comprises the following steps:

[0020] a target function is set for optimizing the number of weapons of the attack side and the number of loading platforms;

[0021] Based on the constraint condition and the target function, a total modeling equation is established;

[0022] According to the total modeling equation, the resource allocation scheme is solved.

[0023] According to the starting point position and the end point position, a planning path is generated, which includes the following steps:

[0024] The shortest path from the starting point position to the end point position of each unit of the attack side is calculated;

[0025] It is judged whether each unit of the attack side can reach the end point position along the shortest path within a preset time length.

[0026] According to the present application, when it is judged that each unit of the attack side can reach the end point position along the shortest path within the preset time length, the following steps are executed:

[0027] Sampling: sampling a detection point in a preset unit time step feasible region centered on the starting point position of each unit of the attack side;

[0028] Time calculation: calculating the shortest path between the starting point position and the detection point and the shortest path between the detection point and the end point position, and further calculating the time cost of each unit of the attack side from the starting point position to the end point position via the detection point;

[0029] Judgment: when the time cost does not exceed the preset time length, the shortest path between the starting point position and the detection point and the shortest path between the detection point and the end point position are taken as the planning path, and the preset time length is reduced by the time cost of the shortest path between the detection point and the end point position as a new preset time length; otherwise, the sampling, time calculation and judgment steps are repeated.

[0030] According to the present application, the resource allocation scheme and the planning path are taken as the target game scheme, which specifically includes the following steps:

[0031] Based on the planning path and the preset time length, a segmented instruction for moving each unit of the attack side is generated;

[0032] The ammunition delivery amount corresponding relationship of each unit of the attack side to the units of the defense side to be attacked is added in the segmented instruction;

[0033] Output the final segment instruction as a target game scheme.

[0034] The application further provides a game scheme generation device, which comprises:

[0035] A target acquisition module is configured to acquire an initial task target.

[0036] A constraint generation module is configured to generate a constraint condition based on the initial task target, pre-stored first basic information of an attacking party and second basic information of a defending party.

[0037] A resource allocation module is configured to calculate a resource allocation scheme of the attacking party attacking the defending party based on the constraint condition, wherein the resource allocation scheme at least comprises initial positions of units in the attacking party.

[0038] A path planning module is configured to randomly select an attack point as an end point position in a preset attack range with the initial position as a start point position, and generate a planning path according to the start point position and the end point position.

[0039] A scheme generation module is configured to take the resource allocation scheme and the planning path as a target game scheme.

[0040] The application further provides an electronic device comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the game scheme generation method according to any one of the above-mentioned methods when executing the program.

[0041] The application further provides a non-transitory computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the game scheme generation method according to any one of the above-mentioned methods.

[0042] The application further provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the game scheme generation method according to any one of the above-mentioned methods.

[0043] The game scheme generation method and device provided by the application complete the generation of game scheme samples through two main steps of resource allocation and path planning. Compared with the prior art, the generation process of the samples is based on rules, so even if there is no initial data, the method can still be used to generate data samples suitable for games or simulators. Meanwhile, the generation process of the samples does not need to train other models for auxiliary sample generation according to original data, nor does it need to generate through multiple interactions between an agent and an environment, so the cost is small. BRIEF DESCRIPTION OF DRAWINGS

[0044] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those of ordinary skill in the art without any creative effort.

[0045] Figure 1 is one of the flowcharts of the method for generating a game scheme provided by the present application;

[0046] Figure 2 is another flowchart of the method for generating a game scheme provided by the present application;

[0047] Figure 3 is a third flowchart of the method for generating a game scheme provided by the present application;

[0048] Figure 4 is a fourth flowchart of the method for generating a game scheme provided by the present application;

[0049] Figure 5 is a fifth flowchart of the method for generating a game scheme provided by the present application;

[0050] Figure 6 is a structural schematic diagram of the device for generating a game scheme provided by the present application;

[0051] Figure 7 is a structural schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION

[0052] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those of ordinary skill in the art without any creative effort.

[0053] The method for generating a game scheme provided by the present application will be described below. Figures 1-5

[0054] Figure 1 is one of the flowcharts of the method for generating a game scheme provided by the present application;

[0055] As shown in the accompanying drawings, Figure 1 the method for generating a game scheme provided by the present application can be used in a simulator, and the method comprises the following steps:

[0056] ​Step 110, obtaining an initial task target. In the present application, the initial task target refers to the task target of the attacker attacking the defender.

[0057] Step 120, generating a constraint condition based on the initial task target, the pre-stored first basic information of the attacker and the second basic information of the defender.

[0058] Specifically, the first basic information includes the weapon type corresponding to each unit of the attacker, the damage value of the corresponding weapon type, the ammunition loading information of the corresponding weapon type, and the loading capacity of the corresponding weapon type. The second basic information includes the type of each unit of the defender and the blood volume information c of each unit of the defender. Wherein, each unit of the attacker and each unit of the defender can be a sea, land and air combat platform, such as an airplane, a tank, a ship, etc.

[0059] The initial task target includes the damage degree of the blood volume of each unit of the defender, and the damage degree can be represented by the damage percentage e of the blood volume of each unit of the defender.

[0060] In some embodiments, based on the initial task target and the basic information of the attacker and the attacked defender, the following constraint conditions are generated:

[0061] The constraint between the ammunition loading capacity of the weapon type corresponding to each unit of the attacker, the number of weapons and the damage degree of the target blood volume of each unit of the defender. The constraint between the weapon type of each unit of the attacker and the ammunition loading capacity. The constraint between the weapon type of each unit of the attacker and the loading capacity of the loading platform. The non-negative value constraint and the integer constraint of the number of weapons, the ammunition loading capacity and the number of loading platforms.

[0062] Specifically, the constraints between the number of weapons attacking a certain unit of the defender and the target damage degree, the number of weapons of type T1 to T n and the platform ammunition loading capacity of the corresponding type of weapons, the number of aircraft and the aircraft carrier aircraft capacity K, the non-negative value constraint and the integer constraint of the number value are generated in turn.

[0063] 1) The constraint between the number of weapons attacking a certain unit of the defender and the target damage degree. The corresponding constraint should be generated for all units of the defender, and for each unit, the following should be satisfied:

[0064]

[0065] Wherein a(T i ), p(T i ) are the damage value and hit rate of the weapon of type T i , n(T i j is the number of weapons of type T i used to attack the unit j of the defender, and ej c represents the percentage of health damage required to inflict on the defending unit j. j This represents the maximum total health of the defending unit j.

[0066] 2) The constraint between the number of weapons and the loading platforms must satisfy the requirement that the number of loading platforms for each type of weapon must be greater than or equal to the number of weapons of that type used:

[0067]

[0068] Where n(T) i p ) is the load type T i The number of weapon platforms, L(T) i ) is the load type T i The payload capacity of the weapon platform.

[0069] 3) Constraints between the number of aircraft and the total carrier-based aircraft capacity K: Since the number of aircraft carriers is generally limited and cannot be arbitrarily allocated, it is assumed that the total carrier-based aircraft capacity is fixed at K. Therefore, K should be greater than or equal to the number of all aircraft.

[0070] n(P air )≤K,

[0071] Where n(P) air () represents the number of aircraft.

[0072] 4) Non-negativity and integer constraints on quantity values: All variables relating to quantity in the solution must be non-negative integers.

[0073]

[0074] Step 130: Based on the constraints, calculate the resource allocation scheme when the attacker attacks the defender; the resource allocation scheme shall include at least the initial position of each unit in the attacker.

[0075] like Figure 2 As shown, step 130, calculating the attacker's resource allocation scheme specifically includes the following steps:

[0076] Step 210: Set the objective function, which optimizes the number of weapons and platforms used by the attacker. Specifically, to complete the mission using the fewest possible number of weapons and platforms, the objective function needs to consider the sum of two variables:

[0077] minF(n(T i j ),n(T i p ))=min∑ ijn(T i j )+∑ i n(T i p )。

[0078] Step 220, based on the constraint condition and the objective function, the total modeling equation is established.

[0079] Specifically, the objective function combines the constraint condition in step 120, and the following total modeling equation can be listed:

[0080]

[0081] Step 230, according to the total modeling equation, the generated resource allocation scheme is solved.

[0082] The GLPK_MI solver in the CVXOPT optimization library is used to solve the total modeling equation to generate different resource allocation and platform programming schemes.

[0083] More specifically, since the objective function and the constraint condition are linear functions, according to the optimization theory, the problem is a convex problem, and the related algorithm in convex optimization can be used to solve it. At the same time, the decision variable is a non-negative integer, so the problem is also an integer programming problem. Considering the above, by investigating the existing mature optimization library, it is finally decided to use the GLPK_MI solver in the CVXOPT optimization library to solve the modeling equation. In addition, since the equation may have non-unique solutions, when calling the solver multiple times, different solution schemes can be generated, which also coincides with the goal of generating different samples.

[0084] Step 140, taking the initial position as the starting position, randomly selecting an attack point as the ending position within the preset attack range, and generating a planning path according to the starting position and the ending position.

[0085] Step 150, taking the resource allocation scheme and the planning path as the target game scheme.

[0086] In step 140, the resource allocation and platform programming scheme solved in 130 is sent to the path planning module. More specifically, the allocation scheme of weapons and platforms is represented in a double-layer dictionary format, as follows:

[0087]

[0088] Where P i represents the ID of the attacking unit i, is the ID of the defending unit j, n ij represents the platform with the attacking ID P i to the defending unit with the ID This specifies the number of attacks to be performed. Therefore, this two-layer dictionary can precisely describe how many attacks each unit of the attacking side needs to perform against each unit of the defending side.

[0089] Choose one of the resource allocation schemes and randomly generate a reasonable final attack point location for each unit of the attacking side. More specifically, this attack point is the point that the attacking unit must first reach in the actual game before launching an attack, and this point must ensure that when the attacking unit arrives, its target is within its attack range. The position of the defending unit at the time of attack can be inferred from its initial position and flight path, or derived from given global scenario information.

[0090] Furthermore, such as Figure 3 As shown, in step 140, generating the planned path based on the starting and ending positions includes the following steps:

[0091] Step 310: Calculate the shortest path between the starting point and the ending point for each unit of the attacking side;

[0092] Step 320: Determine whether each unit of the attacking party can reach the destination along the shortest path within the preset time limit.

[0093] like Figure 4 As shown, if it is determined that each unit of the attacking side can reach the destination along the shortest path within the preset time period, the following steps are executed:

[0094] Step 410, Sampling: Using the starting position of each unit of the attacker as the center, sample detection points within the preset feasible area of ​​unit time step;

[0095] Step 420, Time Calculation: Calculate the shortest path between the starting point and the detection point and the shortest path between the detection point and the ending point, and then calculate the time it takes for each unit of the attacking side to reach the ending point from the starting point through the detection point.

[0096] Step 430: Judgment: If the judgment time does not exceed the preset time, the shortest path between the starting position and the detection point and the shortest path between the detection point and the end position are used as the planned path, and the preset time is subtracted from the time spent on the shortest path from the detection point to the end position as the new preset time; otherwise, repeat the sampling, time calculation and judgment steps.

[0097] In some implementations, such as Figure 5 As shown, path planning can specifically be:

[0098] Using the initial position of the attacking unit as the starting point and the attack point position generated in step 130 as the ending point, a random obstacle avoidance path is planned between the starting point and the ending point. This path must ensure that the attacking unit travels along this path at maximum speed, and the shortest time taken will not exceed a given time; otherwise, it may delay the scheduled time for the entire team to attack simultaneously. The path planning is obtained through step-by-step sampling, and the steps are as follows:

[0099] 1) Determine the size of the time step for the distributed sampling and execute step 2). The time step should be set appropriately, because if the time step is too small, the sampled path may jitter in a local range.

[0100] 2) Determine if the current position can directly reach the destination within one time step using the shortest path. Since there may be obstacles on the map, the shortest path can be calculated using the A* algorithm. If the above requirement is met, add this shortest path to the overall planning scheme and end the path planning. Otherwise, proceed to step 3).

[0101] 3) Based on the current location, randomly sample a detection point (X) within the reachable range of one time step. r ,Y r Solve for the problem starting from the current position (X). c ,Y c ) Reaching the sampling point (X) r ,Y r Find the shortest path l1 and its length s1 between sampling points (X). r ,Y r ) and endpoint (X) end ,Y end Find the shortest path l2 and its length s2 between the two segments. Calculate whether the attacking unit can cover both paths at its highest speed within the remaining time, i.e., satisfy the following condition:

[0102]

[0103] If the above conditions are met, then path l1 will be added to the overall path planning scheme, and the remaining time t will be... surplus Subtract the shortest time t1 required to cover path l1 from itself, and then execute step 2). Otherwise, repeat step 3).

[0104] in:

[0105]

[0106] And V max This is the maximum speed of this unit.

[0107] In step 150, the resource allocation scheme and the planned path are taken as the target game strategy, which specifically includes the following steps:

[0108] Based on the planned path and the preset time length, segmented instructions for the units of the attacking side to move are generated;

[0109] The relationship between the ammunition supply amount of the units of the attacking side and the units of the defending side to be attacked is added in the segmented instructions;

[0110] The final segmented instructions are output as the target game scheme.

[0111] In some embodiments, according to the attack path of each unit of the attacking side generated in step (7) and the given total time, segmented instructions that meet the game or simulator when each unit sails along the corresponding path are generated. The instructions for each unit to supply weapons are added at the end of the instruction set. In this way, the generation of complete control instructions during the selection of weapons and units and the game process of each unit is realized, and the generation of complete data samples is completed. Specifically, the length S of the total path is first calculated, and then the speed V that should be maintained during sailing is calculated according to the given total time T:

[0112]

[0113] When the speed V is in the controllable range of the speed of the unit itself, the unit time slice sailing distance S obtained by multiplying the speed V by the length of the control instruction unit time slice is unit the length, S is divided into several segments, and the end point of each segment is the destination position of the movement instruction in the unit time slice. If the minimum speed of the unit itself is also greater than the speed V, it indicates that for this unit, even if the minimum speed is used to cover the path, the given total time is sufficient. Then only the total time T2 required to cover the path at the minimum speed needs to be calculated, and the time that the unit needs to wait in place after the game starts is calculated by T-T2. After the waiting time is passed, the instruction division is consistent with the above case.

[0114] At the same time, if the resource allocation and path planning algorithm is executed multiple times, multiple different data samples can be generated.

[0115] One complete sample contains the task instructions of each unit of the attacking side during a game process. The outermost list contains the instructions of each unit of the attacking side at all times, the second list contains the instructions of each unit of the attacking side at a single time, and the innermost list represents the instruction information of a unit of the attacking side in a single time slice.

[0116] For example:

[0117] ["0010", 1, [44, 50], 1, "0100"]

[0118] For a single instruction, the meanings of the fields are as follows:

[0119] Attacker unit id Time step Location Action type Action target "0010" 3 [44,53] 0 "1010"

[0120] Wherein the action type contains 1 (movement) and 0 (attack), because the attack action needs to have an attack target, so when the action is movement, the action target is automatically completed as "0100". Then for the above instruction, the unit representing the attack side ID "0010" performs an attack action at time 3, position [44, 53], and the attack target is the ship with the defense side ID "1010".

[0121] Compared with the prior art, the present application has the following advantages:

[0122] 1. No original data dependency. In the process of generating the game scheme sample of the present application, it is rule-based, so even if there is no data initially, this method can still be used to generate data samples suitable for games or simulators.

[0123] 2. Fast speed and small overhead. In the process of generating the game scheme sample of the present application, it does not need to train other models for auxiliary sample generation according to the original data, nor does it need to generate through multiple interactions between the agent and the environment, so the overhead is small.

[0124] The technical effects of the present application can be further illustrated by the following simulation experiment:

[0125] I. Simulation conditions:

[0126] Hardware environment: CPU AMD athlon II X4640, 3.0GHz, 4GB RAM;

[0127] Software environment: Windows 10, Python3.7, real-time strategy game platform;

[0128] II. Simulation content:

[0129] Simulation 1: If the initial intended task target is to attack three ships of the defense side and cause heavy damage to the three ships, then generate the resource allocation and unit allocation scheme for the initial task target.

[0130] Simulation 2: If one of the generated resource allocation schemes is selected and path planning is performed, then multiple paths can be generated, and one of the paths is printed on the environment map.

[0131] Simulation 3: According to the intended task in simulation 1, after generating the resource allocation and unit formation scheme, the path of each unit is planned, and the path is divided according to each time slice, and the control instruction of each time slice can be obtained. In one embodiment of the present application, the time required to obtain the final game scheme sample is only 0.33 seconds.

[0132] To verify the feasibility of the sample, the sample instruction generated in the environment is deduced.

[0133] The following describes a game scheme generation device provided by the application, which can be correspondingly referred to with the game scheme generation method described above.

[0134] As shown in the figure, the game scheme generation device provided by the embodiment of the application includes the following modules: a target acquisition module 610, a constraint generation module 620, a resource allocation module 630, a path planning module 640, and a scheme generation module 650. Figure 6

[0135] Specifically, the target acquisition module 610 is configured to acquire an initial task target.

[0136] The resource allocation module 630 is configured to calculate a resource allocation scheme of the attacking party attacking the defending party based on the constraint condition, and the resource allocation scheme at least includes initial positions of units in the attacking party.The path planning module 640 is configured to randomly select an attack point as an end point position in a preset attack range with the initial position as a start point position, and generate a planning path according to the start point position and the end point position. The scheme generation module 650 is configured to take the resource allocation scheme and the planning path as a target game scheme.

[0137] The application discloses a game scheme generation method and device based on rules to generate instant strategy games, and mainly solves the problem of high data sample generation cost in the prior art. The implementation steps are as follows: (1) acquiring an initial task target; (2) determining resource allocation and platform formation scheme generation constraints; (3) setting a target function, solving a modeling equation by using an optimization library, and generating a scheme; (4) passing the resource allocation and platform formation scheme to a path planning module, determining a start point and an end point of path planning, and performing path planning; and (5) generating a control instruction and completing overall data sample generation. The application effectively reduces the data sample generation cost of instant strategy games or simulators, and can be used to generate samples required for reinforcement learning training based on the environment.

[0138] Figure 7 An example of an entity structure diagram of an electronic device is shown in FIG. 1. Figure 7As shown, the electronic device can include a processor 710, a communications interface 720, a memory 730, and a communications bus 740, wherein the processor 710, the communications interface 720, and the memory 730 complete mutual communication through the communications bus 740. The processor 710 can invoke a logical instruction in the memory 730 to execute a method for generating a game scheme, which includes the following steps: obtaining an initial task target; generating a constraint condition based on the initial task target, pre-stored first basic information of an attacking party, and second basic information of a defending party; calculating a resource allocation scheme when the attacking party attacks the defending party based on the constraint condition; the resource allocation scheme at least includes initial positions of units in the attacking party; selecting an attack point as an end position randomly in a preset attack range from the initial position as a starting position, and generating a planning path according to the starting position and the end position; and taking the resource allocation scheme and the planning path as a target game scheme.

[0139] In addition, the logical instruction in the memory 730 described above can be implemented in the form of a software functional unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or parts of the present application that essentially contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0140] On the other hand, the present application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute a method for generating a game scheme, which includes the following steps: obtaining an initial task target; generating a constraint condition based on the initial task target, pre-stored first basic information of an attacking party, and second basic information of a defending party; calculating a resource allocation scheme when the attacking party attacks the defending party based on the constraint condition; the resource allocation scheme at least includes initial positions of units in the attacking party; selecting an attack point as an end position randomly in a preset attack range from the initial position as a starting position, and generating a planning path according to the starting position and the end position; and taking the resource allocation scheme and the planning path as a target game scheme.

[0141] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for generating a game scheme as provided by any of the above methods, the method comprising the steps of: obtaining an initial task target; generating a constraint condition based on the initial task target, pre-stored first basic information of an attacking party and second basic information of a defending party; calculating a resource allocation scheme for the attacking party attacking the defending party based on the constraint condition; the resource allocation scheme at least including initial positions of units in the attacking party; selecting an attack point as a terminal position randomly in a preset attack range with the initial position as a starting position, and generating a planning path according to the starting position and the terminal position; and taking the resource allocation scheme and the planning path as a target game scheme.

[0142] The device embodiments described above are merely illustrative, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0143] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software plus necessary universal hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0144] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating game solutions, characterized in that, The method includes: Obtain the initial task objective; Based on the initial mission objective, the pre-stored first basic information of the attacker, and the second basic information of the defender, constraints are generated. Based on the constraints, the resource allocation scheme for the attacker attacking the defender is calculated, including: setting an objective function to optimize the number of weapons and loading platforms of the attacker; establishing a general modeling equation based on the constraints and the objective function; and solving the general modeling equation to generate the resource allocation scheme; the resource allocation scheme includes at least the initial positions of each unit of the attacker. Starting from the initial position, an attack point is randomly selected within a preset attack range as the endpoint position, and a planned path is generated based on the starting position and the endpoint position. The resource allocation scheme and the planned path are used as the target game strategy; The first basic information includes the weapon type corresponding to each unit of the attacking party, the damage value of the corresponding weapon type, the ammunition loading information of the corresponding weapon type, and the loading capacity of the loading platform of the corresponding weapon type; and / or, The second basic information includes the type of each defending unit and the health information of each defending unit; and / or, The initial mission objective includes inflicting damage to the health of each defending unit. The constraints include at least one of the following: The constraint between the ammunition load and weapon quantity of each attacking unit for the corresponding weapon type and the degree of health damage of each defending target; The constraints between the weapon types and ammunition loads of each attacking unit; The constraints between the weapon types of each attacking unit and the loading capacity of the loading platform; The number of weapons, the amount of ammunition loaded, and the number of loading platforms are subject to non-negative and integer constraints.

2. The method for generating game schemes according to claim 1, characterized in that, Based on the aforementioned constraints, the resource allocation scheme for the attacker attacking the defender is calculated, specifically including the following steps: The resource allocation scheme is generated by solving the overall modeling equation as described below: in, , For type Weapon damage and hit rate, For use in attacking defensive units Type used The number of weapons For the need to defend the unit The percentage of blood loss caused. For the defensive unit Maximum total health; For load type The number of weapon platforms, For load type The payload capacity of the weapon platform; The number of aircraft.

3. The method for generating game schemes according to claim 1, characterized in that, The step of generating a planned path based on the starting point and the ending point includes the following steps: Calculate the shortest path between the starting point and the ending point for each unit of the attacking side; Determine whether each unit of the attacking party can reach the destination along the shortest path within a preset time period.

4. The method for generating game schemes according to claim 3, characterized in that, If it is determined that each unit of the attacking party can reach the destination along the shortest path within the preset time period, the following steps are performed: Sampling: Taking the starting position of each unit of the attacker as the center, within the feasible area of ​​a preset unit time step, sampling detection points are performed; Time calculation: Calculate the shortest path between the starting position and the detection point and the shortest path between the detection point and the ending position, and then calculate the time spent by each unit of the attacking party from the starting position to the ending position via the detection point; Judgment: If the time spent does not exceed the preset duration, the shortest path between the starting point and the detection point and the shortest path between the detection point and the ending point are used as the planned path, and the preset duration is subtracted from the time spent on the shortest path from the detection point to the ending point as the new preset duration. Otherwise, repeat the sampling, time calculation, and judgment steps.

5. The method for generating game schemes according to claim 3 or 4, characterized in that, The step of using the resource allocation scheme and the planned path as the target game strategy specifically includes the following steps: Based on the planned path and the preset duration, segmented instructions are generated for each unit of the attacking party to move. Add the corresponding relationship of the amount of ammunition delivered by each unit of the attacking side to each unit of the defending side that needs to be attacked to the segmented instruction; The final segmentation instructions are output as the target game solution.

6. A game scheme generation device, characterized in that, The device includes: The target acquisition module is used to acquire the initial task target; The constraint generation module is used to generate constraint conditions based on the initial task objective, the pre-stored first basic information of the attacker, and the second basic information of the defender; The resource allocation module is used to calculate the resource allocation scheme when the attacker attacks the defender based on the constraints, including: setting an objective function, which is used to optimize the number of weapons and loading platforms of the attacker; establishing a total modeling equation based on the constraints and the objective function; solving the total modeling equation to generate the resource allocation scheme; the resource allocation scheme includes at least the initial positions of each unit in the attacker. The path planning module is used to randomly select an attack point as the endpoint within a preset attack range, starting from the initial position, and generate a planned path based on the starting position and the endpoint. The scheme generation module is used to take the resource allocation scheme and the planned path as the target game scheme; The first basic information includes the weapon type corresponding to each unit of the attacking party, the damage value of the corresponding weapon type, the ammunition loading information of the corresponding weapon type, and the loading capacity of the loading platform of the corresponding weapon type; and / or, The second basic information includes the type of each defending unit and the health information of each defending unit; and / or, The initial mission objective includes inflicting damage to the health of each defending unit. The constraints include at least one of the following: The constraint between the ammunition load and weapon quantity of each attacking unit for the corresponding weapon type and the degree of health damage of each defending target; The constraints between the weapon types and ammunition loads of each attacking unit; The constraints between the weapon types of each attacking unit and the loading capacity of the loading platform; The number of weapons, the amount of ammunition loaded, and the number of loading platforms are subject to non-negative and integer constraints.

7. An electronic 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 program, it implements the game scheme generation method as described in any one of claims 1 to 5.

8. A non-transitory 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 game scheme generation method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Human attacker cooperation behavior modeling and corresponding defense strategy developing method

    CN108053068A

  • Path planning method and system based on deep reinforcement learning

    CN114415663A