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

From The Battle for Wesnoth Wiki
Line 5: Line 5:
 
All configurations can be implemented by aspects (inside the [ai] tag).
 
All configurations can be implemented by aspects (inside the [ai] tag).
  
I want to seperate my Ideas for configurations in two parts:
+
==recruitment-instructions==
==Easy understandable configurations==
+
Derived from [http://forums.wesnoth.org/viewtopic.php?f=8&t=36571&p=526035 trademarks forum-thread about his idea of this configuration].
The following configurations are intended to be easy understandable without knowing details about how the recruitment analysis works.
 
Some of those configurations are often requested features in the forum.
 
 
 
recruitment-more-diverse = no (boolean)
 
When this flag is set the AI will recruit more units which are currently rare on the map. I will decide later how much ''more'' is. For a exact tweak of diversity see below.
 
 
 
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. I will decide later how strong this configuration will be considered during the recruitment phase. One could also think about doing something like recruitment-more = "Orcish Grunt, Orcish Grunt" to make the instruction to recruit more Grunts even stronger.
 
 
 
recruitment-level-pattern = "0111223" (string)
 
''unseparated list of numbers (levels)''
 
 
 
This one is inspired by [http://forum.wesnoth.org/viewtopic.php?f=21&t=35630#p516129 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-counter-strategy = no (boolean)
 
When this flag is activated the AI will also do a counter-recruitment analyses. I cannot say yet how exactly the AI will behave when this flag is set.
 
 
 
recruitment-instructions = "3:Orcish Grunt, 3:Orcish Assassin, 5:Orcish Assassin" (string)
 
''comma-separated list of the form "[Turn]:[Unit]"''
 
 
 
This instructions will overwrite all other configurations. The AI will then recruit the units in the given turn (if there is enough money). One could also think about to let the AI plan to save money in previous turns.
 
 
 
This "recruitment-instructions" is by far the most complex configuration (and needs discussion). Recently I came across [http://forums.wesnoth.org/viewtopic.php?f=8&t=36571&p=526035 trademarks forum-thread about his idea of configuration this] (he applied last year for Recruitment Refactoring).
 
To be honest I like his approach for recruitment-instructions more. It is more flexible, extendable and corresponds with the existing recruitment aspect to [limit] recruits.
 
  
 
I will repeat his idea here in a slightly modified form:
 
I will repeat his idea here in a slightly modified form:
Line 51: Line 25:
 
Parameters inside [recruit]:
 
Parameters inside [recruit]:
 
* '''id: (string)''' Important if you need to access it later to modify it.
 
* '''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 or usage 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''
* '''increment=0:''' [I will not implement this]
 
 
* '''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)''' 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".
Line 66: Line 39:
 
     importance=0
 
     importance=0
 
  [/recruit]
 
  [/recruit]
According to all the default values above (all types, as much as posible, all turns) the AI will now ''fall back'' when all other recruitment jobs are done.
+
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.
* One could think about including all other configurations I specified on this page inside [recruit]. Feedback for this important design descission is needed.
+
 
 
* To solve the [http://forums.wesnoth.org/viewtopic.php?f=8&t=36571&p=526035#p525847 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 ;)
 
* To solve the [http://forums.wesnoth.org/viewtopic.php?f=8&t=36571&p=526035#p525847 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 = 0.2 (double)
 +
 +
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)
 +
 +
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 = "0111223" (string)
 +
''unseparated list of numbers (levels)''
 +
 +
This one is inspired by [http://forum.wesnoth.org/viewtopic.php?f=21&t=35630#p516129 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-money = 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 <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.
 +
When this ratio is bigger then...
 +
recruitment-save-money-begin = 1.0 (double)
 +
...the AI will stop recruiting units until the ratio is less then...
 +
recruitment-save-money-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 = 110 (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.
  
 
==Tweaking Configurations==
 
==Tweaking Configurations==

Revision as of 00:05, 20 August 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
    [facet]
      [recruit]
        id=scout_first
        type=scout
        number=2
        turns=1,2
      [/recruit]
    [/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) 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.
  • 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.

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]
   id=recruit_more_then_specified
   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 = 0.2 (double)

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

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 = "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-money = 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-money-begin = 1.0 (double)

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

recruitment-save-money-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 = 110 (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.

Tweaking Configurations

The following configurations are intended to tweak some inner functions and weights. In order to use them one should have a idea of how the recruitment works.

Most likely I will implement those things:

recruitana-combat-weight = 1
recruitana-map-weight = 1
recruitana-counter-weight = 1
recruitana-counter-counter-weight = 1
recruitana-diversity-weight = 0

With this configurations one could adjust the weights of the scores coming from the analyse-algorithms. I want to normalize the default weight to 1 (or 0 if the analyse-algorithm is not activated by default). So one could double the impact of a algorithm by setting the weight to 2 or half the impact by setting the weight to 0.5.


This is a rather a vague guess about how some specific analysis-functions could be tweaked further. I will not specify them further yet.

recruitana-combat-range = 100
recruitana-map-village-range = 1
recruitana-counter-turns = 2

Notes

  1. I will pay attention not to break the existing configurations 'recruitment', 'recruitment_pattern', 'recruitment_ignore_bad_combat' and 'villages_per_scout'.
  2. Before all the analysis-algorithms run the units which are considered for recruitment (and get a entry in the score-map) will be filtered according to some configurations.
  3. Some combinations of configurations will cause impossible instructions. For example if a recruitment_pattern and a level_pattern are given. So some configurations will overwrite others. I will the *what overwrites what* list define later.