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

Linked StratCon OpFor Generation to AtB Difficulty Options, Added OpFor Generation Balance Checks #4029

Closed
wants to merge 14 commits into from

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Apr 24, 2024

Current Implementation

StratCon generates opposing forces based on player force Battle Value (BV), ensuring a minimum percentage based on Unit Rating and a unit allowance (based on lances or regional equivalents). If the generated force exceeds the unit allowance, StratCon trims it down until it falls within the allowance.

The current system assumes that player-deployed units are roughly equivalent in value to those generated by StratCon. However, the minimum BV percentage, ranging from 50-100% based on company rating, often results in opposing forces surpassing the player's BV. Additionally, StratCon only adjusts the OpFor unit count if it exceeds the unit allowance, not the BV allowance, leading to challenges with Clan OpFor encounters.

Moreover, the lack of utilization of the "Against the Bot" (AtB) difficulty option means players have no control over the size of opposing forces they face. This issue is compounded by the absence of tools to mitigate the frequency of facing multiple opposing forces due to Scenario modifiers.

Solutions

1. BV Allowance Adjustment: Tying StratCon's BV allowance to the AtB difficulty option introduces scalability.

2. BV Minimum Reduction: Reducing BV minimums with a bell curve ensures more varied opposing forces while preventing campaigns at higher company ratings from becoming overly challenging.

3. Random Unit Trimming: Introducing a step to randomly remove units ensures opposing forces remain balanced and within a reasonable margin above the BV allowance (125%).

Campaign Option Customization

In Campaign Options, three new options have been introduced to enhance control over scenario modifiers:

image

1. Maximum: This option determines the maximum number of random Scenario Mods that can be added to a scenario. Note that fixed modifiers, such as those from StratCon Facilities, remain unaffected by this option.

2. Chance: The Chance option represents the percentile chance of a scenario having a random modifier. If a random modifier is rolled, the system will attempt to roll another. This process continues until the system fails to roll a modifier or the maximum number of modifiers is reached.

3. BV Cap: The BV Cap option sets the BV Allowance for Scenario Modifiers to the specified percentage. Additionally, a new Scenario Modifier tag (overrideBvCap) has been introduced to override this setting where appropriate. If a scenario modifier overrides the BV Cap, a message is printed to mekhq.log to assist in troubleshooting, particularly if users believe their opposing forces are being over-BV'd.

Closes

closes #4011
closes #4028

@IllianiCBT IllianiCBT marked this pull request as draft April 25, 2024 00:07
…sers to adjust their maximum number, appearance chance, and BV Cap values.
The function `setScenarioModifiers` and the method `generateForce` were updated. The former was adjusted to use a random number within a provided range, instead of a hardcoded value, when setting scenario modifiers. The latter was altered to use a boolean parameter, `isScenarioModifier`, allowing the method to distinguish if the force generation is triggered by a scenario modifier or not.
Changes mainly involve modifying whether a component contributes to the map size or battle value (BV), and also includes the addition of an override BV cap in some scenarios.
The BV Cap override check has been inverted in AtBDynamicScenarioFactory to handle cases where the scenario modifier is present. Now, when the override is true, a log message is printed and the BV budget is modified accordingly. This is intended to provide better logging and managing of BV Cap overrides.
This commit eliminates the possibility of an infinite loop when adding modifiers in the AtBDynamicScenarioFactory class. This is achieved by setting the 'addMods' flag to false when the conditional statement isn't met.
@IllianiCBT IllianiCBT self-assigned this Apr 25, 2024
@IllianiCBT IllianiCBT added (RFE) Enhancement Requests for Enhancement, new features or implementations AtB StratCon Bugs relating strictly to StratCon labels Apr 25, 2024
@IllianiCBT IllianiCBT marked this pull request as ready for review April 25, 2024 05:58
@IllianiCBT
Copy link
Collaborator Author

