Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI fixes related to strafing and expensive land units #4110

Merged
merged 2 commits into from
Sep 27, 2018
Merged

Conversation

ron-murhammer
Copy link
Member

@@ -930,7 +930,7 @@ private void determineUnitsToAttackWith(final List<ProTerritory> prioritizedTerr
tuvSwing *= 0.5;
}
final double attackValue =
tuvSwing + territoryValue * result.getWinPercentage() / 100 - enemyCounterTuvSwing * 2 / 3;
1 + tuvSwing + territoryValue * result.getWinPercentage() / 100 - enemyCounterTuvSwing * 2 / 3;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI was generally undervaluing low production territories.

final boolean isExpensiveLandUnit = Matches.unitIsLand().test(unit)
&& ProData.unitValueMap.getInt(unit.getType()) > 2 * ProData.minCostPerHitPoint;
if (isAirUnit || isExpensiveLandUnit || addedUnits.contains(unit)) {
continue; // skip air and expensive units
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to use cheap land units to populate attacks in territories first as fodder. Most maps this doesn't matter since all land units are fairly cheap but some of the advanced maps have expensive land units.

}
// Check if I can win without amphib units
final List<Unit> defenders =
new ArrayList<>(isIgnoringRelationships ? t.getUnits() : patd.getMaxEnemyDefenders(player, data));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So removing all units with AA attacks causes issues for advanced maps that have lots of different types of unit with AA style attacks. So remove this filter as its causing problems.

@ron-murhammer ron-murhammer changed the title Some minor AI fixes related to strafing AI fixes related to strafing and expensive land units Sep 26, 2018
@codecov-io
Copy link

codecov-io commented Sep 26, 2018

Codecov Report

Merging #4110 into master will increase coverage by 0.44%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4110      +/-   ##
============================================
+ Coverage     22.65%   23.09%   +0.44%     
- Complexity     6106     6652     +546     
============================================
  Files           844      845       +1     
  Lines         70906    76105    +5199     
  Branches      11379    13410    +2031     
============================================
+ Hits          16062    17578    +1516     
- Misses        52765    56301    +3536     
- Partials       2079     2226     +147
Impacted Files Coverage Δ Complexity Δ
...games/strategy/triplea/ai/pro/util/ProMatches.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ategy/triplea/ai/pro/data/ProTerritoryManager.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...games/strategy/triplea/ai/pro/ProCombatMoveAi.java 0.35% <0%> (-0.01%) 1 <0> (ø)
.../games/strategy/engine/data/DefaultAttachment.java 91.3% <0%> (-8.7%) 24% <0%> (ø)
...a/games/strategy/triplea/delegate/TechAdvance.java 85.81% <0%> (-3.36%) 45% <0%> (+18%)
...c/main/java/games/strategy/triplea/ai/AiUtils.java 4.82% <0%> (-1.78%) 4% <0%> (ø)
...ava/games/strategy/engine/chat/ChatController.java 2.43% <0%> (-0.69%) 2% <0%> (ø)
...ain/java/games/strategy/triplea/TripleAPlayer.java 2.43% <0%> (-0.59%) 2% <0%> (ø)
...es/strategy/triplea/delegate/EndRoundDelegate.java 1.47% <0%> (-0.25%) 1% <0%> (ø)
...ain/java/games/strategy/triplea/ai/AbstractAi.java 0.94% <0%> (-0.08%) 2% <0%> (ø)
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db0b33b...f1db114. Read the comment docs.

@ssoloff ssoloff merged commit 4c3b27d into master Sep 27, 2018
@RoiEXLab RoiEXLab deleted the Fix_AI_Strafing branch October 2, 2018 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants