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

Updated StratCon Sector Sizes & Added Persistent OpFor #5230

Closed
wants to merge 19 commits into from

Conversation

IllianiCBT
Copy link
Collaborator

We have a lot of plans for StratCon in 2025, so consider this an early Christmas present.

This PR updates the size of StratCon Sectors (Tracks) to be tied to the size of the planet, rather than the number of lances required by the contract.

We also do some under-the-hood changes and expansions to the utility methods used to add scenarios to StratCon maps. These were lifted from the upcoming Logistics Module. A bunch of additional null safeguards were put in place, too. So, hopefully, there shouldn't be any major issues.

Finally, I have implemented a persistent OpFor. Now, when you arrive on contract each Sector is pre-seeded with enemy forces. These forces will explore the StratCon map, engaging your forces and facilities. When defeated, each pre-seeded force is permanently removed, though there is the chance that new enemy forces will be redirected into your AO to counter your advance - based on Morale.

Speaking of Morale, while still based on a dice roll, morale is significantly impacted by the number of enemy forces exploring your AO. So you want to make sure to get rid of them quick!

You will still face weekly scenarios as normal.

Scouting no longer spawns enemy forces, so an area already cleared will stay cleared (barring new forces entering the area).

Hype aside, this is a very basic implementation and one designed to be expanded on throughout 2025. Right now enemy forces blindly bumble about the AO until they hit something. The next step will be adding a heat map.

Added the calculation of planetary diameter to the initialization of StratconTrackState. This allows the track size to be set proportionally based on the planet's surface area, ensuring more realistic and varied gameplay environments.
Added null checks throughout Stratcon scenario generation methods to handle potential null scenarios. Created new methods and updated existing ones to ensure robust error handling and to return null if scenario creation fails.
Implemented a `getSize` method to calculate the track size based on width and height. This change enhances the functionality by providing a straightforward way to retrieve the total size of the track. Additionally, minor formatting adjustments were made for code consistency.
Added logic to seed sectors with hidden forces based on contract type in StratconContractInitializer. Differentiated scenario creation between garrison, raid, pirate hunting, and planetary assault contracts.
Modified contract generation to prevent full-scale invasions for pirate hunting contracts. Adjusted multiplier settings to treat guerrilla warfare similarly to raid types. These changes enhance the accuracy and realism of mission deployment scenarios.
Removed redundant scenario generation checks and refactored pre-deployment probability calculations. Simplified conditionals in StratconRulesManager, and integrated scenario odds computation into StratconContractInitializer. This enhances code clarity and consistency in scenario management.
Modified scenario generation to include an option for allowing scenarios to spawn on top of player-allied facilities. Updated function signatures and added logic to accommodate this new parameter, ensuring that scenarios can now be placed more flexibly based on provided configurations.
Refactored the calculation of scenario odds for better readability and maintainability. Also added a new method to handle daily movement processing for scenarios in each track. Expanded pre-deployment logic and cleaned up code to enhance functionality.
Updated the copyright years to 2024 and revised the license information for consistency and accuracy. This ensures the codebase reflects the correct legal information and adheres to the project's licensing guidelines.
Changed the visibility of the seedPreDeployedForces method to private and added a detailed Javadoc comment explaining its functionality. Removed redundant comments from the initializeTrackState method to improve code readability.
Made `seedPreDeployedForces` method public to allow seeding of pre-deployed forces in StratCon tracks. Also added logic to handle pre-deployment for garrison and pirate hunting contract types.
@IllianiCBT IllianiCBT added the StratCon Bugs relating strictly to StratCon label Nov 21, 2024
@IllianiCBT IllianiCBT self-assigned this Nov 21, 2024
Collections.shuffle(suitableCoords);

