Difference between revisions of "User:Flixx/Configuration Specifications"

From The Battle for Wesnoth Wiki
(Tweaking Configurations)
(Other, less important)
 
(17 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
  [ai]
 
  [ai]
 
   [aspect]
 
   [aspect]
     id=recruitment
+
     id=recruitment-instructions
 
     [facet]
 
     [facet]
       [recruit]
+
      turns=1,2
         id=scout_first
+
       [value]  
        type=scout
+
         [recruit]
        number=2
+
          type=scout
         turns=1,2
+
          number=2
       [/recruit]
+
         [/recruit]
 +
       [/value]
 
     [/facet]
 
     [/facet]
 
   [/aspect]
 
   [/aspect]
Line 24: Line 25:
 
   
 
   
 
Parameters inside [recruit]:
 
Parameters inside [recruit]:
* '''id: (string)''' Important if you need to access it later to modify it.
+
*<strike> '''id: (string)''' Important if you need to access it later to modify it.</strike>
 
* '''type="": (string)''' This key takes a comma separated list containing the unit-type, usage or level of the units that can be recruited. A value "random" means to recruit randomly all type of units. A empty string means that the AI will decide what to recruit (so "" means kind of ''all units'').
 
* '''type="": (string)''' This key takes a comma separated list containing the unit-type, usage or level of the units that can be recruited. A value "random" means to recruit randomly all type of units. A empty string means that the AI will decide what to recruit (so "" means kind of ''all units'').
 
* '''number=-1:''' (integer) A number greater than 0 will tell the AI to recruit n units of each usage/unit-type for each turns specified below. -1 means ''as much as possible''. 0 means ''do not recruit''
 
* '''number=-1:''' (integer) A number greater than 0 will tell the AI to recruit n units of each usage/unit-type for each turns specified below. -1 means ''as much as possible''. 0 means ''do not recruit''
* '''turns="": (string)''' This key takes a comma separated list containing number specifying the turn. '-' can be used between two values to define a range. A empty String means ''all turns''.
+
* '''turns="": (string)''' Outside [recruit]. This key takes a comma separated list containing number specifying the turn. '-' can be used between two values to define a range. A empty String means ''all turns''.  
 
* '''importance=1: (integer)''' The importance of a recruitment tells the AI to firstly recruit units with the highest importance. If gold is lacking or the castle is full, only the most important units will be recruited, the other will be dropped. This is useful when we want to do something like "recruit 3 scouts and if there is still money left recruit fighters".
 
* '''importance=1: (integer)''' The importance of a recruitment tells the AI to firstly recruit units with the highest importance. If gold is lacking or the castle is full, only the most important units will be recruited, the other will be dropped. This is useful when we want to do something like "recruit 3 scouts and if there is still money left recruit fighters".
* '''leader_id="": (string)''' If the AI plays with multiple leaders who can recruit we may target only one of them. Empty sting means ''all leaders''.
+
* '''leader_id="": (string)''' If the AI plays with multiple leaders who can recruit we may target only one of them. Empty sting means ''all leaders''. (Note: Because of current implementation, leader_id is only a recommendation for the AI. If the specified leader has no free hexes the AI will use other leaders to do the job) 
 
* '''total=no: (boolean)''' Sometimes it could be useful to define how many units of one type should be on the map. When total is set to ''yes'' the AI will count the own units on the map and will then recruit the difference between ''number'' and the counted amount.
 
* '''total=no: (boolean)''' Sometimes it could be useful to define how many units of one type should be on the map. When total is set to ''yes'' the AI will count the own units on the map and will then recruit the difference between ''number'' and the counted amount.
 +
* '''blocker=yes: (boolean)''' If set to ''yes'', the AI will stop recruiting when this job cannot be done (because the wished leader is not on a keep for example). If set to ''no'' the AI will skip this job and continue with less important ones.
 +
* '''pattern=no: (boolean)''' If set to yes, the unit to recruit will not be chosen by the AI but randomly according to the frequency in the type attribute. For example when "type=Grunt, Grunt, scout" and "number=6", the AI will recruit 6 units whereas the probability that one unit is a Grunt is twice as big as the probability that the AI will recruit a scout.
  
 
Notes:
 
Notes:
Line 36: Line 39:
 
* By default when recruitment is specified for a turn, the AI will not recruit any other unit. (So if we say recruit 1 scout in turn 1 then the ai will only recruit 1 scout and not more). To prevent this behavior one can do this:
 
* By default when recruitment is specified for a turn, the AI will not recruit any other unit. (So if we say recruit 1 scout in turn 1 then the ai will only recruit 1 scout and not more). To prevent this behavior one can do this:
 
  [recruit]
 
  [recruit]
    id=recruit_more_then_specified
 
 
     importance=0
 
     importance=0
 
  [/recruit]
 
  [/recruit]
Line 45: Line 47:
 
==Other==
 
==Other==
  
===recruitment-diversity===
+
===recruitment_diversity===
  recruitment_diversity = 0.2 (double)
+
  recruitment_diversity = 1.0 (double)
  
 
When this value is high, the AI will recruit more units which are currently rare on the map.
 
When this value is high, the AI will recruit more units which are currently rare on the map.
(<code>recruitment_diversity * 50</code> will be added to each score)
+
(<code>recruitment_diversity * 25</code> will be added to each score)
  
 
===recruitment_more===
 
===recruitment_more===
Line 59: Line 61:
 
is possible to add 50.
 
is possible to add 50.
  
===recruitment_level_pattern===
+
===<strike>recruitment_level_pattern</strike>===
 
  recruitment_level_pattern = "0111223" (string)
 
  recruitment_level_pattern = "0111223" (string)
 
''unseparated list of numbers (levels)''
 
''unseparated list of numbers (levels)''
Line 66: Line 68:
 
'''recruitment_level_pattern will internally expand to a recruitment-instruction (see above)'''
 
'''recruitment_level_pattern will internally expand to a recruitment-instruction (see above)'''
  
===recruitment_save_money===
+
===recruitment_save_gold===
  recruitment_save_money = no (boolean)
+
  recruitment_save_gold = no (boolean)
 
When this flag is activated the AI will not always recruit when money is available.
 
When this flag is activated the AI will not always recruit when money is available.
 
The AI will always keep track of the ratio <code>our_total_unit_costs / enemy_total_unit_costs</code>
 
The AI will always keep track of the ratio <code>our_total_unit_costs / enemy_total_unit_costs</code>
 
whereas the costs are the sum of the cost of all units on the map weighted by their HP.
 
whereas the costs are the sum of the cost of all units on the map weighted by their HP.
 
When this ratio is bigger then...
 
When this ratio is bigger then...
  recruitment_save_money_begin = 1.0 (double)
+
  recruitment_save_gold_begin = 1.0 (double)
 
...the AI will stop recruiting units until the ratio is less then...
 
...the AI will stop recruiting units until the ratio is less then...
  recruitment_save_money_end = 0.7 (double)
+
  recruitment_save_gold_end = 0.7 (double)
 
This leads to wave-like recruiting. Also if the enemy hasn't recruited any units yet, the AI will only recruit a few units (with default begin/end usually one).
 
This leads to wave-like recruiting. Also if the enemy hasn't recruited any units yet, the AI will only recruit a few units (with default begin/end usually one).
  
  recruitment_spend_all_gold = 110 (int)
+
  recruitment_spend_all_gold = -1 (int)
  
 
Only important when recruitment_save_money=yes.
 
Only important when recruitment_save_money=yes.
When the AI have earned this much gold, the AI will start spending all money to start a big offensive wave.
+
When the AI have earned this much gold, the AI will start spending all money to start a big offensive wave. If recruitment_spend_all_gold is -1, this value will be set to the AIs start gold + 1.
  
 
==Other, less important==
 
==Other, less important==
===recruitment_unit_threshold===
+
===<strike>recruitment_unit_threshold</strike>===
 
  recruitment_unit_threshold = 5 (int)
 
  recruitment_unit_threshold = 5 (int)
 
When the enemy has less then this much units, the AI will place fake units of all possible unit-types the enemy can recruit at the leaders location.
 
When the enemy has less then this much units, the AI will place fake units of all possible unit-types the enemy can recruit at the leaders location.
  
===recruitment_combat_diversity===
+
===<strike>recruitment_combat_diversity</strike>===
 
  recruitment_combat_diversity = 1. (positive double)
 
  recruitment_combat_diversity = 1. (positive double)
 
Used for combat analysis.
 
Used for combat analysis.
Line 96: Line 98:
  
 
===recruitment_randomness===
 
===recruitment_randomness===
  recruitment_randomness = 5. (double)
+
  recruitment_randomness = 15 (int)
 
To each score a random value between 0 and <code>recruitment_randomness</code> will be added.
 
To each score a random value between 0 and <code>recruitment_randomness</code> will be added.
  
Line 108: Line 110:
 
===not supported anymore===
 
===not supported anymore===
 
  recruitment
 
  recruitment
The recruitment aspect with its [limit]-tags is equivalent to the recruitment-instructions when total is set to "yes".
+
Most likely it'll be possible to define [limit] along with [recruit] in the recruitment instructions.
'''It need to be discussed if the new CA shall support [limit] as well.'''
+
This need to be discussed.
  
 
  recruitment_ignore_bad_combat
 
  recruitment_ignore_bad_combat

Latest revision as of 15:59, 10 September 2013

The specifications are Work in Progress

See this forum thread

All configurations can be implemented by aspects (inside the [ai] tag).

recruitment-instructions

Derived from trademarks forum-thread about his idea of this configuration.

I will repeat his idea here in a slightly modified form:

[ai]
  [aspect]
    id=recruitment-instructions
    [facet]
      turns=1,2
      [value] 
        [recruit]
          type=scout
          number=2
        [/recruit]
      [/value]
    [/facet]
  [/aspect]
[/ai]

Parameters inside [recruit]:

  • id: (string) Important if you need to access it later to modify it.
  • type="": (string) This key takes a comma separated list containing the unit-type, usage or level of the units that can be recruited. A value "random" means to recruit randomly all type of units. A empty string means that the AI will decide what to recruit (so "" means kind of all units).
  • number=-1: (integer) A number greater than 0 will tell the AI to recruit n units of each usage/unit-type for each turns specified below. -1 means as much as possible. 0 means do not recruit
  • turns="": (string) Outside [recruit]. This key takes a comma separated list containing number specifying the turn. '-' can be used between two values to define a range. A empty String means all turns.
  • importance=1: (integer) The importance of a recruitment tells the AI to firstly recruit units with the highest importance. If gold is lacking or the castle is full, only the most important units will be recruited, the other will be dropped. This is useful when we want to do something like "recruit 3 scouts and if there is still money left recruit fighters".
  • leader_id="": (string) If the AI plays with multiple leaders who can recruit we may target only one of them. Empty sting means all leaders. (Note: Because of current implementation, leader_id is only a recommendation for the AI. If the specified leader has no free hexes the AI will use other leaders to do the job)
  • total=no: (boolean) Sometimes it could be useful to define how many units of one type should be on the map. When total is set to yes the AI will count the own units on the map and will then recruit the difference between number and the counted amount.
  • blocker=yes: (boolean) If set to yes, the AI will stop recruiting when this job cannot be done (because the wished leader is not on a keep for example). If set to no the AI will skip this job and continue with less important ones.
  • pattern=no: (boolean) If set to yes, the unit to recruit will not be chosen by the AI but randomly according to the frequency in the type attribute. For example when "type=Grunt, Grunt, scout" and "number=6", the AI will recruit 6 units whereas the probability that one unit is a Grunt is twice as big as the probability that the AI will recruit a scout.

Notes:

  • If there is more then one unit specified for recruiting (with the same importance), the AI will decide what to recruit.
  • By default when recruitment is specified for a turn, the AI will not recruit any other unit. (So if we say recruit 1 scout in turn 1 then the ai will only recruit 1 scout and not more). To prevent this behavior one can do this:
[recruit]
   importance=0
[/recruit]

According to all the default values above (all types, as much as possible, all turns) the AI will now fall back when all other recruitment jobs are done.

  • To solve the Problem described by Coffee one could define along with [recruit] something like [count_trait_as]. There we could define that we count the trait "quick" as "scout". Then we could first recruit fighters with high importance. In a next step we recruit scouts and make use of the total flag. Discussion needed ;)

