Difference between revisions of "GCI/Port AI WML configuration to new style syntax"

From The Battle for Wesnoth Wiki
< GCI
m
Line 38: Line 38:
 
     )}
 
     )}
 
  [/ai]
 
  [/ai]
 +
 +
Or, if we had separate config for 'night' time of day ( time_of_day=dusk,first_watch,second_watch)
 +
 +
before:
 +
        [ai]
 +
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
 +
        [/ai]
 +
        [ai]
 +
            time_of_day=dusk,first_watch,second_watch
 +
            aggression=0.75
 +
            caution=0.0
 +
            grouping=offensive
 +
        [/ai]
 +
 +
after:
 +
  {ai/aliases/stable_singleplayer.cfg}
 +
  [ai]
 +
    {AI_SIMPLE_NIGHT_ASPECT aggression 0.75}
 +
    {AI_SIMPLE_NIGHT_ASPECT caution 0}
 +
    {AI_SIMPLE_NIGHT_ASPECT grouping offensive}
 +
    {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout,fighter,fighter,archer,mixed fighter"}
 +
  [/ai]
 +
 +
you might need to ask questions about how a particular tag should be converted, ask them on #wesnoth-dev on irc.

Revision as of 11:28, 22 November 2010

Wesnoth uses a custom markup language called WML, which can be edited by hand (it's similar to xml)

AI configuration can be written using WML.

In 2009, a new style syntax for writing AI configurations in Wesnoth was created.

New syntax is described on http://wiki.wesnoth.org/Customizing_AI_in_Wesnoth_1.8

Old syntax is described on http://wiki.wesnoth.org/AiWML

We need to convert existing AI syntax to new style.

The preferred way to do it is to teach wesnoth's custom WML conversion tool, wmllint, (written in python) to do it, or to write a helper script to do it. Or it can be done by hand. In any case, human review is required, to see that everything is ok.

As an example of the conversion process, you can use the first scenario of Legend of Wesmere campaign:

before, it contained:

[ai]
   village_value=0
   leader_value=0
   protect_leader=0
   [avoid]
       x=1-30,1-30,1-3,7-30
       y=1-13,17-30,1-30,1-30
   [/avoid]
[/ai]

after:

{ai/aliases/stable_singleplayer.cfg}
[ai]
   {AI_SIMPLE_ALWAYS_ASPECT village_value 0}
   {AI_SIMPLE_ALWAYS_ASPECT leader_value 0}
   {AI_SIMPLE_ALWAYS_ASPECT_VALUE avoid (
       x=1-30,1-30,1-3,7-30
       y=1-13,17-30,1-30,1-30
   )}
[/ai]

Or, if we had separate config for 'night' time of day ( time_of_day=dusk,first_watch,second_watch)

before:

       [ai]
           recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
       [/ai]
       [ai]
           time_of_day=dusk,first_watch,second_watch
           aggression=0.75
           caution=0.0
           grouping=offensive
       [/ai]

after:

 {ai/aliases/stable_singleplayer.cfg}
 [ai]
    {AI_SIMPLE_NIGHT_ASPECT aggression 0.75}
    {AI_SIMPLE_NIGHT_ASPECT caution 0}
    {AI_SIMPLE_NIGHT_ASPECT grouping offensive}
    {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout,fighter,fighter,archer,mixed fighter"}
  [/ai]

you might need to ask questions about how a particular tag should be converted, ask them on #wesnoth-dev on irc.