This ended up snowballing in feature creep far beyond my original intent. However, I think people will be far happier with this more comprehensive approach. Description has been updated to reflect all changes.

@IllianiCBT IllianiCBT changed the title Tied StratCon OpFor Generation to AtB Options & Added Generation Balance Checks Linked StratCon OpFor Generation to AtB Difficulty Options, Added OpFor Generation Balance Checks, Adjusted Scenario Modifiers for A More Balanced Experience Apr 25, 2024
@Thom293
Copy link
Contributor

Thom293 commented Apr 25, 2024

I would love a chance to comment on this before it is merged.

Some of these are necessary. But I at least would like the opportunity to discuss some of the others first. Thank you.

@Thom293
Copy link
Contributor

Thom293 commented Apr 25, 2024

So, if I understand this, and I may not, I would like to suggest removing all of the changes but the modifier cap and the difficulty setting fix. And the bug fix that removes an extra line from some of the modifiers.

The cap/bv% setting changes allow people that wish to to change the game difficulty. To make it easier or harder. This is fair and allows a customizable experience for everyone. But The other changes are foundational and uncustomizabile and change difficulty to easier for everyone, and not everyone wants that.

I personally like the way SC already does things. I like big battles. I like being outnumbered. I like multiple modifiers. The other changes here reduce bv caps for everyone and put a "unit remover" governor in place for everyone. I like how it sometimes uses one modifier to increase caps and pile on and make a bigger battle. I personally do not think that there is a problem with BV caps or Unit numbers.

So that would be my request. If capping modifiers at 1 and changing bv% to (a working) 80% are not easy enough then some of these could perhaps being readded later. Thank you.

@RaozSpaz
Copy link

So, if I understand this, and I may not, I would like to suggest removing all of the changes but the modifier cap and the difficulty setting fix. And the bug fix that removes an extra line from some of the modifiers.

The cap/bv% setting changes allow people that wish to to change the game difficulty. To make it easier or harder. This is fair and allows a customizable experience for everyone. But The other changes are foundational and uncustomizabile and change difficulty to easier for everyone, and not everyone wants that.

I personally like the way SC already does things. I like big battles. I like being outnumbered. I like multiple modifiers. The other changes here reduce bv caps for everyone and put a "unit remover" governor in place for everyone. I like how it sometimes uses one modifier to increase caps and pile on and make a bigger battle. I personally do not think that there is a problem with BV caps or Unit numbers.

So that would be my request. If capping modifiers at 1 and changing bv% to (a working) 80% are not easy enough then some of these could perhaps being readded later. Thank you.

I believe the changes they made make it to where the modifiers are limited based on total BV but are still in addition to the baseline forces. Most of the scenario changes change the 'effects BV' flag to false. Meaning they happen in addition to baseline BV, they are just now based on the baseline forces.

@IllianiCBT Looks like you went through and flipped them all though and some of them are now true. I do believe they should all be false. Whilst they should be based on the main BV, I do think they should all be in addition to it. Even with how much I hate having multiple mods spawn on a mission ruining my day.

@Thom293
Copy link
Contributor

Thom293 commented Apr 25, 2024

In my opinion a (customizable) up to 66% reduction in modifiers and a 20% reduction in enemy BV should be ample options to test in a new build before ALSO changing universal settings for everything else related to BV to make it less challenging (and uncustomizable).

@IllianiCBT
Copy link
Collaborator Author

In my opinion a (customizable) up to 66% reduction in modifiers and a 20% reduction in enemy BV should be ample options to test in a new build before ALSO changing universal settings for everything else related to BV to make it less challenging (and uncustomizable).

So I can address your concerns properly, what specific changes are you not in favor of? :)

@IllianiCBT
Copy link
Collaborator Author

@IllianiCBT Looks like you went through and flipped them all though and some of them are now true. I do believe they should all be false. Whilst they should be based on the main BV, I do think they should all be in addition to it. Even with how much I hate having multiple mods spawn on a mission ruining my day.

