AI Arena - interactive AI testing framework

This commit is contained in:
Iurii Chernyi 2009-03-31 13:49:34 +00:00
parent 3bd899c402
commit 52d15a17aa
7 changed files with 598 additions and 0 deletions

View file

@ -19,6 +19,7 @@
{scenario-formula.cfg}
{scenario-formula-recruitment.cfg}
{scenario-poisoning.cfg}
{ai/scenarios/scenario-AI_Arena_small.cfg}
[textdomain]
name="wesnoth"
[/textdomain]

View file

@ -0,0 +1,3 @@
[side]
ai_algorithm = default_ai
[/side]

View file

@ -0,0 +1 @@
ai_algorithm=formula_ai

View file

@ -0,0 +1,11 @@
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]

1
data/ai/dev/idle_ai.cfg Normal file
View file

@ -0,0 +1 @@
ai_algorithm=idle_ai

View file

@ -0,0 +1,29 @@
border_size=1
usage=map
Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ql , Ql , Ql , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ql , Ql , Ql , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ur , Kud , Uu , Ql , Ql , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , 2 Kud , Xu , Xu , Xu , Xu , Xu , Xu , Uh , Wwf^Uf , Wwf , Rd , Rd , Cud , Ur , Uu^Uf , Rd , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ur , Uu^Vu , Ur , Wwf , Rd , Cud , Cud , Ur , Ur , Hh , Ss , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Rd , Xu , Wwf , Rd , Rd , Ur , Ur , Wwf , Wwf , Rd , Rd , Cud , Rp , Gs^Fp , Ss^Vhs , Ss , Rd , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Ur , Ur , Ur , Rd , Rd , Wwf , Rd , Mm , Ur , Ur , Ur^Fp , Rd^Fp , Uh , Rd , Rd , Rp , Wwf , Rd , Hh , Rd , Uu^Vu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Ql , Uu^Uf , Xu , Ur , Xu , Xu , Wwf , Wwf , Rd , Ql , Ql , Ur , Uu^Uf , Wwf , Rd , Rd , Hh , Gs^Fp , Rp , Xu , Rd , Wwf , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Rd , Gs^Fp , Rd , Ur , Xu , Ww , Ww , Xu , Xu , Xu , Uu^Vu , Wwf , Rd , Rd , Rd , Rd , Rd , Rd , Xu , Xu , Rp , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Ql , Xu , Rd , Uu^Vu , Xu , Rd , Xu , Ww , Wwf , Uh , Rd , Rd , Rd , Rd^Fp , Hh , Rd , Rp , Mm , Wwf , Ss^Vhs , Rd , Rd , Gs^Fp , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Rp , Xu , Xu , Uh , Gs^Fp , Xu , Wwf , Mm , Wwf , Gs^Fp , Mm , Hh , Rd , Rd , Rd , Rp , Hh , Wwf , Rd , Xu , Xu , Uh , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Wwf , Wwf , Gs^Fp , Rd , Rd , Uu^Uf , Xu , Wwf , Wwf , Wwf , Ww , Ww , Hh , Rp , Rd , Rd , Hh , Gs^Fp , Hh , Wwf , Xu , Rp , Rd , Uu^Uf , Xu , Xu , Xu , Xu , Xu
Xu , Rp , Wwf , Rp , Rp , Rd , Xu , Ur , Xu , Wwf , Rp , Ww , Rp , Gs^Fp , Rp , Rp , Rd , Rd , Rd , Gs^Fp , Rp , Wwf , Uh , Gs^Fp , Rd , Rd , Uh , Xu , Wo , Xu , Xu
Xu , Xu , Wo , Ww , Uh , Uh , Rd , Xu , Uh , Wwf , Rp , Rd , Rd , Rp , Rd , Rd , Rp , Rp , Rp , Rd , Rp , Wwf , Xu , Xu , Xu , Uh , Rp , Ww , Wwf , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Rd , Rd , Gs^Fp , Xu , Wwf , Hh , Gs^Fp , Hh , Rd , Rd , Rp , Hh , Gs^Fp , Ww , Ww , Wwf , Wwf , Xu , Rd , Rd , Rd , Gs^Fp , Rp , Wwf , Rp , Xu
Xu , Xu , Xu , Xu , Xu , Uu^Uf , Uh , Rp , Xu , Wwf , Wwf , Gs^Fp , Rp , Rd , Rd , Rp , Hh , Ww , Gs^Fp , Wwf , Mm , Wwf , Xu , Uu^Uf , Uh , Rd , Xu , Wwf , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Gs^Fp , Xu , Rd , Rd , Wwf , Hh , Rp , Rd , Hh , Rd , Rd , Mm , Rd , Wwf , Wwf , Wwf , Xu , Gs^Fp , Xu , Xu , Rd , Rd , Ql , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Rp , Rp , Xu , Ss^Vhs , Rd , Mm , Rd , Rd , Rd , Rd^Fp , Uu^Vu , Rd , Xu , Uh , Ww , Ww , Xu , Rd , Rd , Uu^Vu , Rd , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Wwf , Xu , Xu , Rd , Rd^Fp , Rd , Rd , Rd , Wwf , Wwf , Ur , Xu , Ql , Xu , Wwf , Ww , Xu , Ur , Ur , Gs^Fp , Uu^Uf , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Uu^Vu , Rd , Hh , Rp , Wwf , Hh , Rd , Rd , Uh , Uu^Uf , Ur^Fp , Ql , Ur , Rd , Rd , Wwf , Rd , Xu , Ur , Xu , Ur , Ql , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Uu , Xu , Xu , Rd , Rd , Rd , Ss^Vhs , Rp , Rp , Rd , Rd , Rd^Fp , Wwf , Ur , Ur , Mm , Rd , Wwf , Wwf , Rd , Rd , Ur , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Uu , Xu , Ql^Bs| , Xu , Uu , Xu , Xu , Ss , Ss , Gs^Fp , Ur , Cud , Cud , Rd , Rd , Wwf , Ur , Ur , Ur , Rd , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Ql^Bs\ , 1 Kud , Ql^Bs/ , Xu , Xu , Xu , Xu , Xu , Hh , Rd , Ur , Ur , Cud , Rd , Wwf , Wwf , Uu^Vu , Uh , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Uu , Ql^Bs/ , Ql^Bs| , Ql^Bs\ , Uu , Xu , Xu , Xu , Xu , Xu , Ql , Uu^Uf , Uu , Cud , Ur , Rd , Xu , Wwf^Uf , Xu , Xu , Xu , 3 Kud , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Uu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ql , Ql , Kud , Ql , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu
Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Ql , Ql , Ql , Ql , Ql , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu , Xu

