SummerOfCodeProposal AI Improvement Crab AI Game Rules

From The Battle for Wesnoth Wiki

We need to extract all pieces of code which "answer questions about game rules". These functions are fundamentally different with functions which make "decisions" and "evaluations". Because a question about game rules has only one correct answer (although, given the random nature of wesnoth, an answer can be a collection of possible outcomes with %chances attached.

This will allow us to remove duplication from the code and allow us to plug-in a layer between "game rules" and the "AI" called "AIs perception of the game rules" This will allow us to give scenario designers an easy-to-use tool to tune the AI behavior.

Some of the most important game rules that can be tuned to achieve flavor-effects are :

Terrain defense value

[ai]
  [perception]
     [filter]
         [filter_location]
             terrain=Gs^Fp
         [/filter_location]
     [/filter]
     my_defence_bonus=-40%
  [/perception]
[/ai]

With such an simple code (no formulas to write! and very easy to understand the effect), a scenario designer will be able to make the AI think that his units have -40% defence in forests on grass, and plan its actions accordingly.

Luck factor

[ai]
  [perception]
     [filter]
            (terrain or unit filter)
     [/filter]
     optimism = 0.2;
  [/perception]
[/ai]

And, the ai would over(under) estimate his luck (It will think that the RNG will roll better than usual and calculate accordingly)

Poison duration

[ai]
  [perception]
     poison_duration = 3;
  [/perception]
[/ai]

And, the AI will thing that it will take 3 turns for the enemy to cure unit from poison, on average (this will affect some attack-related estimates)


--

return back to Summer Of Code Proposal of Crab

This page was last edited on 6 March 2011, at 03:22.