• Nenhum resultado encontrado

6.7 Discussion

6.7.3 Conclusion

We have presented a Bayesian tactical model for RTS AI, which allows both for opposing tactics prediction and autonomous tactical decision-making. Being a probabilistic model, it deals with uncertainty easily, and its design allows easy integration into multi-granularity (multi-scale) AI systems as needed in RTS AI. The advantages are that 1) learning will adapt the model output to its biased heuristic inputs 2) the updating process is the same for offline and online (in-game) learning. Without any temporal dynamics, the position prediction is above a baseline heuristic ([32.8-40.9%] vs [20.5-25.2%]). Moreover, its exact prediction rate of the joint position and tactical type is in [23-32.8]% (depending on the match-up), and considering the 4 most probable regions it goes up to ⇡ 70%. More importantly, it allows for tactical decision-making under (technological) constraints and (state) uncertainty. It can be used in production thanks to its low CPU and memory footprint.

Table 6.2: Results summary for multiple metrics at 30 seconds before attack, including the percentage of the time that it is rightly what happened (% column). Note that most of the time there is a very high temporal continuity between what can happen at time t+ 30sec and at time t+ 31sec. For the where question, we show the four most probable predictions, the “Pr” column indicates the mean probability of the each bin of the distribution. For the how question, we show the four types of attacks, their percentages of correctness in predictions (%) and the ratio of a given attack type against the total numbers of attacks (totaltype). The number in bold (38.0) is read as “38% of the time, the regioni with probability of rank 1 inP(Ai)is the one in which the attack happened 30 seconds later, in the PvT match-up (predicting Protoss attacks on Terran)”. The associated mean probability for the first rank of the where measurement is 0.329. The percentage of good predictions of ground type attacks type in PvT is 98.1%, while ground type attacks, in this match-up, constitute 54% (ratio of 0.54) of all the attacks. The where & how line corresponds to the correct predictions of both where and how simultaneously (as most probables). NA (not available) is in cases for which we do not have enough observations to conclude sufficient statistics. Remember that attacks only include fights with at least 3 units involved.

%: good predictions Protoss Terran Zerg

Pr=mean probability P T Z P T Z P T Z

total # games 445 2408 2027 2408 461 2107 2027 2107 199

measure rank % Pr % Pr % Pr % Pr % Pr % Pr % Pr % Pr % Pr

1 40.9 .334 38.0 .329 34.5 .304 35.3 .299 34.4 .295 39.0 0.358 32.8 .31 39.8 .331 37.2 .324

where

2 14.6 .157 16.3 .149 13.0 .152 14.3 .148 14.7 .147 17.8 .174 15.4 .166 16.6 .148 16.9 .157 3 7.8 .089 8.9 .085 6.9 .092 9.8 .09 8.4 .087 10.0 .096 11.3 .099 7.6 .084 10.7 .100 4 7.6 .062 6.7 .059 7.9 .064 8.6 .071 6.9 .063 7.0 .062 8.9 .07 7.7 .064 8.6 .07 measure type % totaltype % totaltype % totaltype % totaltype % totaltype % totaltype % totaltype % totaltype % totaltype G 97.5 0.61 98.1 0.54 98.4 0.58 100 0.85 99.9 0.66 76.7 0.32 86.6 0.40 99.8 0.84 67.2 0.34 how A 44.4 0.05 34.5 0.16 46.8 0.19 40 0.008 13.3 0.09 47.1 0.19 14.2 0.10 15.8 0.03 74.2 0.33 I 22.7 0.14 49.6 0.13 12.9 0.13 NA NA NA NA 36.8 0.15 32.6 0.15 NA NA NA NA D 55.9 0.20 42.2 0.17 45.2 0.10 93.5 0.13 86 0.24 62.8 0.34 67.7 0.35 81.4 0.13 63.6 0.32 total 76.3 1.0 72.4 1.0 71.9 1.0 98.4 1.0 88.5 1.0 60.4 1.0 64.6 1.0 94.7 1.0 67.6 1.0

where & how (%) 32.8 23 23.8 27.1 23.6 30.2 23.3 30.9 26.4

117

Chapter 7

Strategy

Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.

All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved.

What is of supreme importance in war is to attack the enemy’s strategy.

Sun Tzu (The Art of War, 476-221 BC)

W

epresent our solutions to some of the problems raised at the strategic level. The main idea is to reduce the complexity encoding all possible variations of strategies to a few strong indicators: the build tree* (closely related to the tech tree*) and canonical army compositions.

We start by explaining what we consider that belongs to strategic thinking, and related work.