Can you use the code review function to show me exactly which have been flipped to true? I know of at least one that needs to remain true for it to function correctly

@RaozSpaz
Copy link

Can you use the code review function to show me exactly which have been flipped to true? I know of at least one that needs to remain true for it to function correctly

Nvm. Looks like the ones that I saw that were true were for contributing to map size.

@IllianiCBT IllianiCBT marked this pull request as draft April 25, 2024 22:01
@Thom293
Copy link
Contributor

Thom293 commented May 27, 2024

In my opinion a (customizable) up to 66% reduction in modifiers and a 20% reduction in enemy BV should be ample options to test in a new build before ALSO changing universal settings for everything else related to BV to make it less challenging (and uncustomizable).

So I can address your concerns properly, what specific changes are you not in favor of? :)

I was coming to post something else, and saw that I had not responded to this. I apologize.

In my opinion, the changes should start simply first. Then if they are not enough, then add the other features that you came up with. But the features that I think should be added (and were always intended according to the stratcon dev notes) are:

  1. A working bv% difficulty slider.
  2. A customizable number of modifers.

Then if the things-that-were-always-supposed-to-work-but-did-not additions are not enough to fix the balance issues, then can change the underlying guts. My objection to the guts changes is that the above changes are customizable, but the guts changes are not. Thus I think it is better to start with the completely customizable ones first. A 66% reduction (max 3 to max 1) in maximum modifiers and 20% bv reduction (difference between normal and recruit) should hopefully solve most issues. (Also the ratio reccomendation we discussed earlier).

But here is what I was coming to post: You were able to modify the "random" modifier number. But facility modifiers are unaffected. If you want to also influence facility modifiers, then making this number below customizable with change the % chance for an undiscovered facility to apply its modifier to a battle. Might be an option worth adding as a another knob to influence difficulty without changing the guts, if you like.

Thank you for listening to my concerns. I appreiciate it.

image

@IllianiCBT IllianiCBT changed the title Linked StratCon OpFor Generation to AtB Difficulty Options, Added OpFor Generation Balance Checks, Adjusted Scenario Modifiers for A More Balanced Experience Linked StratCon OpFor Generation to AtB Difficulty Options, Added OpFor Generation Balance Checks Jun 3, 2024
- Increased acceptable forceBV to 125% of forceBVBudget from 110%
@IllianiCBT IllianiCBT marked this pull request as ready for review June 3, 2024 03:48
@IllianiCBT
Copy link
Collaborator Author

Flipping the switch on this. I've made a couple of modifications, since this was last live:

  • I increased the BV threshold, now mhq will not start trimming units until an individual OpFor force is 125% over its' BV allowance. Originally this was 110%. I could have campaign option'd this, but chose not to as (by tying StratCon difficulty to AtB difficulty) players already have a way to influence OpFor BV allowance. Being able to effectively choose between easy, medium, or hard (and everything between) is a lot more user friendly than manually adjusting a Double.

  • I removed my scenario modifier edits. A few edits I chose to keep, but they were included in a separate PR.

While I believe there was some movement on switching to a different force generation method, I'm not entirely certain of the progress being made there, so this is intended as a stop-gap, in case the replacement isn't ready in time for 49.20.

@IllianiCBT IllianiCBT added UX User experience and removed AtB labels Jun 3, 2024
@IllianiCBT
Copy link
Collaborator Author

@Thom293 I think I addressed your concerns, however if there is anything you're worried about lemme know. :)

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 12.03704% with 95 lines in your changes are missing coverage. Please review.

Project coverage is 10.28%. Comparing base (64390e3) to head (3c9c62b).
Report is 48 commits behind head on master.

Files Patch % Lines
MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java 0.00% 52 Missing ⚠️
...hq/campaign/mission/AtBDynamicScenarioFactory.java 3.57% 27 Missing ⚠️
MekHQ/src/mekhq/campaign/CampaignOptions.java 42.85% 12 Missing ⚠️
.../mekhq/campaign/mission/ScenarioForceTemplate.java 50.00% 3 Missing ⚠️
.../mekhq/campaign/stratcon/StratconRulesManager.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             master    #4029    +/-   ##
==========================================
  Coverage     10.28%   10.28%            
