SoC Ideas AI Defense Strategies 2012

From The Battle for Wesnoth Wiki

This page is related to Summer of Code 2012
See the list of Summer of Code 2012 Ideas

This is a Summer of Code 2012 Idea


AI: Implement a 'total defense' strategy [12]

Page for the idea: SoC Ideas AI Defense Strategies 2012

AI in wesnoth's is good at killing things but is bad at defending. Therefore we are forced to make it attack at 2:1 odds. This is the single biggest limiter of the AI skill at the moment. To solve that, we need to teach the AI to defend.

There are 8 submitted student proposals for this idea

Andriy Andriychuk - "Total defence" strategy

The idea is to group own troops so they are in advantageous position and get less damage.
See Avrilfanomar for more information.

See Kripsi for more information.

Sanka Darshana - "Implement a 'total defense' strategy"

The AI will decide the best movements considering the resources available, enemy positions and their types, enemy distribution and etc... The generated movements will be decided on the values of the each troop. As an example, a shaman will be more important if there are more troops with low health, and Archers if there are troops with health. So the AI will determine which actions to take depending on a list of variables in the game environment
See SankaD for more information.

Geoffrey Hart - Maximizing Utility

A good offense is made by identifying an opponents vulnerabilities and exploiting them. As such, a good defense is made by reducing the number of weak spots. Since there is no perfect unit and all have their own imperfections, the idea is send them out in groups of units that compliment each others strengths and weaknesses. This will allow them to rearrange themselves in a way most suitable to handle nearby enemies. Since the number of predictive steps the AI can make is limited, it can become "surprised" rather easily. Therefore, it's a good choice to maximize utility and the ability to be flexible in order to handle these surprises. Then, within action-packed skirmishes, raw processing power can be brought to bear more effectively.
See SOC - Geoffrey Hart for more information.

Christopher Conway - Defensive AI

My goal is to develop an AI which is capable of “total defense” behavior, as opposed to the current aggressive AI. It would allow for the AI to function in scenarios like controlled retreats, unit escort, or holding a given area while minimizing unit loss.
See Soc2012 Borgrumm Defensive AI for more information.

Conor Nevin - Implementing a Total Defense AI

Implementing a defensive mode of the AI, so that it is able to heal units whilst holding ground against an advancing enemy.
See Soc2012 cnevin92 Total Defense AI for more information.

Nikolay Agafonov - Line Defence Strategy

The idea of this strategy is to stick together the troops and create the defencive line. All the units should be put on hexes where they would be on the defensive in most effective way. THere would be some kinds of AI's behaviour (full retreat, banking, passive attack etc.) depending on on game factors.
See SoC2012 LineDefenceStrategy for more information.

Ed Kim - Total Defense AI

Often, the best defense is a good offense. In Wesnoth, lacking either can get you slaughtered. It is particularly important that the AI learn not only to consider immediate gains and losses off a linear formula, but to take other considerations into account, especially some foresight into human reactions and macroscopic army flux. Similar to a chess engine, if the AI could learn to take "next move" heuristics into account as well as consider positional strategies such as defensive formations (line, square) by taking unit relationships into account, the AI would become a much more versatile and formidable foe.

See SoC2012 Yokipi Total Defense AI for more information.

Additional Information

Currently, the aim is to maximize (enemy losses - aggression*own_losses), where aggression is currently set to 0.4 by default. Teaching the AI to defend would allow us to lower the default aggression value. If we can bring the aggression value close to 0, the problem would be solved.

What would happen if we set aggression to 0 now? AI would only do the attacks which are 'good at killing things', but would not do the attacks, leaving only several units on the frontline. Moreover, the formula max(enemy_losses - aggression*own_losses) is broken, because it does not consider next_turn retaliation properly. A correct (but not calculable) formula would be max(enemy_losses_defending - aggression*own_losses_attacking - aggression*own_losses_next_turn + enemy_losses_attacking_next_turn + enemy_losses_defending_in_two_turns - aggression*own_losses_attacking_in_two_turns - … ). It's not calculable because we can't predict all the turns in advance with any degree of confidence. However, if we take the *next* turn into account better, then the AI would be able to play in styles other than 'all-out-attack' - because, if you take next turn into account, it makes sense to form defensive lines, block enemy units from reaching your vulnerable units, etc.

Whom to ask about this

Crab_ on irc.

This page was last edited on 5 April 2012, at 12:06.