View file

@ -0,0 +1,552 @@
#textdomain wesnoth-multiplayer
# wmllint: local spelling Kah Ruuk Oni Onis
[test]
id=ai_arena_small
name= _ "AI Arena - small"
description= _ "This most unusual of caves was once known as the Chamber of Laughing Devils, and was the inner citadel of the Kah Ruuk Oni. The Kah Ruuk were a wicked and cunning race of man-eating demons, who terrorized the people of the Eastern Lands for nearly four hundred years, before vanishing from Irdya without a trace. Since that time, many factions have vied for dominion over the Den of Onis, hoping to unlock the strange and mysterious magics of its creators."
map_data="{ai/maps/scenario-AI_Arena_small.map}"
random_start_time="no"
turns=-1
{DEFAULT_SCHEDULE}
{DEFAULT_MUSIC_PLAYLIST}
{PLACE_IMAGE items/burial.png 15 13}
{PLACE_IMAGE items/burial.png 26 16}
{PLACE_IMAGE items/burial.png 4 9}
[event]
name=preload
[set_variable]
name=test_path_to_ai
value=ai/ais/default_ai.cfg
[/set_variable]
[set_variable]
name=test_path_to_idle_ai
value=ai/dev/idle_ai.cfg
[/set_variable]
[set_variable]
name=test_path_to_default_ai
value=ai/ais/default_ai.cfg
[/set_variable]
[set_variable]
name=test_path_to_formula_ai
value=ai/ais/formula_ai.cfg
[/set_variable]
[set_variable]
name=test_id
value=2
[/set_variable]
[/event]
[side]
side=1
name="AI Developer"
type=Nightgaunt
canrecruit=yes
controller=human
team_name=master
user_team_name= _ "teamname^Master"
fog=no
[modifications]
{TRAIT_INTELLIGENT}
{TRAIT_QUICK}
{TRAIT_LOYAL}
[/modifications]
[/side]
[side]
side=2
name="Challenger AI"
type=White Mage
canrecruit=yes
controller=ai
team_name=north
user_team_name= _ "teamname^North"
fog=yes
[/side]
[side]
side=3
name="Champion AI"
type=Dark Adept
canrecruit=yes
controller=ai
team_name=south
user_team_name= _ "teamname^South"
fog=yes
[/side]
[label]
x,y=6,21
text=_ "test!"
[/label]
[event]
name=moveto
first_time_only=no
[filter]
x,y,side=6,21,1
[/filter]
[message]
speaker=unit
message=_ "Which test do you want to run, oh Mightly AI Developer ?"
[option]
message=_ "Repeat last test [$test_id]"
[/option]
[option]
message=_ "Clean the Arena [0]"
[command]
[set_variable]
name=test_id
value=0
[/set_variable]
[/command]
[/option]
[option]
message=_ "Healing: Simple healing use [1]"
[command]
[set_variable]
name=test_id
value=1
[/set_variable]
[/command]
[/option]
[option]
message=_ "Poison: Spreading poison around [2]"
[command]
[set_variable]
name=test_id
value=2
[/set_variable]
[/command]
[/option]
[/message]
[message]
speaker=unit
message=_ "Which AI do you want to use, oh Mightly AI Developer ?"
[option]
message=_ "I am happy with the current AI of team 3, [$test_path_to_ai]"
[/option]
[option]
message=_ "My AI is DEFAULT AI, and it strikes fear into the hearts of mortals."
[command]
[set_variable]
name=test_path_to_ai
value=$test_path_to_default_ai
[/set_variable]
[/command]
[/option]
[option]
message=_ "I am the king of FORMULA AI, and I will use its vast powers for world domination."
[command]
[set_variable]
name=test_path_to_ai
value=$test_path_to_formula_ai
[/set_variable]
[/command]
[/option]
[option]
message=_ "I've come with my own AI, and I am ready to test its strength"
[command]
[message]
speaker=unit
message=_ "and where is it located ? (path follows the usual WML convention)"
[text_input]
label=_ "AI Location:"
variable="test_path_to_ai"
[/text_input]
[/message]
[/command]
[/option]
[option]
message=_ "I want to test formulaAI-based poisoning improvements written by Velory"
[command]
[set_variable]
name=test_path_to_ai
value=ai/dev/formula_ai_poisoning.cfg
[/set_variable]
[/command]
[/option]
[/message]
[command]
[fire_event]
name="do_clean_arena"
[/fire_event]
[/command]
[command]
[fire_event]
name="do_setup_test"
[/fire_event]
[/command]
[command]
[fire_event]
name="do_replace_ai_2"
[/fire_event]
[/command]
[/event]
[event]
name=do_clean_arena
first_time_only=no
[kill]
animate=no
fire_event=no
canrecruit=no
[/kill]
[capture_village]
x,y=5,9
[/capture_village]
[capture_village]
x,y=6,19
[/capture_village]
[capture_village]
x,y=9,17
[/capture_village]
[capture_village]
x,y=10,20
[/capture_village]
[capture_village]
x,y=11,4
[/capture_village]
[capture_village]
x,y=14,8
[/capture_village]
[capture_village]
x,y=16,17
[/capture_village]
[capture_village]
x,y=19,22
[/capture_village]
[capture_village]
x,y=20,5
[/capture_village]
[capture_village]
x,y=21,9
[/capture_village]
[capture_village]
x,y=24,6
[/capture_village]
[capture_village]
x,y=25,17
[/capture_village]
[label]
x="9"
y="17"
[/label]
[label]
x="19"
y="6"
[/label]
[label]
x="25"
y="19"
[/label]
[label]
x="26"
y="14"
[/label]
[/event]
[event]
name=do_setup_test
first_time_only=no
[switch]
variable=test_id
[case]
value="0"
[message]
speaker=narrator
image=wesnoth-icon.png
message=_ "The Arena has been cleaned..."
[/message]
[/case]
[case]
value="1"
[message]
speaker=narrator
image=wesnoth-icon.png
message=_ "This situation should test the ability of AI to heal efficiently..."
[/message]
[unit]
side=2
x,y=10,11
type=Peasant
hitpoints=1
[/unit]
[unit]
side=2
x,y=16,16
type="Mage of Light"
[/unit]
[unit]
side=2
x,y=19,13
type="Heavy Infantryman"
hitpoints=1
[/unit]
[unit]
side=2
x,y=21,13
type="General"
hitpoints=1
[/unit]
[unit]
side=2
x,y=21,14
type="Grand Knight"
hitpoints=1
[/unit]
[unit]
side=2
x,y=10,12
type="Halberdier"
hitpoints=1
[/unit]
[unit]
side=2
x,y=9,17
type=Pikeman
hitpoints=1
[/unit]
[unit]
side=2
x,y=20,12
type="Master at Arms"
hitpoints=1
[/unit]
[unit]
side=2
x,y=10,13
type=Peasant
hitpoints=1
[/unit]
[unit]
side=2
x,y=21,9
type=Peasant
hitpoints=1
[/unit]
[unit]
side=2
x,y=16,17
type=Peasant
hitpoints=1
[/unit]
[unit]
side=2
x,y=9,17
type=Peasant
hitpoints=1
[/unit]
[capture_village]
side=2
x,y=5,9
[/capture_village]
[capture_village]
side=2
x,y=6,19
[/capture_village]
[capture_village]
side=2
x,y=9,17
[/capture_village]
[capture_village]
side=2
x,y=10,20
[/capture_village]
[capture_village]
side=2
x,y=11,4
[/capture_village]
[capture_village]
side=2
x,y=14,8
[/capture_village]
[capture_village]
side=2
x,y=16,17
[/capture_village]
[capture_village]
x,y=19,22
side=2
[/capture_village]
[capture_village]
side=2
x,y=20,5
[/capture_village]
[capture_village]
side=2
x,y=21,9
[/capture_village]
[capture_village]
side=2
x,y=24,6
[/capture_village]
[capture_village]
side=2
x,y=25,17
[/capture_village]
[modify_side]
side=2
gold=10000
[/modify_side]
[/case]
[case]
value="2"
[message]
speaker=narrator
image=wesnoth-icon.png
message=_ "This situation should test the ability of AI to spread poison around..."
[/message]
[unit]
side=2
x,y=23,14
type="Orcish Assassin"
[/unit]
[unit]
side=2
x,y=25,17
type="Orcish Assassin"
[/unit]
[unit]
side=2
x,y=19,7
type="Orcish Assassin"
[/unit]
[unit]
side=2
x,y=10,14
type="Orcish Assassin"
[/unit]
[unit]
side=2
x,y=20,7
type="Orcish Assassin"
[/unit]
[unit]
side=3
x,y=20,5
type="Drake Warden"
random_traits="no"
[modifications]
{TRAIT_RESILIENT}
[/modifications]
[/unit]
[unit]
side=3
x,y=21,7
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=23,16
type="Drake Warden"
random_traits=0
[modifications]
{TRAIT_RESILIENT}
[/modifications]
[/unit]
[unit]
side=3
x,y=17,5
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=15,7
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=17,8
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=19,9
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=26,18
type="Ancient Wose"
random_traits=0
[/unit]
[unit]
side=3
hitpoints=3
x,y=26,14
type="Drake Warden"
random_traits=0
[/unit]
[unit]
side=3
x,y=9,17
type="Skeleton"
[/unit]
[label]
colour="255,0,0,0"
text="Undead target test"
visible_in_fog="yes"
x="9"
y="17"
[/label]
[label]
colour="255,0,0,0"
text="Target choose test"
visible_in_fog="yes"
x="19"
y="6"
[/label]
[label]
colour="255,0,0,0"
text="Regeneration attack test"
visible_in_fog="yes"
x="25"
y="19"
[/label]
[label]
colour="255,0,0,0"
text="Weapon test with low hp target"
visible_in_fog="yes"
x="26"
y="14"
[/label]
[modify_side]
side=2
gold=10000
[/modify_side]
[modify_side]
side=3
gold=10000
redeploy_ai_from_location=$test_path_to_idle_ai
[/modify_side]
[/case]
[else]
[message]
speaker=narrator
message=_ "sadly, this test is not yet known in the land of Wesnoth..."
image=wesnoth-icon.png
[/message]
[/else]
[/switch]
[/event]
[event]
name=do_replace_ai_2
first_time_only=no
[modify_side]
side=2
redeploy_ai_from_location=$test_path_to_ai
[/modify_side]
[message]
speaker=narrator
message=_ "and so, the AI for team 2 was redeployed from file '$test_path_to_ai'"
[/message]
[/event]
[/test]