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

Reworked Scenarios and Scenario Modifiers, Tied Civilian Units to Campaign Era #4928

Merged
merged 23 commits into from
Oct 2, 2024

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Sep 28, 2024

This PR is one I've been wanting to work on for a while, but haven't found the time. It goes through and rebalances scenario objectives across the board, taking a more holistic view of scenario objectives to prevent some of the weird behavior and objective bloat we've seen over the years.

I went through and rejigged the two scenario objectives that weren't tracked by mhq: Recon and Extract. Now for 'recon' you need to conduct the battle for a certain amount of time against an overwhelming enemy force. To represent the time taken to scan the battlefield or some such. For Extract, if the buildings are intact at the end of the scenario you'll get a Support Point.

I also went through and rebalanced our battery of scenario modifiers. Only one was removed (Search and Rescue, as that cannot be tracked in mhq). My goal here was to better balance the modifiers between each other.

Finally, I renamed and re-jigged the descriptions for the various scenarios types to make them feel less sterile. I also added a handful of new scenarios. It's my hope that this will make things feel fresher, even if the actual scenarios themselves haven't changed that much.


Moving away from scenarios and modifiers, and onto contract command levels.

I wanted to make playing under House, Independent, Integrated, and Liaison command levels to feel different.

House: You will deploy with an allied force roughly the same size as your force. This represents your employer assigning joint forces to ensure objectives are completed. The idea here is that your employer has employed you to supplement their forces, to achieve objectives neither you nor they could complete alone.

Integrated: You will deploy with a large allied force. This represents you being integrated into your employers' wider organization. You are a cog in their machine.

Liaison: Your employer assigns you a liaison, whose job is to monitor your activities to ensure your employers' goals are met. To ensure this happens they will deploy a forward observer to keep an eye on you in the field. That liaison will always be in a heavy or assault unit. Apparently the employers of the Inner Sphere have gotten fed up with their liaisons getting shot out of the Locusts they all seemed to love so much.

Independent: You're on your own. Good luck, Commander.


