AI Arena

From The Battle for Wesnoth Wiki
Revision as of 17:43, 25 March 2009 by Crab (talk | contribs) (extracted AI hot redeployment to separate project)

Testing the AI

There was an IRC discussion on March 23-24 between Dragonking, Crab_, and Velory, regarding the Arena to test AI - a specific map (later - set of maps) to test a 'chosen' AI in 'chosen' situation.

The elements of proposed implementation are as follows:

One shared map, usable with any ai and a number of starting situations

First arena is to be based on Den of Onis. It was picked by Dragonking because it is a small map and is good since it has different terrain including caves, lava, water etc and we can look for a bugs there when we test some particular usages.

-- This map should be changed a bit to allow 3 players (human1, computer2, computer3). Faction leaders should start 'outside' the main map in isolated 1-space pockets (for example, to allow human player to be a 'spectator' in the fight between two computers, or to allow a human to fight with a computer).

Ability to select from multiple 'pre-defined' starting situations. This will allow to design 'challenges' for the ai and select one of them for execution. A challenge, which is created as part of that 'Arena scenario', basically creates some units on the map (optionally, if it so required by the situation under test - moves leaders from their isolated pockets to the battleground), sets their hit points and statuses, etc. It's purpose is to create a 'interesting tactical situation' for the ai to handle and it knows nothing about the AI that will try to handle it. So, the scenario will include a number of starting situations, each will have a 'name'. There will be ways (for example, by stepping a specific off-arena unit to trigger a WML events to:

- clean up the arena

- create specific tactical situation (by selecting it from a list or by typing a name in the dialog box)

Ability to hot-redeploy AI for the specific side from in-game console. This will allow loading a specific ai from a specific WML configuration file (this may also load some .fai files which were included in the configuration).

Ability to clean up the map This will allow to return the leaders to their starting positions, and remove all units from the arena. It can be used to 'restart' the test.

Ability to restart the test - Combo ability to clean up, then select same pre-defined tactical situation, then hot-redeploy all the AIs This is basically an 'one shot restart test without typing too much in the console'. Can be implemented as a 'tile that some off-arena unit must step on' or as a console command.

Maybe - Ability to loop the test and evaluate and output the results This is for 'run this 100 times no more that 20 turns each and see which side wins' kind of testing

Usage example:

  1. create WML AI configuration which includes some formulas or includes some .fai files.
  2. launch the Arena.
  3. select a suitable tactical situation. Units will appear on the map.
  4. redeploy the ai(s) using in-game console.
  5. test and debug the AI efficiency in that tactical situation
  6. restart or redeploy as needed. Changes in the AI WML configuration will be picked up after either redeployment or restart.
  7. when formula change is committed, only it's testing AI configuration file (+ any referenced .fai) are to be commited. (because map and list of challenges do not depend on them)