We then describe the information that we will use and the decisions that can be taken. As we try and abstract early game strategies to “openings” (as in Chess), we will present how we labeled a dataset of games with openings. Then, we present the Bayesian model for build tree prediction (from partial observations), followed by its augmented version able to predict the opponent’s opening. Both models were evaluated in prediction dataset of skilled players. Finally we explain our work on army composition adaptation (to the opponent’s army).

Build trees estimation was published at the Annual Conference on Artificial Intelligence and Interactive Digital Entertainment (AAAI AIIDE) 2011 in Palo Alto [Synnaeve and Bessière, 2011] and openings prediction was published at Computational Intelligence in Games (IEEE CIG) 2011 in Seoul [Synnaeve and Bessière, 2011b]. A part of the army composition model (as well as details on the dataset) was published at the workshop on AI in Adversarial Real-time Games at the Annual Conference on Artificial Intelligence and Interactive Digital Entertainment (AAAI AIIDE) 2012 in Palo Alto [Synnaeve and Bessiere, 2012].

7.1 What is strategy? . . . .121 7.2 Related work . . . .121 7.3 Perception and interaction . . . .122 7.4 Replays labeling . . . .124 7.5 Build tree prediction . . . .131 7.6 Openings . . . .139

7.7 Army composition . . . .148 7.8 Conclusion . . . .158

UnitGroups UnitGroups Incomplete

Data

Opponent Strategy

Our Tactics

Our Strategy Unit Groups

BayesianUnit BayesianUnit BayesianUnit BayesianUnit

BayesianUnit BayesianUnit BayesianUnit BayesianUnit Production planner

and managers

Opponent Tactics Opponent Positions

Our Style (+ meta)

Figure 7.1: Information-centric view of the architecture of the bot, the part concerning this chapter is in the dotted rectangle

• Problem: take the winning strategy knowing everything that we saw and considering ev- erything that can happen.

• Problem that we solve: take the winning abstracted strategy (in average) knowing every- thing at this abstracted level that derives from what we saw.

• Type: prediction is a problem of inference or plan recognition from incomplete informa- tions; adaptation given what we know is a problem ofplanning under constraints.

• Complexity: simple StarCraft decision problems are np-hard [Viglietta, 2012]. We would argue that basic StarCraft strategy with full information (remember that StarCraft is partially observable) is mappable to the Generalized Geography problem1 and thus is pspace-hard [Lichtenstein and Sipser, 1978], Chess [Fraenkel and Lichtenstein, 1981] and Go (with Japanese ko rules) are exptime-complete [Robson, 1983]. Our solutions are abstracted approximations and so are real-time on a laptop.

1As the tech trees* get opened, the choices in this dimension of strategy is being reduced as in Generalized Geography.

7.1 What is strategy?

As it is an abstract concept, what constitutesstrategyis hard to grasp. The definition that we use for strategy is a combination of aggressiveness and “where do we put the cursor/pointer/slider between economy, technology and military production?”. It is very much related to where we put our resources:

• If we prioritize economy, on a short term basis our army strength (numbers) may suffer, but on the longer term we will be able to produce more, or produce equally and still expand our economy or technology in parallel. Also, keep in mind that mineral deposits/gas geysers can be exhausted/drained.

• If we prioritize technology, on a short term basis our army strength may suffer, on the longer term it can thrive with powerful units or units which are adapted to the enemy’s.

• If we prioritize military production, on a short term basis our army strength will thrive, but we will not be able to adapt our army composition to new unit types nor increase our production throughput.

Strategy is a question of balance between these three axis, and of knowing when we can attack and when we should stay in defense. Being aggressive is best when we have a military advantage (in numbers or technology) over the opponent. Advantages are gained by investments in these axis, and capitalizing on them when we max out our returns (comparatively to the opponent’s).

The other aspect of strategy is to decide what to do with these resources. This is the part that we studied the most, and the decision-making questions are:

• Where do we expand? (We deal with this question by an ad-hoc solution.)

• Which tech path do we open? Which tech tree do we want to span in a few minutes? We have to follow a tech tree that enables us to perform the tactics and long term strategy that we want to do, but we also have to adapt to whatever the opponent is doing.

• Which unit types, and in which ratios, do we want in our army? We have a choice in units that we can build, they have costs, we have to decide a production plan, knowing the possible evolutions of our tech tree and our possible future production possibilities and capabilities.

In the following, we studied the estimation of the opponent’s strategy in terms of tech trees*

(build trees*), abstracted (labeled) opening* (early strategy), army composition, and how we should adapt our own strategy to it.