- Complexity     5732     5739     +7     
==========================================
  Files           913      914     +1     
  Lines        123696   123965   +269     
  Branches      18390    18418    +28     
==========================================
+ Hits          12720    12752    +32     
- Misses       109710   109946   +236     
- Partials       1266     1267     +1     

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

@Thom293
Copy link
Contributor

Thom293 commented Jun 3, 2024

I appreciate the ping. Thank you.

I am not in favor of mandatory trimming of units. I dont want my units trimmed. I like fighting outnumbered. I dont believe I have ever removed an enemy unit from the MM lobby in the 10ish years I have used this game. Because of this I have lost some battles. I like this. I am not the only one.

I am fully in favor of making it easier for people that want it. But why are people that don't want it easier being punished? You yourself called it late night feature creep. I can't possibly imagine why this should be mandatory.

I would respectfully request it be made an adjustable option. What is the drawback of making it optional? I don't understand. And I can guarantee you some people will think that 25% is too late to trim and will want it to start trimming at 5%. If it's adjustable then everyone will be happy. Please just make it optional.

Thank you.

@RaozSpaz
Copy link

RaozSpaz commented Jun 3, 2024

So after playing MekHQ for a lot more since this post originally came out, I believe I have gathered enough info to make a bit of a statement in regards to it.

1st - Before doing anything in relation to changing how Princess spawns her forces, we need to ensure they are spawning properly in the first place. When this post was first brought up there was a lot of talk about the possibility that Princess is applying pilots AFTER rolling her units. In addition to that I was beginning to notice a much higher than average deployment of the PlayerAlliedGround modifier. Ensuring everything is turning properly first and foremost and letting that play out for a prolonged period of time will give us a better basis to draw upon for determining the baseline.

2nd - Whilst I do agree with Thom that changes to Princess' should be optional, I do think we need to figure out where the comfortable baseline is for the players as a whole. Which in order to do that we need to complete the above process first. After we have done that, whatever we determine is the norm [which could very well be her present state] should be the 'Regular' difficulty for AtB.

3rd - To compound upon the discussion of her difficulties, if you make changes to how she spawns things now, and THEN apply the difficulty modifiers on top of that, you're just being counter productive. Increasing her 'cap' by 15% but then making UG reduce it by say 20% means overall Princess has barely changed. And a green player [who is now expecting an easier experience] will actually be playing a harder campaign [assuming of course Princess rolls close to cap].

