Skip to content

Key Clan Goliath Scorpion's Force Generator era data to CGS - #525

Open
HammerGS wants to merge 1 commit into
mainfrom
Fix-CGS-era-faction-codes
Open

Key Clan Goliath Scorpion's Force Generator era data to CGS#525
HammerGS wants to merge 1 commit into
mainfrom
Fix-CGS-era-faction-codes

Conversation

@HammerGS

Copy link
Copy Markdown
Member

What this changes

Clan Goliath Scorpion had no Force Generator tuning of its own from 3082 onwards. Its per-era
parameters - the Clan, Star League and Omni percentages, the tech margins and the salvage table -
were still written under the retired codes CEI and SE in the seven era files from 3082 to 3160.
When the Escorpion Imperio and the Scorpion Empire were consolidated into the CGS faction file,
those blocks were left behind, so no CGS block existed in any of those files and MegaMek logged
Faction CEI not found in data/forcegenerator/3082.xml for each one on startup.

In practice a Scorpion Empire force came out untuned. The 3145 file asks for about 90% Clan tech at
the top equipment rating and 10% salvage taken from Clan Hell's Horses; with no block loaded, none
of that shaped the generated force. Those seven blocks are now keyed CGS.

Two files, 3078 and 3131, also carried a placeholder block for the code the faction was about to
take, holding nothing but a tech margin that already matched the real block in the same file. Both
are removed, so each era names the faction exactly once.

The availability entries in the <units> sections are deliberately left alone. They name the
faction by the code it used in that era, which resolves through the aliases in CGS.yml, and they
are a useful record of what the faction was called at the time.

This is the Force Generator counterpart to #507, which did the same for the diplomacy data.

Source

Not a canon data change - no percentage, margin or salvage value is altered. This corrects which
faction key the existing values are filed under, following the consolidation of the Escorpion
Imperio and Scorpion Empire into CGS.yml, whose aliases block already records 3080: CEI and
3141: SE.

How this was checked

Loaded the changed files in MegaMek and read Clan Goliath Scorpion's era parameters back out of the
Force Generator, before and after. Every bucket from 3082 to 3160 previously came back empty - tech
margin 0 and no percentages at all. After the change each one carries its values: tech margin 3 at
3082 and 3085, 6 at 3100, 12 at 3131, 15 at 3145, 16 at 3150 and 18 at 3160, with 90% Clan, 10%
Star League, 80% Omni at the top rating and 10% salvage throughout. The Faction CEI not found
and Faction SE not found errors are gone from the log.

Also generated Clan Goliath Scorpion 'Mek tables at 3100, 3145 and 3160, which returned 214, 317
and 342 entries. That confirms the availability entries still resolve with the parameter blocks
renamed.

The per-era Force Generator parameters for Clan Goliath Scorpion - the Clan,
Star League and Omni percentages, the tech margins and the salvage table - were
still written under the retired codes CEI and SE in the seven era files from
3082 to 3160. The Escorpion Imperio and the Scorpion Empire were consolidated
into the CGS faction file, so no CGS block existed in those files at all and
MegaMek logged "Faction CEI not found in data/forcegenerator/3082.xml" for each
one. Those blocks are now keyed CGS.

Two files, 3078 and 3131, also carried a placeholder block for the code the
faction was about to take, holding nothing but a tech margin that already
matched the real block in the same file. Both are removed, so each era names
the faction exactly once.