Other

recruitment_diversity

recruitment_diversity = 1.0 (double)

When this value is high, the AI will recruit more units which are currently rare on the map. (recruitment_diversity * 25 will be added to each score)

recruitment_more

recruitment_more = "Orcish Grunt" (string)

comma-separated string of unit-types ("Orcish Grunt") and/or usages ("fighter").

This is meant to let a scenario editor make a easy hack when he/she wants the AI to recruit more units of a specific type. (25 will be added to the unit-types score).

recruitment-more = "Orcish Grunt, Orcish Grunt" 

is possible to add 50.

recruitment_level_pattern

recruitment_level_pattern = "0111223" (string)

unseparated list of numbers (levels)

This one is inspired by this idea in the forum. When a recruitment_level_pattern is given the AI will similar to recruitment_pattern only recruit units according to given level ratios. recruitment_level_pattern will internally expand to a recruitment-instruction (see above)

recruitment_save_gold

recruitment_save_gold = no (boolean)

When this flag is activated the AI will not always recruit when money is available. The AI will always keep track of the ratio our_total_unit_costs / enemy_total_unit_costs whereas the costs are the sum of the cost of all units on the map weighted by their HP. When this ratio is bigger then...

recruitment_save_gold_begin = 1.0 (double)

...the AI will stop recruiting units until the ratio is less then...

