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

Exclude units by role on random generation, force generator table calculation updates #5572

Merged
merged 11 commits into from
Jun 16, 2024

Conversation

SuperStucco
Copy link
Collaborator

The initial intention in this work was to change random selection parameters to allow excluding some units from random selection by role, to close #5564. Turns out the selection table math in the same place has a few kinks, so those fixes got rolled in.

Math fixes first:

  • calculating the total weight for the weighted random selection was including units that would then be filtered out for various reasons. This resulted in a much higher total weight, and lower than intended weight for all the models of that chassis. The total weight is now calculated based on the same units that are processed into the random selection table.
  • calculations that changed availability numbers to weights ( 2 ^ (av/2) ) returned doubles, which were being truncated to int while added to the total weight, and then the total weight used in other double-producing calculations. Doubles are now being used throughout the calculations to preserve accuracy.
  • year comparisons for pre-/early production availability modifiers have been adjusted to do the intended comparisons
  • the method for adjusting availability with the dynamic +/- adjustment system has small tweak to handle a 1-point difference
  • interpolation of availability values for years between era data points have been tweaked

There are a few bit of weirdness showing up, such as RAC/LAC field gun platoons being processed in 3058 even though they have much later introduction date (3062 for the former, 3068 for the latter). The LAC field gun models are not even present in the 3058.xml file. These models may be getting processed based on tech availability date rather than the keyed-in introduction date, but I'm treating that as out-of-scope for this PR and the calculations are successfully filtering them out.

These should not result in many changes for units like Mechs with few models per chassis. The largest changes will be seen with conventional infantry where there are regularly 10+ models per chassis, with the RATGen/force generator table numbers now more consistent with the availability numbers.

@Sleet01 Sleet01 self-requested a review June 16, 2024 03:06
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.

Seems to work.

@HammerGS HammerGS merged commit b30485f into MegaMek:master Jun 16, 2024
4 checks passed
@HammerGS
Copy link
Member

@SuperStucco This breaks tests in MekHQ and will need a companion PR

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.

RFE: add ability to exclude roles on random generation
2 participants