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

From The Battle for Wesnoth Wiki
< GCI
m (Created page with '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 w…')
 
m
Line 17: Line 17:
 
before, it contained:
 
before, it contained:
  
[ai]
+
[ai]
 
     village_value=0
 
     village_value=0
 
     leader_value=0
 
     leader_value=0
Line 25: Line 25:
 
         y=1-13,17-30,1-30,1-30
 
         y=1-13,17-30,1-30,1-30
 
     [/avoid]
 
     [/avoid]
[/ai]
+
[/ai]
  
 
after:
 
after:
  
{ai/aliases/stable_singleplayer.cfg}
+
{ai/aliases/stable_singleplayer.cfg}
[ai]
+
[ai]
 
     {AI_SIMPLE_ALWAYS_ASPECT village_value 0}
 
     {AI_SIMPLE_ALWAYS_ASPECT village_value 0}
 
     {AI_SIMPLE_ALWAYS_ASPECT leader_value 0}
 
     {AI_SIMPLE_ALWAYS_ASPECT leader_value 0}
Line 37: Line 37:
 
         y=1-13,17-30,1-30,1-30
 
         y=1-13,17-30,1-30,1-30
 
     )}
 
     )}
[/ai]
+
[/ai]

Revision as of 11:16, 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]