The availability entries in the units sections are left as they are. They still
name the faction by the code it used in that era, which resolves through the
aliases in CGS.yml, and they record what the faction was called at the time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HammerGS HammerGS added the AI Assisted Development This project/code contains AI use under the supervision of a human developer. With Human testing. label Aug 18, 2026
IllianiBird added a commit to MegaMek/megamek that referenced this pull request Aug 21, 2026
…ion code (#8766)

## What this changes

Clan Goliath Scorpion generated untuned forces from 3082 onwards. A 3145
Scorpion Empire force at
the top equipment rating should come out about 90% Clan tech, 10% Star
League, with 10% of the force
salvaged from Clan Hell's Horses. None of that was applied, because the
faction had no era
parameters loaded at all for seven era buckets.

Each Force Generator era file has two parts: a `<factions>` block
holding the per-era tuning, and a
`<units>` section holding availability. Clan Goliath Scorpion absorbed
the Escorpion Imperio and the
Scorpion Empire, so its blocks from 3082 on are still keyed `CEI` and
then `SE`. The `<units>`
section already resolved retired codes through `getFaction()`, but the
`<factions>` section looked
the code up directly in the faction map, which by design holds no alias
keys. Every one of those
blocks was dropped with `Faction CEI not found in
data/forcegenerator/3082.xml`, and the faction
fell back on its parent's tech mix.

While testing this, a second defect turned up. `reloadFromDir` cleared
both the `initialized` and
`initializing` flags before reinitializing, so any `getInstance()` call
during the reload started a
second loader thread. That thread rebuilt every faction record once the
reload released the lock,
but skipped the era files because they were already marked loaded,
leaving the records empty. Era
parameters could not survive a reload at all, which also affects the RAT
Generator Editor.

## Testing

- New `RATGeneratorAliasedEraParametersTest`, four tests covering both
shapes the shipped files
take: an era holding only the retired code (like 3082 to 3160) and an
era holding both the retired
  and surviving codes (like 3078 and 3131).
- Confirmed the new tests genuinely catch the bug by reverting the alias
lookup on its own: three of
  the four fail, and pass again with it restored.
- Confirmed both halves of the fix are needed by reverting each
independently. Neither alone makes
  the new tests pass.
- Read Clan Goliath Scorpion's era parameters back out of the Force
Generator against the real
shipped data, before and after. Every bucket from 3082 to 3160
previously came back empty, at tech
margin 0 with no percentages. After the fix each carries its values:
tech margin 3 at 3082 and
  3085, 6 at 3100, 12 at 3131, 15 at 3145, 16 at 3150 and 18 at 3160.
- Loaded the real data through the running Force Generator and read
`megamek.log`. The
`Faction CEI not found` and `Faction SE not found` errors are gone, and
the new duplicate-block
warning fires exactly twice, for the two files that legitimately name
both codes.
- Generated Clan Goliath Scorpion 'Mek tables at 3100, 3145 and 3160,
returning 214, 317 and 342
  entries, confirming availability still resolves.
- Full suite: 15291 tests, 8 skipped, 1 failure. That failure is
`AeroWeaponFireInfoProbeTest.velocityPenaltyFiresOnALiveStyleRanking`,
which fails identically on
clean `main` with these changes stashed. It is unrelated and
pre-existing.
- Checkstyle passes.

## What is not proven yet

- The Force Generator was never opened in the GUI. The values were read
back through the real
  loading path rather than by generating a force from the menu.
- Nothing exercises the RAT Generator Editor, so the reload fix is
proven by the parameters
  surviving a reload in the harness, not by using the editor.
- Two era files, 3078 and 3131, name both the retired and the surviving
code. Their blocks are
merged in document order and the later one wins for each field it sets.
The overlapping values
agree in the shipped data, so nothing changes today, but the merge order
itself is not something a
test pins down; it is logged instead, and the data fix is
MegaMek/mm-data#525.

---

- [x] This PR is focused on one issue or RFE. Large refactoring or
accessibility work is in its own PR
- [x] Every file in the diff has a deliberate change (no stray
formatting, no unrelated files)
- [x] Tests added or updated, if this implements a rule or changes game
state
- [x] Javadoc literals use `{@code true}` / `{@code null}` rather than
bare or quoted text
- [x] Dev team only: if AI tools were used, the **AI Assisted
Development** label is applied, and I can
      explain and have verified the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Assisted Development This project/code contains AI use under the supervision of a human developer. With Human testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant