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

Fix 5870: princess engaging targets outside visual range in heavy fog #6457

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jan 29, 2025

Please see #5870 for analysis of the root cause.

This fix lets Princess use knowledge of the current visual range when guessing at attack effectiveness for movement planning.

It also removes the ability for C3-equipped units to completely bypass LOS restrictions as long as one C3 network member has a target within their sensor ranges.
Based on forum posts and TacOps, it looks like at least one member of the network needs to have visual LOS, including any Planetary Conditions that restrict visual range, for the network to provide targeting capabilities to its members. Otherwise it's just sharing the already-detected sensor pings.

Testing:

  • Tested scenario from the linked issue repeatedly, with and without fixes.
  • Ran all 3 projects' unit tests.
  • Updated FireControlTest to provide the necessary planetary environment data that Princess now checks.

Close #5870

@Sleet01 Sleet01 requested a review from rjhancock January 29, 2025 10:24
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.59%. Comparing base (66ad241) to head (54e363b).
Report is 8 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6457      +/-   ##
============================================
- Coverage     28.59%   28.59%   -0.01%     
  Complexity    14377    14377              
============================================
  Files          2798     2798              
  Lines        274872   274895      +23     
  Branches      48626    48630       +4     
============================================
+ Hits          78592    78593       +1     
- Misses       191649   191669      +20     
- Partials       4631     4633       +2     

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

Copy link
Collaborator

@psikomonkie psikomonkie left a comment

Choose a reason for hiding this comment

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

Nice!! I think someone will at some point want to add low-vis conditions this to Princess's fire control unit tests (I like double blind so I might).

Re: C3 & WAA changes: I was thinking of expanding the WAA JUnit tests I added last week during 50.04 if it really is a “stability” release - covering C3 in the manner you described would be a good test to add.

@@ -305,6 +306,11 @@ ToHitData guessToHitModifierHelperForAnyAttack(final Entity shooter,
return new ToHitData(TH_RNG_TOO_FAR);
}

final int maxVisRange = game.getPlanetaryConditions().getVisualRange(shooter, shooter.isUsingSearchlight());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will Princess still be able to consider Entities illuminated by a different source as valid - like a different Mek with a searchlight illuminating the enemy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

She will, but for the fast approximation path she's only going to consider the current unit's searchlight state and any cached illumination state on target units.

This path is used when planning where to move a unit, not just for the moving unit but for predicting the likely actions of all known enemies and allies as well.
So I wanted to add the planetary environment check but keep it as minimal as possible to avoid introducing a big slowdown.

The attack planning code switches to using the same to-hit calc code as player sees when using the GUI; there should be fewer options at that point, so it's fast enough.
And that contains the full illumination check code.

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.

Looks clean.

@Sleet01 Sleet01 merged commit 189f5bb into MegaMek:master Jan 29, 2025
6 checks passed
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.

[0.50.0-SNAPSHOT] Princess engaging targets outside of visual range in heavy fog.
3 participants