I went in and used functionality added by @SuperStucco (back in #4418) to remove the old fixed Civilian tables. Now we take advantage of unit roles to generate convoys and civilian units based on unit type and role.

I also added some fallback values to better catch units that failed to generate. Generally this will mean the unit generates as a tank (for ground scenarios), or Civilian DropShip (for DropShip scenarios). So while the unit might not be the type expected, it should better avoid instances where we generate empty forces. It can't completely remove the chance, but it should at least reduce the likelihood. As we find more holes in the system we can add additional checks and balances. This isn't meant to completely remove the issue, just to mitigate it.

Closes #1416 && #4925 && #4850 && #4877 && #4927

Modified the detailed briefing text for "Engage" and "Engage - Heavy" scenarios to include destroying 75% of the opposing force.
Renamed multiple scenarios to better reflect their missions and objectives. Adjusted success and failure effects, added new objectives focusing on preserving forces, and corrected weight classes for balanced gameplay.
Renamed scenario template files for consistency and clarity. Updated "contributesToBV" and "generationMethod" fields, and added new objectives to "Assassinate - Heavy Escort" and "Assassinate - Frontier" scenarios.
Removed outdated scenario templates, including "Allied Facility" and "Recon." Updated names and descriptions for existing templates to improve clarity and match current mission objectives. Improved detailed briefings for better mission guidance.
Revised scenario names for clarity and consistency, including renaming "Designated Target" to "VIP" in various XML files. Added new scenarios to contract definitions to diversify objectives. These changes aim to improve readability and maintainability of the game’s contract and scenario structure.
Revised the scenario template file to streamline and rename scenario entries. The updated entries provide clearer scenario descriptions and simplify future maintenance. This change aims to improve readability and consistency across the scenario manifest.
Updated various mission files to modify win conditions from 100% to 75% destruction or preservation thresholds. Simplified success and failure effect specifications and streamlined objective descriptions for clarity.
Removed `SearchAndRescue.xml` and updated multiple scenario modifiers to contribute to BV and unit count. Simplified briefing texts for `IntegratedAllies` and `LiaisonAir` while adjusting various configuration parameters.
@@ -1,5 +1,5 @@
<AtBScenarioModifier>
<additionalBriefingText>Preserve 50% of the designated turrets.</additionalBriefingText>
<additionalBriefingText>Preserve 25% of the designated turrets.</additionalBriefingText>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change was to hold base defenses to a similar standard as base assaults. Previously, players were required to keep 50% of the base turrets alive, while they were required to kill 75-100% to destroy an enemy base.

<startingAltitude>5</startingAltitude>
<objectiveLinkedForces>
<objectiveLinkedForce>Player</objectiveLinkedForce>
</objectiveLinkedForces>
<syncDeploymentType>SameEdge</syncDeploymentType>
<syncedForceName>Player</syncedForceName>
<useArtillery>false</useArtillery>
</forceDefinition>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're removing the various House Officer, Liaison, and Integrated Allies objectives and instead just having them hook into whatever the players' force objective is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You'll see a lot of 'This file was deleted' this is the sole instance where I deleted something, the rest were all renamed.

Adjusted various scenario modifier XML files to ensure that certain forces no longer contribute to Battle Value (BV) and unit count metrics. This change involved setting `<contributesToBV>` and `<contributesToUnitCount>` to `false` in relevant files. Additionally, modified the minimum weight class and enabled map size contributions for certain scenarios.
Standardized the casing for "OpFor" across various scenario template XML files to maintain consistency and improve readability. This change impacts multiple templates, including "Minor Engagement" and "Isolated DropShip Defense."
@IllianiCBT IllianiCBT marked this pull request as ready for review September 28, 2024 05:22
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.45%. Comparing base (90ea1b7) to head (d29b836).
Report is 39 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4928      +/-   ##
============================================
+ Coverage     10.44%   10.45%   +0.01%     
- Complexity     5998     6012      +14     
============================================
  Files           951      951              
  Lines        132874   132924      +50     
  Branches      19329    19348      +19     
============================================
+ Hits          13873    13893      +20     
- Misses       117653   117687      +34     
+ Partials       1348     1344       -4     

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

Updated various scenario template XML files by renaming 'Primary OpFor' to 'OpFor' for consistency and clarity. Also made minor brief description adjustments and renamed other entities like 'Escorted DropShip' to 'DropShip' in relevant templates.
Removed unnecessary convoy escort scenarios from ExtractionRaid.xml and added 'Deep Raid' to ObjectiveRaid.xml. Introduced a new scenario template for VIP Defense. Updated various contract definitions to include new and relevant scenarios.
@IllianiCBT IllianiCBT marked this pull request as draft September 28, 2024 15:47
Removed unnecessary convoy escort scenarios from ExtractionRaid.xml and added 'Deep Raid' to ObjectiveRaid.xml. Introduced a new scenario template for VIP Defense. Updated various contract definitions to include new and relevant scenarios.
Added exception handling for the alignment check of linked forces in ScenarioObjective. This will make troubleshooting easier if I mucked up the name changes somewhere.
Commented out scenario modifiers not suitable for all eras in `modifiermanifest.xml` to prevent inconsistencies. Added explanatory comments to indicate the reasons for their deactivation.
Changed the generation method from 4 to 3 for DropShip in three scenario templates: Isolated DropShip Defense, Low-Atmosphere DropShip Escort, and Space Blockade Run. This adjustment ensures consistency in DropShip generation across various scenarios.
Updated all instances of 'Base Turrets' to 'Base Defenses' to ensure consistency across scenario modifiers and template files. This change aligns the terminology with current design standards and improves clarity for future development and maintenance.
Adjusted the forceMultiplier from 1.0 to 0.5 in both the "Convoy Escort" and "Convoy Raid" scenario templates. This change ensures that convoy forces are more balanced and less overwhelming during these missions.
Included various force roles like MEK_CARRIER, ASF_CARRIER, VEE_CARRIER, INFANTRY_CARRIER, TROOP_CARRIER, and CIVILIAN in several DropShip scenario templates. This enhances scenario flexibility and allows for more diverse unit deployment.
Duplicated MEK_CARRIER entries were added across multiple XML files in scenario templates, which may be an error. Additionally, modified forceName attributes in some scenario modifiers and expanded roleChoices to include new roles like TROOP_CARRIER and CIVILIAN.
Adjusted convoy-related scenario templates to allow and define special civilian unit types and roles. Modified scenario generation code to handle civilians and ensure correct unit selection and fallback mechanisms.
@IllianiCBT IllianiCBT self-assigned this Sep 28, 2024
actualUnitType = UnitType.TANK;
// Mixed units randomly select between Mek or ground vehicle
} else {
for (int x = 0; x < unitCount; x++) {

Check warning

Code scanning / CodeQL

Constant loop condition Warning

Loop
might not terminate, as this loop condition is constant within the loop.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it isn't

Collection<MissionRole> roles;

if (rolesByType != null) {
roles = rolesByType.getOrDefault(unitTypes.get(i), new ArrayList<>());

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
rolesByType
may be null at this access as suggested by
this
null guard.
Variable
rolesByType
may be null at this access because of
this
null argument.
Variable
rolesByType
may be null at this access because of this null argument.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's literally checked the line above, silly bot

@IllianiCBT
Copy link
Collaborator Author

Flipping this to live. Description has been updated accordingly.

@IllianiCBT IllianiCBT marked this pull request as ready for review September 28, 2024 19:22
Updated the force definitions in the XML files to include various role choices like CIVILIAN, CARGO, SUPPORT, and APC. This ensures more detailed and flexible scenario configurations for both hostile and allied facility evacuation scenarios, as well as in irregular force suppression and assault scenarios.
@IllianiCBT IllianiCBT changed the title Reworked Scenarios and Scenario Modifiers Reworked Scenarios and Scenario Modifiers, Tied Civilian Units to Campaign Era Sep 28, 2024
Copy link
Member

@HammerGS HammerGS left a comment

Choose a reason for hiding this comment

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

Approved.

@HammerGS HammerGS merged commit 935c1c9 into MegaMek:master Oct 2, 2024
4 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.

Create Era-appropriate Civilian Mech RATs
3 participants