Browse Source

nk2ai config

Mircea TheHonestCTO 4 months ago
parent
commit
9c3cfd5478

+ 1 - 1
AI/Nullkiller2/Engine/PriorityEvaluator.cpp

@@ -83,7 +83,7 @@ PriorityEvaluator::~PriorityEvaluator()
 
 void PriorityEvaluator::initVisitTile()
 {
-	auto file = CResourceHandler::get()->load(ResourcePath("config/ai/nkai/object-priorities.txt"))->readAll();
+	auto file = CResourceHandler::get()->load(ResourcePath("config/ai/nk2ai/object-priorities.txt"))->readAll();
 	std::string str = std::string((char *)file.first.get(), file.second);
 	engine = fl::FllImporter().fromString(str);
 	armyLossPersentageVariable = engine->getInputVariable("armyLoss");

+ 1 - 1
AI/Nullkiller2/Engine/Settings.cpp

@@ -44,7 +44,7 @@ namespace NK2AI
 		useFuzzy(false)
 	{
 		const std::string & difficultyName = GameConstants::DIFFICULTY_NAMES[difficultyLevel];
-		const JsonNode & rootNode = JsonUtils::assembleFromFiles("config/ai/nkai/nk2ai-settings");
+		const JsonNode & rootNode = JsonUtils::assembleFromFiles("config/ai/nk2ai/nkai-settings");
 		const JsonNode & node = rootNode[difficultyName];
 
 		maxRoamingHeroes = node["maxRoamingHeroes"].Integer();

+ 0 - 0
config/ai/nkai/nk2ai-settings.json → config/ai/nk2ai/nkai-settings.json


+ 276 - 0
config/ai/nk2ai/object-priorities.txt

@@ -0,0 +1,276 @@
+Engine: visit tile
+description: visit tile priority
+InputVariable: mainTurnDistance
+  description: distance to tile in turns
+  enabled: true
+  range: 0.000 10.000
+  lock-range: true
+  term: LOWEST Ramp 0.400 0.000
+  term: LOW Discrete 0.000 1.000 0.500 0.800 0.800 0.300 2.000 0.000
+  term: MEDIUM Discrete 0.000 0.000 0.500 0.200 0.800 0.700 2.000 1.000 6.000 0.000
+  term: LONG Discrete 2.000 0.000 6.000 1.000 10.000 0.800
+InputVariable: scoutTurnDistance
+  description: distance to tile in turns
+  enabled: true
+  range: 0.000 10.000
+  lock-range: true
+  term: LOWEST Ramp 0.250 0.000
+  term: LOW Discrete 0.000 1.000 1.000 0.800 2.500 0.000
+  term: MEDIUM Discrete 0.000 0.000 1.000 0.200 2.500 1.000 3.500 0.300 5.000 0.000
+  term: LONG Discrete 2.500 0.000 3.500 0.200 5.000 0.800 10.000 1.000
+InputVariable: goldReward
+  description: estimated amount of gold received
+  enabled: true
+  range: 0.000 5000.000
+  lock-range: true
+  term: LOWEST Triangle 0.000 100.000 200.000
+  term: SMALL Triangle 100.000 200.000 400.000
+  term: MEDIUM Triangle 200.000 400.000 1000.000
+  term: BIG Triangle 400.000 1000.000 5000.000
+  term: HUGE Ramp 1000.000 5000.000
+InputVariable: armyReward
+  enabled: true
+  range: 0.000 10000.000
+  lock-range: false
+  term: NONE Ramp 100.000 0.000
+  term: LOW Triangle 0.000 700.000 3000.000
+  term: HIGH Ramp 3000.000 10000.000
+  term: MEDIUM Triangle 700.000 3000.000 8000.000
+InputVariable: armyLoss
+  enabled: true
+  range: 0.000 1.000
+  lock-range: false
+  term: LOW Ramp 0.200 0.000
+  term: MEDIUM Triangle 0.000 0.200 0.500
+  term: HIGH Ramp 0.200 0.500
+  term: ALL Ramp 0.700 1.000
+InputVariable: heroRole
+  enabled: true
+  range: -0.100 1.100
+  lock-range: false
+  term: SCOUT Rectangle -0.500 0.500
+  term: MAIN Rectangle 0.500 1.500
+InputVariable: danger
+  enabled: true
+  range: 0.000 10000.000
+  lock-range: false
+  term: NONE Ramp 20.000 0.000
+  term: LOW Triangle 50.000 1000.000 2000.000
+  term: HIGH Ramp 2000.000 5000.000
+  term: MEDIUM Triangle 1000.000 2000.000 5000.000
+InputVariable: skillReward
+  enabled: true
+  range: 0.000 10.000
+  lock-range: false
+  term: NONE Ramp 1.000 0.000
+  term: LOW Triangle 0.000 1.000 3.000
+  term: MEDIUM Triangle 1.000 3.000 5.000
+  term: HIGH Discrete 3.000 0.000 5.000 0.800 10.000 1.000
+InputVariable: rewardType
+  enabled: true
+  range: 0.000 3.000
+  lock-range: false
+  term: SINGLE Rectangle 0.500 1.500
+  term: MIXED Rectangle 1.500 2.500
+  term: NONE Rectangle 0.000 0.500
+InputVariable: closestHeroRatio
+  enabled: true
+  range: 0.000 1.000
+  lock-range: false
+  term: LOW Discrete 0.000 1.000 0.500 0.800 0.700 0.200 1.000 0.000
+  term: HIGH Discrete 0.500 0.000 0.700 0.600 1.000 1.000
+  term: LOWEST Discrete 0.000 1.000 0.400 0.200 0.900 0.000
+InputVariable: strategicalValue
+  description: Some abstract long term benefit non gold or army or skill
+  enabled: true
+  range: 0.000 3.000
+  lock-range: false
+  term: NONE Ramp 0.200 0.000
+  term: LOWEST Triangle 0.000 0.010 0.250
+  term: LOW Triangle 0.000 0.250 1.000
+  term: MEDIUM Triangle 0.250 1.000 2.000
+  term: HIGH Triangle 1.000 2.000 3.000
+  term: CRITICAL Ramp 2.000 3.000
+InputVariable: goldPressure
+  description: Ratio between weekly army cost and gold income
+  enabled: true
+  range: 0.000 1.000
+  lock-range: false
+  term: LOW Ramp 0.300 0.000
+  term: HIGH Discrete 0.100 0.000 0.250 0.200 0.300 0.300 0.400 0.700 1.000 1.000
+InputVariable: goldCost
+  description: Action cost in gold
+  enabled: true
+  range: 0.000 1.000
+  lock-range: false
+  term: NONE Ramp 0.050 0.000
+  term: MEDIUM Triangle 0.100 0.200 0.500
+  term: LOW Triangle 0.000 0.100 0.200
+  term: HIGH Discrete 0.200 0.000 0.300 0.600 0.500 0.900 1.000 1.000
+InputVariable: turn
+  description: Turn of goal completion. Discrete variable to sharpen boundaries between turns. Turn distances does not care about turn boundaries and just count total movement points
+  enabled: true
+  range: 0.000 5.000
+  lock-range: false
+  term: NOW Ramp 1.000 0.999
+  term: NEXT Trapezoid 1.000 1.000 1.990 2.000
+  term: FUTURE Discrete 1.990 0.000 2.000 0.500 2.999 0.500 3.000 1.000
+InputVariable: fear
+  description: Fear strength of enemy heroes
+  enabled: true
+  range: 0.000 2.000
+  lock-range: false
+  term: LOW Triangle 0.000 0.500 1.000
+  term: MEDIUM Triangle 0.500 1.000 1.500
+  term: HIGH Ramp 1.000 1.800
+InputVariable: armyGrowth
+  enabled: true
+  range: 0.000 20000.000
+  lock-range: false
+  term: NONE Ramp 100.000 0.000
+  term: SMALL Triangle 0.000 1000.000 3000.000
+  term: MEDIUM Triangle 1000.000 3000.000 8000.000
+  term: BIG Triangle 3000.000 8000.000 20000.000
+  term: HUGE Ramp 8000.000 20000.000
+OutputVariable: Value
+  enabled: true
+  range: -1.500 2.500
+  lock-range: false
+  aggregation: AlgebraicSum
+  defuzzifier: Centroid 100
+  default: 0.500
+  lock-previous: false
+  term: WORST Binary -1.000 -inf 0.700
+  term: BAD Rectangle -1.000 -0.700 0.500
+  term: BASE Rectangle -0.200 0.200 0.350
+  term: MEDIUM Rectangle 0.910 1.090 0.500
+  term: SMALL Rectangle 0.960 1.040 0.600
+  term: BITHIGH Rectangle 0.850 1.150 0.400
+  term: HIGH Rectangle 0.750 1.250 0.400
+  term: HIGHEST Rectangle 0.500 1.500 0.350
+  term: CRITICAL Ramp 0.500 2.000 0.500
+RuleBlock: basic
+  enabled: true
+  conjunction: AlgebraicProduct
+  disjunction: AlgebraicSum
+  implication: AlgebraicProduct
+  activation: General
+  rule: if heroRole is MAIN then Value is BASE
+  rule: if heroRole is SCOUT then Value is BASE
+  rule: if heroRole is MAIN and armyGrowth is HUGE and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and armyGrowth is BIG and mainTurnDistance is LOW then Value is HIGH
+  rule: if heroRole is MAIN and armyGrowth is BIG and mainTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and armyGrowth is BIG and mainTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if armyLoss is ALL then Value is WORST
+  rule: if turn is not NOW then Value is BAD with 0.1
+  rule: if closestHeroRatio is LOWEST and heroRole is SCOUT then Value is WORST
+  rule: if closestHeroRatio is LOW and heroRole is SCOUT then Value is BAD
+  rule: if closestHeroRatio is LOWEST and heroRole is MAIN then Value is BAD
+  rule: if heroRole is SCOUT and turn is NOW and mainTurnDistance is LONG then Value is WORST
+  rule: if heroRole is SCOUT and turn is NOW and mainTurnDistance is MEDIUM then Value is BAD
+  rule: if heroRole is SCOUT and turn is NEXT and mainTurnDistance is LONG then Value is BAD
+  rule: if heroRole is SCOUT and turn is NOW and scoutTurnDistance is LONG then Value is BAD
+  rule: if heroRole is SCOUT and fear is HIGH then Value is BAD with 0.8
+  rule: if heroRole is SCOUT and fear is MEDIUM then Value is BAD with 0.5
+  rule: if heroRole is MAIN and fear is HIGH then Value is BAD with 0.5
+  rule: if heroRole is MAIN and fear is MEDIUM then Value is BAD with 0.2
+RuleBlock: strategicalValue
+  enabled: true
+  conjunction: AlgebraicProduct
+  disjunction: NormalizedSum
+  implication: AlgebraicProduct
+  activation: General
+  rule: if heroRole is MAIN and strategicalValue is HIGH and turn is NOW then Value is HIGHEST
+  rule: if heroRole is MAIN and strategicalValue is HIGH and turn is not NOW and mainTurnDistance is LOW and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is MAIN and strategicalValue is HIGH and mainTurnDistance is MEDIUM and fear is not HIGH then Value is HIGHEST with 0.5
+  rule: if heroRole is MAIN and strategicalValue is HIGH and mainTurnDistance is LONG and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and strategicalValue is MEDIUM and mainTurnDistance is LOW then Value is HIGH
+  rule: if heroRole is MAIN and strategicalValue is MEDIUM and mainTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and strategicalValue is MEDIUM and mainTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and strategicalValue is LOW and mainTurnDistance is LOW and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and strategicalValue is LOW and mainTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is not NONE and turn is NOW then Value is HIGH
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is not NONE and turn is not NOW and scoutTurnDistance is LOW and fear is not HIGH then Value is HIGH
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is not NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is HIGH with 0.5
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is not NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is not NONE and scoutTurnDistance is LOW then Value is BITHIGH
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is not NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is not NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is SMALL
+  rule: if heroRole is SCOUT and strategicalValue is LOW and danger is not NONE and scoutTurnDistance is LOW and fear is not HIGH then Value is SMALL
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is NONE and turn is NOW then Value is HIGHEST
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is NONE and turn is not NOW and scoutTurnDistance is LOW and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is HIGHEST with 0.5
+  rule: if heroRole is SCOUT and strategicalValue is HIGH and danger is NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is HIGH
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is NONE and scoutTurnDistance is LOW then Value is HIGH
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is SCOUT and strategicalValue is MEDIUM and danger is NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is SCOUT and strategicalValue is LOW and danger is NONE and scoutTurnDistance is LOW and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is SCOUT and strategicalValue is LOW and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL
+  rule: if armyLoss is HIGH and strategicalValue is LOW then Value is BAD
+  rule: if armyLoss is HIGH and strategicalValue is MEDIUM then Value is BAD with 0.7
+  rule: if strategicalValue is CRITICAL and heroRole is MAIN then Value is CRITICAL
+  rule: if strategicalValue is CRITICAL and heroRole is SCOUT then Value is CRITICAL with 0.7
+RuleBlock: armyReward
+  enabled: true
+  conjunction: AlgebraicProduct
+  disjunction: AlgebraicSum
+  implication: AlgebraicProduct
+  activation: General
+  rule: if heroRole is MAIN and armyReward is HIGH and mainTurnDistance is LOW and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is MAIN and armyReward is HIGH and mainTurnDistance is MEDIUM and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and armyReward is HIGH and mainTurnDistance is LONG and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and armyReward is MEDIUM and mainTurnDistance is LOW then Value is HIGH
+  rule: if heroRole is MAIN and armyReward is MEDIUM and mainTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and armyReward is MEDIUM and mainTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and armyReward is LOW and mainTurnDistance is LOW and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and armyReward is LOW and mainTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL
+  rule: if heroRole is SCOUT and armyReward is HIGH and danger is NONE and scoutTurnDistance is LOW and fear is not HIGH then Value is HIGH
+  rule: if heroRole is SCOUT and armyReward is HIGH and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is HIGH with 0.7
+  rule: if heroRole is SCOUT and armyReward is HIGH and danger is NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is SCOUT and armyReward is MEDIUM and danger is NONE and scoutTurnDistance is LOW then Value is HIGH with 0.7
+  rule: if heroRole is SCOUT and armyReward is MEDIUM and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is SCOUT and armyReward is MEDIUM and danger is NONE and scoutTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is SCOUT and armyReward is LOW and danger is NONE and scoutTurnDistance is LOW and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is SCOUT and armyReward is LOW and danger is NONE and scoutTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL
+RuleBlock: gold
+  enabled: true
+  conjunction: AlgebraicProduct
+  disjunction: AlgebraicSum
+  implication: AlgebraicProduct
+  activation: General
+  rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGHEST
+  rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE and armyLoss is LOW then Value is BITHIGH
+  rule: if goldReward is HUGE and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is HIGHEST
+  rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is MAIN and danger is NONE then Value is HIGH
+  rule: if goldReward is BIG and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGH
+  rule: if goldReward is BIG and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE then Value is MEDIUM
+  rule: if goldReward is BIG and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is HIGH
+  rule: if goldReward is BIG and goldPressure is HIGH and heroRole is MAIN and danger is NONE then Value is MEDIUM
+  rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is BITHIGH
+  rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE then Value is SMALL
+  rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is BITHIGH
+  rule: if goldReward is SMALL and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is MEDIUM
+  rule: if goldReward is SMALL and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is SMALL
+  rule: if goldReward is LOWEST then Value is SMALL with 0.1
+  rule: if goldReward is SMALL then Value is SMALL with 0.2
+  rule: if goldReward is MEDIUM then Value is SMALL with 0.5
+  rule: if goldReward is BIG then Value is SMALL
+  rule: if goldReward is HUGE then Value is BITHIGH
+RuleBlock: skill reward
+  enabled: true
+  conjunction: AlgebraicProduct
+  disjunction: AlgebraicSum
+  implication: AlgebraicProduct
+  activation: General
+  rule: if heroRole is MAIN and skillReward is LOW and mainTurnDistance is LOWEST and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and skillReward is MEDIUM and mainTurnDistance is LOWEST and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is MAIN and skillReward is HIGH and mainTurnDistance is LOWEST and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is MAIN and skillReward is LOW and mainTurnDistance is LOW and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and skillReward is MEDIUM and mainTurnDistance is LOW and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and skillReward is HIGH and mainTurnDistance is LOW and fear is not HIGH then Value is HIGHEST
+  rule: if heroRole is MAIN and skillReward is LOW and mainTurnDistance is MEDIUM and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and skillReward is MEDIUM and mainTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH
+  rule: if heroRole is MAIN and skillReward is HIGH and mainTurnDistance is MEDIUM and fear is not HIGH then Value is HIGH
+  rule: if heroRole is MAIN and skillReward is LOW and mainTurnDistance is LONG and fear is not HIGH then Value is SMALL
+  rule: if heroRole is MAIN and skillReward is MEDIUM and mainTurnDistance is LONG and fear is not HIGH then Value is MEDIUM
+  rule: if heroRole is MAIN and skillReward is HIGH and mainTurnDistance is LONG and fear is not HIGH then Value is BITHIGH