AI and over stacking of defensive units on Capitals
-
Beware guesswork follows;
This bit of code it taken from here
\TripleaCode\game-core\src\main\java\games\strategy\triplea\ai\pro\ProNonCombatMoveAi.java
line 582
// Calculate defense value for prioritization
final double territoryValue =
unitOwnerMultiplier
* (2.0 * production
+ 10.0 * isFactory
+ 0.5 * cantMoveUnitValue
+ 0.5 * neighborValue)
* (1 + 10.0 * isMyCapital)
* (1 + 4.0 * isEnemyOrAlliedCapital);
moveMap.get(t).setValue(territoryValue);
}Having looked through the whole file, a pure guess is that the isMyCapital and isFactory and production all combine to have a very high defensive value that causes over stacking of Defensive units?
I notice that 2.0 * production + 10.0 * isFactory will give a value that exceeds the isMyCapital alone, does this mean that a Factory with 3 production with have a value of 16 verses 11 for isMyCapital ?
Also should there more brackets in the math to make sure the logic is clear?
If so I think this is wrong, maybe the following values might go towards fixing the over stacking of defensive units.
1.0 * production
2.0 * isFactory
This would still give a working production 3 isFactory a value of 5, that would equal isEnemyOrAlliedCapital, so these values might have to be lower?
. -
Just found this;
This bit of code it taken from here
\TripleaCode\game-core\src\main\java\games\strategy\triplea\ai\pro\ProPurchaseAi.java
line 635
// Calculate defense value for prioritization
final double territoryValue =
(2.0 * production + 4.0 * isFactory + 0.5 * defendingUnitValue)
* (1 + isFactory)
* (1 + 10.0 * isMyCapital);
placeTerritory.setDefenseValue(territoryValue);
}Note the difference in the isFactory values, 1 for above but in the previous post 10, I would expect them to be similar, if not the same.
Maybe the 10 in the previous post should be 1 like above?
Also note the use of isFactory twice, this is a BIG value and can be bigger than isMyCapital, if a Factory is not in the isMyCapital terrirtory.
Could this cause the AI to abandon the Capital in favour of a factory?
. -
Thinking about this a bit more, maybe the formula is incomplete?
Perhaps the variable enemyDistance should be taken into account and checked if the enemy is 4+ territories away?
If so, then the following might be considered?
In both files ProNonCombatMoveAi and ProPurchaseAi
The Capital values should not be calculated, as its not under threat?In ProPurchaseAi the defendingUnitValue could also be excluded, as that territory is not under threat?
. -
Is it possible to design a specific AI for particular maps by containing its files along zips?
-
I would say yes, but the ends dont justify the means, which translates as, it would take too long to customise the AI for just one map verses the hours played, it would just not be worth the time spent, unless you did it for yourself.
-
But how could a common AI perform well in any maps even if developed well enough? I mean games uses very different rules just wondering if a common AI could be capable of dealing these differences.
-
Redrum (i think) was hoping to eventually make a map specific AI properties file to help it with individual maps.
-
Are users allowed to change the codes? If yes how long it will take for the new ai adopt the changes? Did you ever test the ai with these changes?
-
Currently users cannot change the codes/values.
In case you have not seen Trevan post here
https://forums.triplea-game.org/topic/2494/how-to-improve-the-ai-without-the-devs-doing-too-much-testing/2No I did not test the AI, Im just best guessing at what to do as the AI is complicated.
-
@TheDog The value is used to prioritize which territories to try to defend (do I defend my capital or this factory or this random territory) not how much to defend them with. So this probably is not causing overstacking of capitals.
-
@beelee @Cernel @ebbe @Frostion @RogerCooper
It would appear that pre-release 2.6.742 from here;
https://github.com/triplea-game/triplea/releases/tag/2.6.742also fixes the AI and over stacking of defensive units on Capitals.
I have only tested it on Frostions Warcraft: War Heroes, other maps did also suffer the same fate, if their Capital was 8+ territories from the enemy Capital.
2.6.742 was designed to fix another problem, which it did, however, I noticed that the code change affected the AI and Capitals and on a guess decided to test the above.
It needs testing as its an unintended fix.
For players who have not used 2.6, beware 2.6 will unzip ALL your current maps in your downloadedMaps folder, so rename it and put the map you want to unzip and test the AI in your new downloadedMaps folder.
-
@thedog said in AI and over stacking of defensive units on Capitals:
For players who have not used 2.6, beware 2.6 will unzip ALL your current maps in your downloadedMaps folder, so rename it and put the map you want to unzip and test the AI in your new downloadedMaps folder.
yea I still cant get it to work. Guess I'm even stupider than i thought lol
-
@beelee
If you want to, open a new post in player help and I will try to guide you