if (suitableCoords.isEmpty()) {
return null;

Check warning

Code scanning / CodeQL

Random used only once Warning

Random object created and used only once.
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.49%. Comparing base (bce5f63) to head (626a527).
Report is 51 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5230      +/-   ##
============================================
- Coverage     10.52%   10.49%   -0.03%     
+ Complexity     6047     6041       -6     
============================================
  Files           957      957              
  Lines        134523   134760     +237     
  Branches      19545    19620      +75     
============================================
- Hits          14154    14147       -7     
- Misses       119018   119256     +238     
- Partials       1351     1357       +6     

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


🚨 Try these New Features:

PreSeeded enemy force count is now based on enemy quality and faction.
Introduced a new method, `processMassRout`, in `StratconRulesManager` to handle scenarios without deployment dates. Integrated this method into `AtBContract` to ensure these scenarios are removed and updated appropriately.
Ensured that mass rout processing in AtBContract only occurs when StratCon is enabled in campaign options. This change prevents unnecessary operations and aligns with the intended functionality of user-defined campaign options.
@IllianiCBT
Copy link
Collaborator Author

IllianiCBT commented Nov 21, 2024

For anyone curious:

The number of enemy forces spawned is based on enemy faction, quality, and contract type.

We start with a baseline value determined by enemy faction: A Clan Cluster (11 Stars), an IS Battalion (14 Lances), or a ComStar Level IV (18 Level IIs). Note that these values have all been reduced by half. At a later date we plan to have friendly forces appear in the AO too, at which point this artificial reduction will be removed.

We then consult the following table:
Quality F = 0.25
Quality D = 0.5
Quality C = 0.75
Quality B = 1.0
Quality A = 1.5
Quality A* = 2.0

We adjust this value by the contract type:
Pirate Hunting = 0.5
Garrison Type = 0.5 (Garrison Duty, Cadre Duty, Security Duty, Riot Duty)
Offensive = 1.0 (Diversionary Raid, Objective Raid, Recon Raid, Extraction Raid, Guerrilla Warfare)
Planetary Assault = 2.0

These values are then used as a modifier to adjust the initial value (rounded up)

Example A
Commander Romanova is deploying for a contract against Clan Ghost Bear. The information provided by her employer rates the enemy forces as C and the contract is categorized as an Objective Raid.

That means Commander Romanova can expect Clan Ghost Bear to deploy 9 forces of varying sizes (11 * 0.75). This might seem like a lot, but it's important to note that these forces do not all need to be fought, and certainly not all at the same time.

Example B
Commander Steve Rogers is deploying for a contract against the Draconis Combine. The information provided by his employer rates the enemy forces as B and the contract is categorized as Garrison Duty.

That means Commander Rogers can expect the DCMS to deploy 14 forces of varying sizes (14 * (1 * 1)).

Example C
Star Colonel Fury is deploying for a mission against Clan Wolf. The information provided by the Clan Watch rates the enemy forces as A and the mission is categorized as Planetary Assault.

That means Star Colonel Fury can expect Clan Wolf to deploy 54 forces of varying sizes (18 * (1.5 * 2)). This is going to be a tough fight!

Updated isOffensive method to include planetary assaults, modified processMassRout to streamline parameters, and adjusted seeding logic with revised multipliers. This enhances the clarity and efficiency of the StratCon campaign state management and scenario processing.
Modified `getUnoccupiedAdjacentCoords` method to include an optional boolean parameter `weightPlayerForces` which prioritizes player-allied forces and facilities when determining suitable adjacent coordinates. Updated `StratconRulesManager` to leverage this new parameter for enhanced scenario deployment logic.
Updated the condition to exclude strategic objectives when checking for null deployment dates in scenarios. This ensures that only relevant scenarios get new coordinates, preventing strategic objectives from being relocated erroneously.
@Dark-Hobbit
Copy link

Shouldn't example B be 7 forces because it's a Garrison Duty? (14 * (1 * 0.5))

@IllianiCBT
Copy link
Collaborator Author

Yes

Improved the morale calculation and routing logic when handling contracts, especially garrison duties. Updated methods to factor in enemy skill, weapon reliability, and included a more sophisticated approach to determining balance of power. Minor refactoring was also done for code clarity and efficiency.
@IllianiCBT
Copy link
Collaborator Author

Pushed an update to fill in a couple of holes:

  • Morale has been updated to offer a more consistent experience. In particular, we want clearing out enemy forces from Sectors to have an impact on morale
  • Garrison contracts no longer feel like a constant planetary invasion.

Closes #4565

@IllianiCBT IllianiCBT closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants