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

Princess - enhanced anti-Mech targeting #5602

Merged

Conversation

SuperStucco
Copy link
Collaborator

This PR enables Princess to take aimed shots and, if the option is enabled, use TacOps called shots. This will mostly come into play late in a game as Princess starts to take advantage of Mechs that have reduced or no armor in some locations although skilled units that mount a targeting computer and powerful ranged weapons may start taking immediate advantage to 'thin the herd'.

  • All ground units, including VTOLs and gun emplacements, will use this. Fixed wing aircraft and large craft are excluded (they have enough firepower as-is). Blue water naval is also excluded as Mechs in littoral areas are frequently waist-deep in water/under partial cover or fully submerged.
  • Only Mechs are considered as valid targets. Ground vehicles are vulnerable enough, VTOLs have high to-hit numbers under most conditions, and it's generally good enough to simply hit fixed wing aircraft.
  • Enhanced targeting is not used against Mechs with partial cover.
  • Immobile Mechs are targeted with aimed shots using weapons that can do so, and standard attacks for the rest. Called shots are ignored to avoid turning long term campaign pilots into pudding by calling every shot high.
  • Only conventional infantry and battle armor will take aimed shots at the head against immobile Mechs, for the same reason.
  • Attackers with a targeting computer may attempt aimed shots at active Mechs provided the resulting target number is low enough and they can do enough damage to the selected body location.
  • Aimed shots prioritize torso and leg locations that have low/no armor, plus arms if they have a major weapon. When they cannot do enough damage to the target body location they may try for called shots instead.
  • Attackers without a targeting computer, and those with weapons that cannot make aimed shots, may make use of TacOps called shots if the option is enabled. Shots from the sides will be adjusted to enter the rear arc, while shots from the front or rear will be called high or low, depending on armor conditions.
  • Use of enhanced targeting is controlled by the Self Preservation setting for Princess. The further to the left, the more it will take long-odds aimed or called shots; the further to the right, the more conservative it will be. Despite the name, this setting is used for a number of similar aggression-related features, such as how much heat it will build up or how high a target number is before an attack is considered not effective.

There is one point to note in the code - the setting of a called shot is entirely set up for the single-button toggle-through system for human players. A TODO has been left to indicate where it would be better to have a single send notification deliver the called shot setting rather than sending the change notification multiple times to toggle through.

SuperStucco added 30 commits June 16, 2024 15:37
…s against immobile targets will exclude the possibility of called shots for balance purposes.
@SuperStucco
Copy link
Collaborator Author

Given that this is a fairly extensive update to Princess's behaviours, and contains a number of preconceptions about aimed-/called-shot "best practice", I'd ask that this be gated behind a Princess config option that is set to "off" by default, at least for the first iteration.

I have zero idea how to add UI stuff. Lets keep this to climbing one small Matterhorn at a time...

It's also not that far off what was originally put in for ye olde TestBot back in the day, just a little more elegant and less brute force.

@Sleet01
Copy link
Collaborator

Sleet01 commented Jun 21, 2024

Given that this is a fairly extensive update to Princess's behaviours, and contains a number of preconceptions about aimed-/called-shot "best practice", I'd ask that this be gated behind a Princess config option that is set to "off" by default, at least for the first iteration.

I have zero idea how to add UI stuff. Lets keep this to climbing one small Matterhorn at a time...

It's also not that far off what was originally put in for ye olde TestBot back in the day, just a little more elegant and less brute force.

The Java UI stuff is embarrassingly simple and straightforward, it's mostly just a lot of stultifying boilerplate.
But I fully understand wanting to stay away from it ^_^

@IllianiCBT IllianiCBT added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Jun 21, 2024
…argeting

# Conflicts:
#	megamek/src/megamek/client/bot/princess/Princess.java
Copy link

codecov bot commented Jun 22, 2024

Codecov Report

Attention: Patch coverage is 4.88599% with 292 lines in your changes missing coverage. Please review.

Project coverage is 29.28%. Comparing base (6cda321) to head (4a1db55).
Report is 26 commits behind head on master.

Current head 4a1db55 differs from pull request most recent head e2084be

Please upload reports for the commit e2084be to get more accurate results.

Files Patch % Lines
...amek/src/megamek/client/bot/princess/Princess.java 4.93% 289 Missing ⚠️
megamek/src/megamek/common/CalledShot.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5602      +/-   ##
============================================
- Coverage     29.31%   29.28%   -0.03%     
  Complexity    13803    13803              
============================================
  Files          2461     2461              
  Lines        262667   262977     +310     
  Branches      47006    47118     +112     
============================================
+ Hits          77007    77024      +17     
- Misses       181803   182095     +292     
- Partials       3857     3858       +1     

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

@SuperStucco
Copy link
Collaborator Author

Big push from working on the last couple of requests.

Most of the code has been pulled out of the host method and into various other methods. In the process the target/attacker type limits have been slightly rewired, while there isn't any new ability to handle selecting aim locations or called shot directions for non-Mech targets it is now much easier to add them later.

I've plumbed in a lot of system controls, including an overall on/off switch, with the defaults matching the original PR specs. That should make it easier if someone chooses to wire them into a UI at some future point.

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

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

Just one minor typo in a comment, otherwise looks good. Looking forward to trying it out!

@HammerGS HammerGS removed the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Jun 30, 2024
@HammerGS HammerGS merged commit d785b5d into MegaMek:master Jun 30, 2024
4 checks passed
HammerGS added a commit that referenced this pull request Jun 30, 2024
+ PR #5652: Fix ammo carrier issue that prevents Princess from firing ammo-based weapons
+ PR #5602: Princess - enhanced anti-Mech targeting
+ PR #5592: Cleanup and disentangle (TilesetManager, Client, BoardView)
+ PR #5591: Only consider MM internal dirs when creating the official unit list
+ PR #5570: ScenarioV2 extension, sky map
@SuperStucco SuperStucco deleted the Princess-enhanced-antiMech-targeting branch July 18, 2024 01:27
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.

6 participants