ソースを参照

maxRoamingHeroesPerTown as configuration

Mircea TheHonestCTO 4 ヶ月 前
コミット
d2d7bba02e

+ 4 - 2
AI/Nullkiller2/Engine/Settings.cpp

@@ -23,8 +23,9 @@
 
 namespace NK2AI
 {
-	Settings::Settings(int difficultyLevel)
-		: maxRoamingHeroes(8),
+	Settings::Settings(int difficultyLevel):
+		maxRoamingHeroes(8),
+		maxRoamingHeroesPerTown(0),
 		mainHeroTurnDistanceLimit(10),
 		scoutHeroTurnDistanceLimit(5),
 		threatTurnDistanceLimit(5),
@@ -48,6 +49,7 @@ namespace NK2AI
 		const JsonNode & node = rootNode[difficultyName];
 
 		maxRoamingHeroes = node["maxRoamingHeroes"].Integer();
+		maxRoamingHeroesPerTown = node["maxRoamingHeroesPerTown"].Integer();
 		mainHeroTurnDistanceLimit = node["mainHeroTurnDistanceLimit"].Integer();
 		scoutHeroTurnDistanceLimit = node["scoutHeroTurnDistanceLimit"].Integer();
 		maxPass = node["maxPass"].Integer();

+ 2 - 1
AI/Nullkiller2/Engine/Settings.h

@@ -20,8 +20,8 @@ namespace NK2AI
 {
 	class Settings
 	{
-	private:
 		int maxRoamingHeroes;
+		int maxRoamingHeroesPerTown; // added on top of @link maxRoamingHeroes
 		int mainHeroTurnDistanceLimit;
 		int scoutHeroTurnDistanceLimit;
 		int threatTurnDistanceLimit;
@@ -52,6 +52,7 @@ namespace NK2AI
 		float getSafeAttackRatio() const { return safeAttackRatio; }
 		float getMaxArmyLossTarget() const { return maxArmyLossTarget; }
 		int getMaxRoamingHeroes() const { return maxRoamingHeroes; }
+		int getMaxRoamingHeroesPerTown() const { return maxRoamingHeroesPerTown; }
 		int getMainHeroTurnDistanceLimit() const { return mainHeroTurnDistanceLimit; }
 		int getScoutHeroTurnDistanceLimit() const { return scoutHeroTurnDistanceLimit; }
 		int getThreatTurnDistanceLimit() const { return threatTurnDistanceLimit; }

+ 10 - 36
config/ai/nk2ai/nkai-settings.json

@@ -1,39 +1,9 @@
 {
-	// "maxRoamingHeroes" - AI will never recruit new heroes above this value.
-	// Note that AI might end up with more heroes - due to prisons or if he has large number of heroes on start
-	//
-	// "maxpass" - ???
-	//
-	// "mainHeroTurnDistanceLimit" - AI will only run pathfinding for specified number of turns for his main hero. 
-	// "scoutHeroTurnDistanceLimit" - AI will only run pathfinding for specified number of turns for his secondary (scout) heroes
-	// Limiting this will make AI faster, but may result in AI being unable to discover objects outside of this range
-	//
-	// "maxGoldPressure" - ???
-	//
-	// "useTroopsFromGarrisons" - AI can take troops from garrisons on map. 
-	// Note that at the moment AI will not deliberately seek out such garrisons, he can only take troops from them when passing through.
-	// This option is always disabled on H3 RoE campaign maps to be in line with H3 AI
-	//
-	// "openMap" - AI will use map reveal cheat if cheats are enabled and AI is not allied with human player
-	// This improves AI decision making, but may lead AI to deliberately targeting targets that he should not be able to see at the moment
-	//
-	// "allowObjectGraph" - if used, AI will build "cache" for pathfinder on first turn, which should make AI faster. Requires openMap.
-	//
-	// "pathfinderBucketsCount" - ???
-	// "pathfinderBucketSize" - ???
-	//
-	// "retreatThresholdRelative" - AI will consider retreating from battle only if his troops are less than specified ratio compated to enemy
-	// "retreatThresholdAbsolute" - AI will consider retreating from battle only if total fight value of his troops are less than specified value
-	//
-	// "maxArmyLossTarget" - AI will try keep army loss below specified target
-	//
-	// "safeAttackRatio" - TODO: figure out how exactly it affects AI decision making
-	//
-	// "useFuzzy" - allow using of fuzzy logic. TODO: better description
-
+	// TODO: Mircea: Add proper description per field
 
 	"pawn" : {
 		"maxRoamingHeroes" : 3, //H3 value: 3,
+		"maxRoamingHeroesPerTown" : 0,
 		"maxPass" : 30,
 		"maxPriorityPass" : 10,
 		"mainHeroTurnDistanceLimit" : 10,
@@ -55,7 +25,8 @@
 	},
 
 	"knight" : {
-		"maxRoamingHeroes" : 3, //H3 value: 3,
+		"maxRoamingHeroes" : 1, //H3 value: 3,
+		"maxRoamingHeroesPerTown" : 2,
 		"maxPass" : 30,
 		"maxPriorityPass" : 10,
 		"mainHeroTurnDistanceLimit" : 10,
@@ -77,7 +48,8 @@
 	},
 
 	"rook" : {
-		"maxRoamingHeroes" : 4, //H3 value: 4
+		"maxRoamingHeroes" : 2, //H3 value: 4
+		"maxRoamingHeroesPerTown" : 2,
 		"maxPass" : 30,
 		"maxPriorityPass" : 10,
 		"mainHeroTurnDistanceLimit" : 10,
@@ -99,7 +71,8 @@
 	},
 
 	"queen" : {
-		"maxRoamingHeroes" : 6, //H3 value: 5
+		"maxRoamingHeroes" : 3, //H3 value: 5
+		"maxRoamingHeroesPerTown" : 2,
 		"maxPass" : 30,
 		"maxPriorityPass" : 10,
 		"mainHeroTurnDistanceLimit" : 10,
@@ -121,7 +94,8 @@
 	},
 
 	"king" : {
-		"maxRoamingHeroes" : 8, //H3 value: 6
+		"maxRoamingHeroes" : 4, //H3 value: 6
+		"maxRoamingHeroesPerTown" : 2,
 		"maxPass" : 30,
 		"maxPriorityPass" : 10,
 		"mainHeroTurnDistanceLimit" : 10,