Skip to content

feat: adds CONVOY behavior setting preset and flag to ignore damage output on pathing #6944

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Scoppio
Copy link
Collaborator

@Scoppio Scoppio commented Apr 28, 2025

What is it about?

Adds CONVOY behavior setting preset, a behavior controlling flag to ignore damage output (damage that would be caused by this unit onto enemies) when calculating pathing utility score was added, also adds special case where unit will give priority to face towards its destination when fleeing but only if it has the flag ignore damage output enabled.

What it does?

This small feature adds a simple behavior control toggle

Anything else?

Alot of Javadoc was added on BasicPathRanker to better explain what is happening.

Issues:

This PR potentially resolves the following RFE's

…king, also adds special case where unit will face destination
@Copilot Copilot AI review requested due to automatic review settings April 28, 2025 01:47
@Scoppio Scoppio requested a review from a team as a code owner April 28, 2025 01:47
@Scoppio Scoppio self-assigned this Apr 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new CONVOY behavior preset along with a flag to ignore damage output, affecting both path ranking and behavior settings. Key changes include:

  • Introduction of new clamp methods (clamp01 and clampUlp1) in MathUtility.
  • Updates to BotConfigDialog and various bot components (UtilityPathRanker, BasicPathRanker, BehaviorSettings, etc.) to incorporate the ignoreDamageOutput flag.
  • Enhanced Javadoc documentation and minor logging improvements.

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
megamek/src/megamek/codeUtilities/MathUtility.java Added helper clamp methods with accompanying Javadoc
megamek/src/megamek/client/ui/dialogs/BotConfigDialog.java Added UI component and action handling for ignoreDamageOutput flag
megamek/src/megamek/client/bot/princess/UtilityPathRanker.java Updated path ranking logic to account for ignoreDamageOutput flag
megamek/src/megamek/client/bot/princess/Princess.java Logging improvements with parameterized messages
megamek/src/megamek/client/bot/princess/PathRanker.java Expanded Javadoc and minor logic updates for path ranking
megamek/src/megamek/client/bot/princess/BehaviorSettingsFactory.java Added new CONVOY preset and null-checks for behavior presets
megamek/src/megamek/client/bot/princess/BehaviorSettings.java Added new field and XML serialization for ignoreDamageOutput flag
megamek/src/megamek/client/bot/princess/BasicPathRanker.java Enhanced documentation and integrated ignoreDamageOutput flag in scoring
Files not reviewed (1)
  • megamek/i18n/megamek/client/messages.properties: Language not supported
Comments suppressed due to low confidence (1)

megamek/src/megamek/client/bot/princess/UtilityPathRanker.java:150

  • [nitpick] When the ignoreDamageOutput flag is enabled, both physicalDamage and firingDamage are set to 0. Please confirm that disabling both damage types is the intended behavior in all scenarios.
if (getOwner().getBehaviorSettings().isIgnoreDamageOutput()) {

@Scoppio Scoppio added Princess/AI PACAR Any Issues related to the PACAR (Princess Abstract Combat Auto Resolve) System labels Apr 28, 2025
@Scoppio Scoppio marked this pull request as draft April 28, 2025 01:57
@Scoppio Scoppio added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Apr 28, 2025
@Scoppio Scoppio marked this pull request as ready for review April 28, 2025 01:59
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 29.47368% with 67 lines in your changes missing coverage. Please review.

Project coverage is 30.23%. Comparing base (87bae74) to head (f78e49a).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
...megamek/client/bot/princess/UtilityPathRanker.java 0.00% 19 Missing ⚠️
...src/megamek/client/ui/dialogs/BotConfigDialog.java 0.00% 14 Missing ⚠️
...c/megamek/client/bot/princess/BasicPathRanker.java 13.33% 10 Missing and 3 partials ⚠️
...k/client/bot/princess/BehaviorSettingsFactory.java 65.38% 3 Missing and 6 partials ⚠️
.../megamek/client/bot/princess/BehaviorSettings.java 52.94% 6 Missing and 2 partials ⚠️
megamek/src/megamek/codeUtilities/MathUtility.java 0.00% 2 Missing ⚠️
...amek/src/megamek/client/bot/princess/Princess.java 0.00% 1 Missing ⚠️
...client/ui/swing/boardview/sprite/EntitySprite.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6944   +/-   ##
=========================================
  Coverage     30.22%   30.23%           
- Complexity    15789    15797    +8     
=========================================
  Files          2885     2885           
  Lines        283286   283333   +47     
  Branches      49335    49342    +7     
=========================================
+ Hits          85633    85661   +28     
- Misses       192052   192056    +4     
- Partials       5601     5616   +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SuperStucco
Copy link
Collaborator

The clamp01() method indicates "The value if it is inside the range given by the limits (inclusive)", but it only has one input - the value to be clamped. It should include either values to clamp between as arguments, or the JavaDoc updated to show that it is clamping between 0.0 and 1.0 (or whatever values are hard coded).

Copy link
Collaborator

@rjhancock rjhancock left a comment

Choose a reason for hiding this comment

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

Im glad to see more documentation get added in.

That being said, the nitpick CoPilot picked out is valid. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For New Dev Cycle This PR should be merged at the beginning of a dev cycle PACAR Any Issues related to the PACAR (Princess Abstract Combat Auto Resolve) System Princess/AI
Projects
None yet
3 participants