AI Arena

From The Battle for Wesnoth Wiki
Revision as of 14:28, 31 March 2009 by Crab (talk | contribs) (Creating new AI configurations)

AI Arena is an interactive AI testing framework

It is implemented as a test scenario ai_arena_small (available from r34329 (31 Mar 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.

Human leader can access an interactive menu by stepping on the "test!" marker (6,21)

There is an interactive menu 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 or input 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.

While creating a challenge, do not forget about:

  1. Assign a unique number for your challenge. Insert your challenge at the end of the challenge list (so, numbers will be sorted)
  2. If you are creating multiple challenges to the same topic, you can 'nest' them in the challenge selection dialog (to let the AI developer select the topic, then select the challenge)
  3. Add code to clean all your labels to cleaup function. (since there is (so far) now way to delete all labels on the map)
  4. Set each side gold to be 'high enough'
  5. if it is needed, use something this like to make the other side (champion AI) passive:
[modify_side]
   side=3
   gold=10000
   redeploy_ai_from_location=$test_path_to_idle_ai
[/modify_side]

Creating new AI configurations

Example of AI configuration file:

ai_algorithm =formula_ai
[ai]
   eval_list=yes
   [register_candidate_move]
       name=poisoner
       type=attack
       evaluation="{ai/formula/poisoner_eval.fai}"
       action="{ai/formula/poisoner_attack.fai}"
   [/register_candidate_move]
[/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, put it in

data/ai/ais/

If it should NOT be available for selection as a multiplayer AI, put it in

data/ai/dev/

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

data/ai/formula/