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

Issue 6303: RFE - Ultra Sublevel #6502

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

psikomonkie
Copy link
Collaborator

Another step towards #6303

It's a really deep hole from Alien Map Packs.

Map Makers, I'd recommend you'd lower the elevation some relative to its surrounding terrain - if a VTOL "lands' on the surface of an ultra sublevel, it'll be destroyed. Lower the surface below the "rim", and it'll let players hover a VTOL over the ultra sublevel, and lower then they can lower the unit's elevation to use it for cover :)

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.63%. Comparing base (d7141c8) to head (23dd5a4).
Report is 77 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6502      +/-   ##
============================================
+ Coverage     28.57%   28.63%   +0.06%     
- Complexity    14422    14457      +35     
============================================
  Files          2800     2808       +8     
  Lines        275290   276237     +947     
  Branches      48703    48826     +123     
============================================
+ Hits          78672    79110     +438     
- Misses       191941   192441     +500     
- Partials       4677     4686       +9     

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

if (entity.getPosition() != null && entity.getGame() != null && entity.getGame().getBoard() != null
&& entity.getGame().getBoard().getHex(entity.getPosition()) != null &&
entity.getGame().getBoard().getHex(entity.getPosition()).containsTerrain(Terrains.ULTRA_SUBLEVEL)) {
return; //Don't show wrecks for "Ultra Sublevels" - The unit fell through the map!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Glorious!

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.

LGTM!

Comment on lines +1373 to +1377
// Calc expected damage as ((current damage level [0 ~ 4]) / 4) *
// UNIT_DESTRUCTION_FACTOR
dmg = (unitDamageLevel / 4.0) * UNIT_DESTRUCTION_FACTOR;
logger.trace("Ending hover/VTOL movement over ultra sublevel ({}).", dmg);
return dmg;
Copy link
Collaborator

Choose a reason for hiding this comment

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

if current unit damage level is 0 then the dmg it counts is 0, I suggest juts setting return UNIT_DESTRUCTION_FACTOR

Copy link
Collaborator

Choose a reason for hiding this comment

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

if current unit damage level is 0 then the dmg it counts is 0, I suggest juts setting return UNIT_DESTRUCTION_FACTOR

We want unit damage level 0 to indicate that we expect no damage from crossing or stopping on this hex:

0/4 * UNIT_DESTRUCTION_FACTOR = expected hazard damage == 0
1/4 * UNIT_DESTRUCTION_FACTOR = expected hazard damage == UNIT_DESTRUCTION_FACTOR / 4

etc.
The goal is to let Princess drive more aggressively with fresh units, but become more cautious as damage increases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if current unit damage level is 0 then the dmg it counts is 0, I suggest juts setting return UNIT_DESTRUCTION_FACTOR

We want unit damage level 0 to indicate that we expect no damage from crossing or stopping on this hex:

0/4 * UNIT_DESTRUCTION_FACTOR = expected hazard damage == 0
1/4 * UNIT_DESTRUCTION_FACTOR = expected hazard damage == UNIT_DESTRUCTION_FACTOR / 4

etc. The goal is to let Princess drive more aggressively with fresh units, but become more cautious as damage increases.

That's the intent, yeah, this is ripped from the Magma (technically Hazardous Liquid, but that was ripped from Magma) Path Ranker logic. In this specific case it's intended just for VTOLs - a fresh VTOL should feel safe ending its turn over a death hex. But increasingly damaged ones should view it as increasingly dangerous as they get closer to being immobilized and thus risk falling victim to an instant death.

It's why they share the common bug I elude to in a comment in BasicPathRankerTest - VTOLs don't actually consider the ground below them because of some logic at the start of BasicPathRanker::checkPathForHazards - and I'd rather not touch that if I don't have to, that could have other unintended consequences.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair, I missed the (EntityMovementMode.HOVER == movingUnit.getMovementMode() || EntityMovementMode.WIGE == movingUnit.getMovementMode()) { at the top

Comment on lines +1373 to +1377
// Calc expected damage as ((current damage level [0 ~ 4]) / 4) *
// UNIT_DESTRUCTION_FACTOR
dmg = (unitDamageLevel / 4.0) * UNIT_DESTRUCTION_FACTOR;
logger.trace("Ending hover/VTOL movement over ultra sublevel ({}).", dmg);
return dmg;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair, I missed the (EntityMovementMode.HOVER == movingUnit.getMovementMode() || EntityMovementMode.WIGE == movingUnit.getMovementMode()) { at the top

@pavelbraginskiy
Copy link
Member

Map Makers, I'd recommend you'd lower the elevation some relative to its surrounding terrain - if a VTOL "lands' on the surface of an ultra sublevel, it'll be destroyed. Lower the surface below the "rim", and it'll let players hover a VTOL over the ultra sublevel, and lower then they can lower the unit's elevation to use it for cover :)

It would be great to figure out a way to make ultra sublevels be forced to be at an extremely low level, ideally somewhere near Integer.MIN_VALUE.

There's ultra depth hexes in the upcoming legendary battles maps, which should allow UMU units to submerge to any depth of their choosing, so solving ultra sublevels the "right way" now should make that easier to do later.

@psikomonkie
Copy link
Collaborator Author

Map Makers, I'd recommend you'd lower the elevation some relative to its surrounding terrain - if a VTOL "lands' on the surface of an ultra sublevel, it'll be destroyed. Lower the surface below the "rim", and it'll let players hover a VTOL over the ultra sublevel, and lower then they can lower the unit's elevation to use it for cover :)

It would be great to figure out a way to make ultra sublevels be forced to be at an extremely low level, ideally somewhere near Integer.MIN_VALUE.

There's ultra depth hexes in the upcoming legendary battles maps, which should allow UMU units to submerge to any depth of their choosing, so solving ultra sublevels the "right way" now should make that easier to do later.

That seemed more invasive than I was going for, but it did cross my mind. If y’all think it’s a good idea I’m down to implement it, either as part of this or an enhancement.

@gsparks3
Copy link
Collaborator

gsparks3 commented Feb 7, 2025

I think my only worry with that would be switching to isometric view causing ... issues. Not necessarily a blocker, but worth considering.

@Sleet01 Sleet01 merged commit 292bf50 into MegaMek:master Feb 7, 2025
7 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.

5 participants