Web frontend and supporting services for lance.blue
headquarters plan unit-library.md
6.9 kB


id: unit-library title: Every unit MegaMek knows is queryable, from any MegaMek status: open repos: [helm] dependsOn: [] exitCriterion: > helm builds its outputs from an unmodified MegaMek install, of a version given to it rather than baked in, committing none of MegaMek's data — and says how far the result agrees with MegaMek. #

unit-library #

helm reads MegaMek's unit library and writes an indexed SQLite database of it: 10,988 units with tonnage, tech base, era, movement, armour, loadout, quirks and critical slots. That much works.

What it does not yet do is stand on its own. Three things are still borrowed.

Battle value, cost and the Alpha Strike conversion are computed, not declared. They appear in no .mtf or .blk file — MegaMek derives them when it loads a design. helm gets them today from bridge/, two Java programs that read MekSummaryCache. That is honest and it works, but it means a build needs a JDK container and it means those columns are MegaMek's answer rather than one we can check.

The equipment catalogue comes from the same place. 4,348 entries with heat, damage, ranges and tonnage. This is the hidden dependency: computing battle value ourselves needs the catalogue first, so the catalogue is the real prerequisite for unit-rules, not the battle value formula.

Nothing says how far we agree with MegaMek. The database has one figure per unit and no record of where it came from or whether it is right.

What this epic is for #

The unit data has three consumers coming — unit-search, unit-rules and forces — and each of them wants the library to be a value they are handed, not a thing they go and find. That shape has to exist before they are built on it.

There are two outputs, not one. The database is the server's and the agent's; a reduced index is the browser's, for the force-building screen. Both are generated from the same read of the same install, so neither can be a version behind the other. See unit-search for what the index has to carry.

A unit's identity across all of this is chassis and model, as two fields, because that is what a .mul records and so what forces's blue.lance.force and any export must carry. The display name is chassis (clanname) model and is not a key; the MUL id is not one either, since 153 of 4,279 Meks have none.

The first deviation is already known #

ASTurretSummary.getSpecialsDisplayString() throws on certain turreted units. It cost the Alpha Strike special abilities of 967 units, 887 of them Tanks, and it took down the first dump entirely before the walk over MekSummary was made defensive. It is the template for what the registry holds.

Done #