recruitment_save_gold_end = 0.7 (double)

This leads to wave-like recruiting. Also if the enemy hasn't recruited any units yet, the AI will only recruit a few units (with default begin/end usually one).

recruitment_spend_all_gold = -1 (int)

Only important when recruitment_save_money=yes. When the AI have earned this much gold, the AI will start spending all money to start a big offensive wave. If recruitment_spend_all_gold is -1, this value will be set to the AIs start gold + 1.

Other, less important

recruitment_unit_threshold

recruitment_unit_threshold = 5 (int)

When the enemy has less then this much units, the AI will place fake units of all possible unit-types the enemy can recruit at the leaders location.

recruitment_combat_diversity

recruitment_combat_diversity = 1. (positive double)

Used for combat analysis. Determines a kind of *lower threshold* for combat scores. A smaller value means that combat analysis will give more 0 scores.

  • 0. means that only the best unit gets a 100 score and all other a 0 score.
  • 1. means that all units which are worse than average will get a 0 score.
  • 2. means that all units which are worse then twice the average will get a 0 score.

recruitment_randomness

recruitment_randomness = 15 (int)

To each score a random value between 0 and recruitment_randomness will be added.

Old aspects

supported

recruitment_pattern="" (string)

recruitment_pattern will internally expand to a recruitment-instruction (see above)

villages_per_scout=4 (int)

not supported anymore

recruitment

Most likely it'll be possible to define [limit] along with [recruit] in the recruitment instructions. This need to be discussed.

recruitment_ignore_bad_combat
This page was last edited on 10 September 2013, at 15:59.