Difference between revisions of "Wesnoth AI"

From The Battle for Wesnoth Wiki
(Available AIs)
(AIs Available to Scenario and Map Designers: streamline this section)
Line 15: Line 15:
 
=== AIs Available to Scenario and Map Designers ===
 
=== AIs Available to Scenario and Map Designers ===
  
Wesnoth comes with several built-in AIs:
+
Wesnoth comes with several built-in AIs from which scenario and map designers can choose:
  
* '''Default (RCA) AI:''' If no special instructions are given, this AI is used automatically for all computer-controlled sides with no setup needed.  In addition, it can be configured, modified and partly or fully replaced by custom AIs in a variety of ways. For details see:
+
* '''[[RCA_AI|Default (RCA) AI]]''': If no special instructions are given, this AI is used automatically for all computer-controlled sides with no setup needed.  It can be customized in many different ways.
** [[RCA_AI]]: More details on the fundamentals, functionality and components of the default AI
 
** [[AiWML]]: Description of WML methods and parameters for modifying the default AI's behavior
 
  
* The '''Experimental AI''' adds additional features to the RCA AI and can be added to both single-player scenarios and multi-player games.  It is still under development (thus its name) and might change from release to release.
+
* The '''[[Experimental_AI]]''' adds additional features to the RCA AI.  It is still under development (thus its name) and might change from release to release, but it outperforms the default AI on most standard maps.
** [[Experimental_AI]] details
 
  
* '''Micro AIs''' add specialized behavior to Wesnoth that cannot be achieved by adjusting default AI parametersA Micro AI can be included in a scenario with a few lines of WML code, using the [[Micro_AIs#Setting_up_a_Micro_AI|[micro_ai]]] tag.
+
* '''[[Micro_AIs]]''' add specialized behavior to Wesnoth that cannot be achieved with the default AI.  There is a large number of available Micro AIs and they can be set up using just a few lines of WML code.
**[[Micro_AIs]] details
 
  
* The '''Idle AI''' does nothing at all and can be chosen with [[AiWML#The_.5Bai.5D_Tag:_Defining_Aspects|ai_algorithm=idle_ai]] in the side definition. This is generally not particularly useful and has some bugs when trying to reenable it.  It is usually better to set controller=null to deactivate sides (although that also disables healing, income/uptake and side specific events).
+
* '''[[Creating Custom AIs|Custom AIs]]''': In addition to these AIs, Wesnoth provides a large variety of options for writing you own AI code.
 
 
In addition to these AIs, Wesnoth provides a variety of options for writing you own AI code.  See the links below for details.
 
  
 
=== AIs Available in the Multiplayer Setup Menu ===
 
=== AIs Available in the Multiplayer Setup Menu ===

Revision as of 04:24, 25 February 2016

This page is currently under construction (Feb 2016)


Introduction to the Wesnoth AIs

Wesnoth provides a general artificial intelligence (AI) which is active by default for all computer-controlled sides, as well as several optional AIs. These AIs are highly configurable and can be included and/or customized by scenario and map creators using simple WML code. For AI developers, it is also possible to replace parts or all of the default AI with custom code.

This page provides a brief summary of the available AIs and of the methods, tools and resources available for using and modifying them. Links are provided to detailed documentation on each of the topics. For reference, we also provide a brief timeline describing some of the main development milestones of the Wesnoth AIs.


Available AIs

AIs Available to Scenario and Map Designers

Wesnoth comes with several built-in AIs from which scenario and map designers can choose:

  • Default (RCA) AI: If no special instructions are given, this AI is used automatically for all computer-controlled sides with no setup needed. It can be customized in many different ways.
  • The Experimental_AI adds additional features to the RCA AI. It is still under development (thus its name) and might change from release to release, but it outperforms the default AI on most standard maps.
  • Micro_AIs add specialized behavior to Wesnoth that cannot be achieved with the default AI. There is a large number of available Micro AIs and they can be set up using just a few lines of WML code.
  • Custom AIs: In addition to these AIs, Wesnoth provides a large variety of options for writing you own AI code.

AIs Available in the Multiplayer Setup Menu

Available AI Tools

  • Composite AI
  • Lua AI
  • Formula AI


List of Wesnoth AI Resources

AI Resources for Scenario and Map Creators

  • RCA_AI: Description of Wesnoth's default AI, with the following additional documentation:
  • Experimental_AI: Experimental augmented version of the default AI with additional features
  • Micro_AIs: Additional specialized AI behavior that cannot be achieved with the default AI

Resources for AI Coders

Legacy Resources for AI Coders

Miscellaneous Other Resources

The following resources are not generally needed for understanding, using and modifying Wesnoth AIs, but they might nevertheless contain some useful bits of information for the interested reader.

Finally, the link to the AI Category at the bottom of this page includes links to all the remaining AI-related pages.

A Very Brief History of Wesnoth AIs

While the general principle of the Wesnoth AI concept has been relatively stable throughout its development, the AI implementation has seen dramatic changes. That said, basic scenario creator tasks such as modifying AI parameters in WML are usually not changed much in order to keep backward compatibility. On the other hand, the steps needed to write a custom candidate action and bind it into the existing AI framework might not be quite the same in Wesnoth 1.12 as they did in 1.10, and they are definitely different in 1.8.

It is not possible to capture all these changes on the Wesnoth AI wiki pages due to the complexity of the topic. They generally only refer to the latest stable release series and the current development release series. If, for some reason, you need to do AI work with an earlier version of Wesnoth, you might have to check out the history of the wiki pages. Another way to go about it is by checking out examples of how things are done in mainline or add-ons of the respective release series. In general, however, we strongly recommend using the latest Wesnoth versions, as modifying AI behavior has become a lot simpler than it used to be.

For reference, here is a list of some of the major milestones of the AI development:

  • Up to Wesnoth 1.6
    • The default AI of Wesnoth is, in fact, called Default AI, with id=default_ai in the configuration.
  • Wesnoth 1.1/1.2:
    • A Python API for AI development is introduced. This was later removed for security reasons.
  • Wesnoth 1.5/1.6:
  • Wesnoth 1.7/1.8
  • Wesnoth 1.11/1.12
    • Introduction of the Micro_AIs
    • External Lua candidate actions become fully usable. They are now the recommended method for writing creating custom AIs