AI Arena

From The Battle for Wesnoth Wiki
The AI Arena should still be usable, but it is currently not maintained. If you encounter any problems with the Arena itself or the content of this page, please let us know either on the forums or the developer IRC channel.

AI Arena is an interactive AI testing framework

It is implemented as a test scenario ai_arena_small (available from r34329 (31 Mar 09) )

This documentation is accurate as of r34889 (14 Apr 09)

To launch it, run Wesnoth with a -t parameter (must not come as last parameter). For example:

./wesnoth-debug -t ai_arena_small -d

The scenario is located in data/ai/scenarios/scenario-AI_Arena_small.cfg

It is based on the Den of Onis.

The map includes three sides:

1: Human (AI developer)

2: Challenger AI (Side which which is tested, 'north team')

3: Champion AI (Side which commands the enemy of the AI being tested, 'south team')

All leaders start off-map in pocketed locations.

You can access an interactive menu by right-clicking a map tile.

There are menu options which allows AI developer to pick the challenge (each challenge has a small description and a unique number), and to pick the AI that will try the challenge (AI developer can select from a list a .cfg location which contains the bare *contents* of the SIDE tag with SideWML and AiWML configuration - without the SIDE tag itself). The test will be loaded (units will appear inside the Arena) and selected AI will be hot-redeployed).

Then, the AI developer can end his turn and watch the AI's actions.

Creating new challenges

Please feel free to add more 'AI challenges' and improve existing ones. Each challenge should be AI-independent.

To create a challenge which will be committed into Wesnoth repository:

  1. Look at the content ai/scenarios/ai_arena_small directory
  2. Assign a unique CODE number (4 digits) for your challenge. Pick a NAME (suitable as part of WML event name) for your challenge. Write a small DESCRIPTION for your challenge
  3. Create a new file in ai/scenarios/ai_arena_small directory.
        code = << register_test('CODE-NAME','DESCRIPTION'); >>

Use the second event to create the situation. If you do not intend to commit that file, you may use any filename and event name you like, just make sure that this is legal WML event name and make sure that it matches in both events.

Note: Add code to clean all your labels to cleanup function. (since there is (so far) no way to delete all labels on the map)

Creating new AI configurations

Example of AI configuration file:

ai_algorithm =formula_ai

Then use it by typing a name in the interactive menu, or add a reference to it to the AI Arena scenario

Where to put new AI configurations

If it should be available for selection as a multiplayer AI and AI Arena in both non-debug and debug modes, put it in


If it should be available for selection as a multiplayer AI and AI Arena only in debug mode, put it in


Where to put all formulas which may be used by the AIs

This page was last modified on 30 November 2017, at 15:12.