Difference between revisions of "FormulaAIandDynamicScripting"

From The Battle for Wesnoth Wiki
m (Added some more details)
Line 1: Line 1:
 
These is a *very* rough outline of some ideas I have for the AI improvement.  I'm pretty much open to any suggestions but this outlines what I had in mind, giving the AI some adaptive capability and seems to mesh well with the idea of making the AI tunable by scenario designers and for all out combat.  
 
These is a *very* rough outline of some ideas I have for the AI improvement.  I'm pretty much open to any suggestions but this outlines what I had in mind, giving the AI some adaptive capability and seems to mesh well with the idea of making the AI tunable by scenario designers and for all out combat.  
 +
 +
==Formula AI==
 +
 +
Formula AI will be used for designing the AI rulebases described below.  A rulebase can be thought of as a set of rules containing formula AI for some behavior.  These rulebases can then be associated with units.  Much of the work will be defining what these rulebases will be and implementing them in Formula AI.  I would imagine there will be some back and forth between implementing rulebases in FormulaAI and extending Formula AI when additional functionality needs to be added.  These two things will probably be two thirds of the project.
 +
 +
==Rulebases==
 +
 +
I am thinking of the relationship between rulebases and units similar to object oriented programming in C++.  That is a unit inherits predefined rulebases which will dictate that unit's behavior.  Unit's can then be associated with very general behaviors, such as 'aggressive', 'defensive', etc. which are overall strategies for the units as well as more specific rulebases which supply unit specific behavior, such as a faction vs faction.
 +
 +
The rulebases will also be parameterized to allow for as much reuse as possible.  So for instance, a scenario designer could associate wolf riders with and aggressive rulebase as well as a faction vs faction rulebase parameterized for elves.  This would give the designer's wolf riders a behavior biased towards aggressively attacking elves.  Futhermore, general strategy rulebases which govern all units can also be applied, so the designer could apply a global rulebase tuned towards killing the opponents leader.
 +
  
 
==Dynamic Scripting==
 
==Dynamic Scripting==
Line 7: Line 18:
 
One method that seems quite suitable is dynamic scripting.  This method relies on a manually designed rulebase from which the AI can construct moves.  Each rule in the rulebase has an associated weight which influences the probability of a given rule being used in an upcoming move.  As a game progresses, the weights are updated automatically according to the success or failure of the rules in the past of the current game (or campaign).  This would allow the AI to adapt to a player's tactics and encourage the player to develop diverse strategies for use in campaign mode.  
 
One method that seems quite suitable is dynamic scripting.  This method relies on a manually designed rulebase from which the AI can construct moves.  Each rule in the rulebase has an associated weight which influences the probability of a given rule being used in an upcoming move.  As a game progresses, the weights are updated automatically according to the success or failure of the rules in the past of the current game (or campaign).  This would allow the AI to adapt to a player's tactics and encourage the player to develop diverse strategies for use in campaign mode.  
  
==Formula AI==
 
 
Formula AI can come into play for designing the rules.  The rules can be written in Formula AI thus providing an easy interface for scenario designers to modify AI behavior.  I imagine providing something like a core rulebase which provides decent gameplay, and scenario designers could add rules to the core rulebase as needed using Formula AI.
 
 
==Rulebases==
 
 
Since these are manually designed, I think this should allow us to incorporate the rules of the game such as ZoC, special unit maneuvers (backstab, etc.) into the AIs strategy and let the dynamic scripting backend decide when things are appropriate.  Scenario designers could then customize the weights and probabilities associated with the rules easily in Formula AI and ad their own in addition to the core set.
 
  
 
==Related Papers==
 
==Related Papers==
  
 
Online Adaptation of Game Opponent AI in Simulation and in Practice, Spronk et al. [http://www.fdaw.unimaas.nl/education/3.1cs/postma/GAMEON2003-Paper8-Spronck.pdf]
 
Online Adaptation of Game Opponent AI in Simulation and in Practice, Spronk et al. [http://www.fdaw.unimaas.nl/education/3.1cs/postma/GAMEON2003-Paper8-Spronck.pdf]

Revision as of 01:16, 18 March 2008

These is a *very* rough outline of some ideas I have for the AI improvement. I'm pretty much open to any suggestions but this outlines what I had in mind, giving the AI some adaptive capability and seems to mesh well with the idea of making the AI tunable by scenario designers and for all out combat.

Formula AI

Formula AI will be used for designing the AI rulebases described below. A rulebase can be thought of as a set of rules containing formula AI for some behavior. These rulebases can then be associated with units. Much of the work will be defining what these rulebases will be and implementing them in Formula AI. I would imagine there will be some back and forth between implementing rulebases in FormulaAI and extending Formula AI when additional functionality needs to be added. These two things will probably be two thirds of the project.

Rulebases

I am thinking of the relationship between rulebases and units similar to object oriented programming in C++. That is a unit inherits predefined rulebases which will dictate that unit's behavior. Unit's can then be associated with very general behaviors, such as 'aggressive', 'defensive', etc. which are overall strategies for the units as well as more specific rulebases which supply unit specific behavior, such as a faction vs faction.

The rulebases will also be parameterized to allow for as much reuse as possible. So for instance, a scenario designer could associate wolf riders with and aggressive rulebase as well as a faction vs faction rulebase parameterized for elves. This would give the designer's wolf riders a behavior biased towards aggressively attacking elves. Futhermore, general strategy rulebases which govern all units can also be applied, so the designer could apply a global rulebase tuned towards killing the opponents leader.


Dynamic Scripting

I was hoping to apply some machine learning concepts to the AI, specifically online learning. Online learning allows the AI to adapt it's strategy to fix holes being exploited by the human player and over all to perform more intelligently, giving the player a feeling he or she is playing against a thinking, clever opponent.

One method that seems quite suitable is dynamic scripting. This method relies on a manually designed rulebase from which the AI can construct moves. Each rule in the rulebase has an associated weight which influences the probability of a given rule being used in an upcoming move. As a game progresses, the weights are updated automatically according to the success or failure of the rules in the past of the current game (or campaign). This would allow the AI to adapt to a player's tactics and encourage the player to develop diverse strategies for use in campaign mode.


Related Papers

Online Adaptation of Game Opponent AI in Simulation and in Practice, Spronk et al. [1]