Dependence implementation system and method of game strategy
Technical Field
The invention relates to a system and a method for realizing dependence of game strategies, belonging to the field of computer games.
Background
In general strategy games, the decision evaluation system is usually implemented by hard-coded algorithms.
That is, each decision evaluation algorithm is implemented by a piece of code or a class, and the program opens some parameters therein to adjust some values for the plan to a certain degree of changeability, but cannot change the program logic therein. But game item systems are characterized by volatility, similarity and repeatability. That is, a large number of algorithms that are substantially similar but have different specific logics are required, and the planned demands are constantly changing and adjusting, which is determined by the characteristics of the entertainment software such as games that focus on the user experience.
Therefore, the hard-coded conventional system implementation method has the following disadvantages:
1. the workload of the program implementation algorithm is very large, a large number of similar program functions need to be repeatedly developed and adjusted, and a large number of beneficial designs are usually abandoned in practical work due to too large workload, so that the overall quality of the game is influenced.
2. The project does not have reusable algorithm functions with small granularity, the overall development cost is too high, the pressure of the project progress is often forced to be only one relatively rough resource distribution system, and the game experience is seriously influenced.
Disclosure of Invention
Aiming at the defects of the prior art, the technical scheme of the invention discloses a system and a method for realizing the dependence of a game strategy, so as to achieve the purposes of greatly shortening the development period of a strategy game, enhancing the maintainability and reusability of codes, enhancing the experience and performance of the game and facilitating the good division of labor and cooperation of personnel of various positions.
The technical scheme of the invention comprises a dependence implementation system of game strategy, which is characterized in that the system comprises: the dependency establishing module is used for acquiring data nodes with dependency relationship in a data structure of the game program and establishing a corresponding association diagram; the dependency traversal module is used for performing deep traversal on the association graph according to a traversal command issued by a game player or artificial intelligence, acquiring a step list of expanding new data nodes, and selecting an optimal step for returning back; and the dependency analysis module is used for establishing a corresponding player dependency graph based on the data nodes obtained by artificial intelligence analysis and the dependency relationship corresponding to the data nodes, searching the fragile data nodes according to traversal of the player dependency graph, and customizing a corresponding strategy according to the fragile nodes.
According to the dependency implementation system of the game strategy, the dependency establishment module further comprises: the creation dependency submodule is used for representing a dependency relationship which needs one or more data nodes for creating a new data node by using a creation dependency graph and recording the dependency type and the dependency object of each data node; and the support dependency submodule is used for representing a dependency relationship which needs one or more data nodes to provide data support when the existing data nodes are subjected to event activity by using a support dependency graph, and recording the dependency type and the dependency object of each data node.
According to the dependency implementation system of the game strategy, the data node further comprises: and recording a plurality of data types for counting the data of all the child data nodes.
According to the dependency implementation system of the game strategy, the dependency traversal module further comprises: the method is used for analyzing one or more node data analysis requests and a target strategy included in the traversal instruction, further acquiring the incidence relation and the data type recorded by the corresponding one or more data nodes, performing deep traversal on the dependency graph according to the target strategy, acquiring a step list reaching the target strategy, simultaneously confirming the optimal step, and sending the optimal step to a corresponding game player or artificial intelligence.
According to the dependency implementation system of the game strategy, the dependency analysis module further comprises: the judgment submodule is used for judging the value of all the node data in the player dependence graph in the game, the judged value is the influence degree of the node data on the game, and the value is higher when the influence degree is higher; the sub-dependency submodule is used for analyzing the sub-node data of the player dependency graph, and comprises the steps of analyzing the contribution degree of one or more sub-nodes under the nodes, and marking the sub-data node with the highest contribution degree as a strong sub-dependency; the parent dependency sub-module is used for analyzing the parent node data of the player dependency graph, and when the number of child nodes related to the parent node exceeds a preset value, the corresponding parent node is identified as a weak parent dependency; and the strategy module is used for sending corresponding strategies to the artificial intelligence according to the analysis results after the judgment sub-module, the child dependency module and the parent dependency module are analyzed for multiple times.
The technical scheme of the invention also provides a dependence implementation method of the game strategy, which is characterized by comprising the following steps: acquiring data nodes with dependency relationship in a data structure of a game program, and creating a corresponding association graph; according to a game player or an artificial intelligence issued traversal instruction, performing deep traversal on the association graph, acquiring a step list of expanding new data nodes, and selecting an optimal step for returning back; establishing a corresponding player dependency graph based on the data nodes analyzed by the artificial intelligence and the dependency relationship corresponding to the data nodes, traversing and searching the fragile data nodes according to the player dependency graph, and customizing a corresponding strategy according to the fragile nodes.
Further, the method also includes: representing the dependency relationship which needs one or more data nodes to exist when a new data node is created by using a created dependency graph, and recording the dependency type and the dependency object of each data node; when event activity is carried out on the existing data nodes, the dependency relationship which needs one or more data nodes to provide data support is represented by using a support dependency graph, and the dependency type and the dependency object of each data node are recorded.
Further, the method also includes: and recording a plurality of data types for counting the data of all the subdata nodes.
Further, the method further comprises: analyzing one or more node data analysis requests and a target strategy included in the traversal instruction, further acquiring the incidence relation and the data type recorded by the corresponding one or more data nodes, performing deep traversal on the dependency graph according to the target strategy, acquiring a step list reaching the target strategy, simultaneously confirming the optimal step, and sending the optimal step to a corresponding game player or artificial intelligence.
Further, the method further comprises: judging the value of all the node data in the player dependence graph in the game, wherein the judged value is the influence degree of the node data on the game, and the value is higher if the influence degree is higher; analyzing the child node data of the player dependence graph, including analyzing the contribution degree of one or more child nodes under the nodes, and marking the child data node with the highest contribution degree as a strong child dependence; analyzing parent node data of the player dependence graph, and identifying a corresponding parent node as a weak parent dependence when the number of child nodes associated with the parent node exceeds a preset value; and after the judgment submodule, the child dependency module and the parent dependency module are analyzed for multiple times, sending corresponding strategies to artificial intelligence according to analysis results.
The invention has the beneficial effects that: greatly shortening the development period of the strategy game. The decision evaluation algorithm is helpful for strategy decision of strategy games. These data structures provide the AI agent or player with a way to assess the current state of the game at both strategic and functional levels. The technology is suitable for games involving economic management, resource allocation decisions and technological advances, and enhances code maintainability and reusability. Representing the game state in a good way will make decisions easier for artificial intelligence. The experience and performance of the game are enhanced. The dependency graph indicates how to build these things and how to optimize them after they have been manufactured. The staff of various positions can conveniently work in a cooperative way and the flow is optimized.
Drawings
FIG. 1 is a general flow diagram according to an embodiment of the invention;
FIG. 2 illustrates a create dependency graph according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments. The game interface behavior control system is suitable for development of games, and is particularly suitable for artificial intelligence development of strategy and team battle games.
FIG. 1 shows a general flow diagram according to an embodiment of the invention. The method comprises the steps of creating a dependency graph according to incidence relations of data nodes; traversing the dependency graph, and confirming an optimal target step, wherein the optimal target step obtained in the step can be used by a player and can also be provided for artificial intelligence; and according to the analysis result, designating a corresponding strategy.
FIG. 2 illustrates a create dependency graph according to an embodiment of the present invention. The dependency graph is a data structure that indicates all dependencies between different asset types in a game. The dependency graph contains all dependency-based relationships, such as the "technical tree" and the "building tree" of the game. The primary dependency type is the create dependency. It indicates some conditions that must be met to build a particular asset. For example, to create a spearman, a war factory is necessary. To enter the empire era, a castle must be built.
Creating dependencies may also include resource dependencies and other more abstract dependencies. Military plants require gold and wood from the labor of farmers. Farmers collect gold from gold mine and cut wood from forest.
The small dependency graph of this figure only contains the creation dependencies. Farmers can build military factories and archery, but only after the middle century times, the archery can be built.
The invention also proposes two applications based on the invention, as follows:
(1) and (4) strategy reasoning.
One application of a dependency graph is to provide a basis for inferring the current assets of other players and possible strategies to be taken based on incomplete knowledge. For example, if I know that the enemy has a war factory, one can be sure that he either already has a spearman or soon can produce a spearman. Similarly, if I find a enemy spearman, he can be 100% sure that he has a weapon factory nearby (at least, when the spearman is produced-after the spearman is produced, he is likely to destroy the weapon factory).
The inference direction is two: forward reasoning and backward reasoning. When reasoning forward, it is known that a particular player owns a particular individual or resource, and therefore concludes that he is likely to satisfy sub-dependencies. After seeing the war factory, the enemy is judged to have a spearman. When reasoning backwards, walking backwards along the dependency chain, its dependency will be satisfied according to a given individual assertion. The spearman is seen to be confident that the weapon factory is present, although never seen.
This dependency-based reasoning can be far away. If I see the enemy's majordomo, it can be concluded that the enemy is likely to have the majordomo's mystery building, advanced magic upgrade functions, sanctual, saint association, Tibetan book, and other dependencies that allow the majordomo to appear. Then, I can apply forward reasoning on these nodes, inferring other possibilities. I believe that the player is likely to be able to produce a san dier, since the presence of a san dier association can be inferred by the majoriter.
It can also be concluded from reasoning that certain nodes are unlikely to occur. If the maximum possible value of the player's economic condition, the inference drawn of the time that can be built, is set at a certain point in the game, then some dependencies will result in a smaller likelihood that other dependencies will be satisfied. If known, the top-shown player can build a nuclear weapon launching well or a red dragon thruster within 4 minutes, but not both. Thus, if one is seen, there is less likelihood that the other will be present.
(2) Dependency graphs may be used to give artificial intelligence unique personalities.
What needs to be adjusted in preference is the vulnerability values of the various nodes in the dependency graph. By increasing or decreasing the vulnerability values of different nodes, artificial intelligence can be enabled to increase or decrease the importance of these assets. Adjusting these values in an adversary's dependency graph will change the likelihood of targeting these adversary assets as attacks; adjusting these values in its own dependency graph will change the economic development mode and the technology to be used.
To set the initial priority, the approach is to select a set of ultimate goals for a given artificial intelligence. For all nodes at the rightmost (deepest) in the graph, a suitable algorithm is found, the dependencies are sorted according to desirability, and finally a good desirability value is obtained. These desirability values are then passed to the edges of the dependency graph, explicitly telling the artificial intelligence which technique is more appropriate.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and the present invention shall fall within the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention.