MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
292 stars 280 forks source link

Schrödinger's Invalid Units #5721

Open pavelbraginskiy opened 1 month ago

pavelbraginskiy commented 1 month ago

Several units are sometimes considered invalid, and sometimes considered valid, and it's not clear what exactly needs to be done for these units to be considered valid/invalid, I suspect it's related to Variable Tech Level, but that's just a wild conjecture.

These units are in two sets:

And

If the units in one of these sets are valid, the units in the other set are invalid, and vice versa.

The failed validation reason for the Speeder, Heavy Transport B1, and Jet Sled, all list the same reason for being invalid: Standard Armor not being available yet, despite the fact that all three of these units have a year later than the introduction for Standard Armor, which is what makes me suspect this is caused by a bug in VTL, but it really could be anything.

I have not yet been able to reproduce a situation where the first unit set is invalid and get an invalid reason at the same time.

This weird validation nondeterminism effectively blocks data unit tests for validity of canon units, so these units should be investigated.

HammerGS commented 1 month ago

You're going to run into challenges with lots of this stuff. But my first question is what game year is the test using.

These come from MW1e and the stats used to make them are based on that book which predates any type of vehicle construction rules. Realistically units like this should just be removed from MegaMek.

With VTL on, and the game year set to 3145 (all also have Harjel II or III) so prior to 3132 Game year would likely fail

We have Entityverifier which can run and generate a list of invalid units, and I run this on a regular basis. The units that fail are a mix of CGL units that need errata, and seem we need to fix code.

pavelbraginskiy commented 1 month ago

Ideally, the validity of a unit should be deterministic. VTL should only affect the tech level of a unit, but it shouldn't be able to make it invalid. Validation should only look at the year of the unit, and have no concept of the game year.

All the game year should do is filter which units appear in the unit selector.

I'd love to look into these things myself, but honestly it's all too complex for me.

repligator commented 1 month ago

I don't own TRO: 3025*, but based purely off the data that MM uses...

private static ArmorType createStandardArmor() states that Standard Armor was in prototype stage circa 2460.

...All three of these vehicles should be and currently are invalid.

I don't know what's going on the mechs. I have seen the Kodiak II 2 appear as invalid before, but I can't seem to figure out how to replicate it.

*The three vehicles state in their BLK files that they are from TRO: 3025. But neither SARNA nor the MUL list them as being from TRO: 3025 (nor TRO: 3025 revised).

gsparks3 commented 1 month ago

IIRC that Agrotera is treated as invalid due to having a Clan ERPPC plus a PPC Capacitor prior to the introduction date for Clan PPC Capacitors. It is after the introduction date for IS PPC capacitors, and is also an ultra custom one-off Solaris unit that breaks rules in other ways for thematic purposes, so it's probably fine to just leave that one / mark it as "invalid as built".

Several of the MW1e units don't actually have any introduction dates listed on the MUL; as mentioned, it might be easier to just remove them entirely. The Jet Sled in particular is explicitly noted as an illegal design under current rules on the MUL.