As a final statement [as Thom's comment kinda makes clear] I highly HIGHLY suggest making some form of poll or dicussion in the MegaMek discord about people's opinion of Princess before we making any sorts of changes to her spawning system. And this is coming from someone who thinks she should be toned down slightly.

@IllianiCBT
Copy link
Collaborator Author

Alrighty, I'll remove the difficulty-based changes and just leave in the options to add limiters to scenario mods

@IllianiCBT
Copy link
Collaborator Author

Closed pending refactoring into separate PRs

@IllianiCBT IllianiCBT closed this Jun 3, 2024
@Thom293
Copy link
Contributor

Thom293 commented Jun 3, 2024

Thank you. I appreciate it.

With the bv % difficulty and modifier adjustments hopefully that will solve it.

It occurs to me that the hard coded "to compensate for a larger enemy force" modifier is rolled vs a fixed number depending on the contract accoding to what Illiani found. And then that in turn escalates BV after. I suppose another option would be to make those % chances user-configurable too, if you want another difficulty knob to turn.

Thank you again.

@IllianiCBT
Copy link
Collaborator Author

@Thom293 honestly, I'd rather not add a campaign option just for that one modifier. A better solution would be a full review of what scenario modifiers contribute to OpFor BV allowance to ensure modifiers are more consistently being considered when forces are generated. I opted not to do that myself, because the changes were not well received when I did. So that's going to fall under your remit, whether you think it's necessary and whether you have time to make the necessary xml edits.

@Thom293
Copy link
Contributor

Thom293 commented Jun 3, 2024

Thank you.

You and I both know from modding that it's impossible to please everyone. But It's why with my mod, other than the basic feature of adding settlers, the other features added were optional. Still, I know the feeling of being on the receiving end of user complaints. I'm sorry I'm being difficult.

On the modifiers - if I understand what you are saying - I'm kind of limited on what I can do. I can dilute by pure brute force by adding more. That is what I did by making no new modifiers that were as hard as the hardest 4 and adding a bunch of individual unit modifiers. But I'm kind of at the limit of what I can do with Intro tech stuff. The only thing I haven't added that I could are I can add 3 tank-only modifiers and 2 wet-navy modifiers (which now have a use with the biome changes). But beyond that I would be throwing off ratios too much if I add many more. To have more control on frequency and difficulty, we would need a method to add Nested manifests and a date filter.

But if you have other suggestions and/or some of the existing ones need to be changed, I will gladly help in whatever way you need. I'm just kinda limited by my inability to code.

Just let me know how I can assist. Once again, thank you.

@IllianiCBT
Copy link
Collaborator Author

@Thom293 So the issue (as I see it) is that a number of negative modifiers are flagged to not contribute to BV, which (to my understanding) basically makes them free units for the OpFor.

I really think we should be having modifiers contribute more consistently. For example, if a positive modifier is factored into the OpFor's BV allowance, then the corresponding negative modifier should be, too.

@Thom293
Copy link
Contributor

Thom293 commented Jun 3, 2024

Ahh. Yes I agree. When I made them I just copied existing ones so if that setting needs to be tweaked I can help with that. Might have some time next week.

@RaozSpaz
Copy link

RaozSpaz commented Jun 3, 2024

@Thom293 So the issue (as I see it) is that a number of negative modifiers are flagged to not contribute to BV, which (to my understanding) basically makes them free units for the OpFor.

I really think we should be having modifiers contribute more consistently. For example, if a positive modifier is factored into the OpFor's BV allowance, then the corresponding negative modifier should be, too.

In my opinion modifiers should be categorized into one of the following categories. And based on that should or should not be counted:

1] Map Modifier - A modifier being added to the battle due to something on the map should be counted in the BV total. Your employer most likely knows this facility exists so it makes sense that they would warn you and allow you to adjust to it. Thus it should be counted. This probably wouldn't count for the facility that just adds a random modifier but thats later

2] Contract Modifiers - Any modifier that is added due to your contract. Whether at a chance or guaranteed. This includes Integrated allies, House Officer, Primary Allies, etc. These forces are all effectively main battle line forces and thus should be counted towards the BV of the battle.

3] Random Modifier - This includes any other modifiers that are just rolled randomly when a scenario is generated [or from the facility that adds a random negative modifier]. These modifiers are far harder to predict and should be allowed to be exempted from the BV system. These should be the forces that allow the OpFor to go above and beyond whatever her threshhold is.

3b] If we do follow the above sort of system and also add a modifier limit I personally believe one more modifier should be added at a low chance. Recon/Intel Failure: Add two additional reinforcement modifiers. Effectively a modifier thats sole purpose is to add more force modifiers.

This is just my two cents and Id gladly listen to opinions on such statements

@Thom293
Copy link
Contributor

Thom293 commented Jun 3, 2024

I agree. I have a running list. Will add that but there is an issue - Bad Event and Good Event are supposed to add another modifier but it does not work. So that needs to be fixed or coded. I think there is an RFE but can't look right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(RFE) Enhancement Requests for Enhancement, new features or implementations StratCon Bugs relating strictly to StratCon UX User experience
Projects
None yet
4 participants