Author Topic: [0.49.20] Automatic Ammunition Configuration Alpha  (Read 1116 times)

Sleet01

  • Private
  • *
  • Posts: 36
[0.49.20] Automatic Ammunition Configuration Alpha
« on: 01 July 2024, 14:53:32 »
Greetings, Programs MechWarriors!

Some of you may have noticed a new addition in the Player Configuration... dialog within MegaMek: the Automatic Ammunition Configuration section!
I'd like to give some information about this new functionality and answer any questions folks may have.

Overview

We've added a section in the Player Configuration / Player Settings dialog to adjust ammunition bins and ASF bombs semi-intelligently.
These controls allow players to kit out ammo-using units a few different ways:

1. Autoconfig: select appropriate munitions for each unit using information about the current game settings, opposition units, time of day, and friendly unit capabilities.
2. Randomize: randomly select valid munitions from available options
3. Save/Load Loadouts: save the current configuration, or load a previously-created configuration

When the "OK" button is clicked, the new ammo configurations are applied!
Hitting "Cancel", or explicitly restoring the original configuration, will prevent the dialog from making changes.

This can be used to configure a player's own units, or Bot units, and will work in network games.

Controls

There are a few obvious, and not-so-obvious, inputs to these capabilities.  The obvious adjustments to be made are:
  • "Faction Selection" dropdown - Choose your team's faction to adjust which munitions are available.  This will only affect a few factions at specific times.  Defaults to "IS - General".
  • "Truly Random" checkbox       - Off: "random" ammo only includes ammo that deals damage; On: ammo is fully randomized and results may be useless / suboptimal.  Defaults to Off.
  • "No Nukes" checkbox              - Off: allows equipping nuclear munitions on relevant units (Davey Crockett, Alamo, etc.) if the game options allow.  On: ignore game options and never equip nukes.  Defaults to On.

But other game option settings will also influence how these controls function:
  • Allowed Units and Equipment
    • Year: determines which munitions are available in general, and to specific factions.
    • Tech Level: determines which munitions are available in general; most optional munitions are Advanced or Experimental
    • Variable Tech Level: can make some munitions available earlier depending on Tech Level and canon development time
    • Ignore Clan Ammo Limitations: expands the range of munitions available to Clan factions
  • Advanced Rules
    • TacOps Double Blind: this will prevent the autoconfig tool from evaluating enemy forces, so munitions will be selected based on friendly capabilities only (e.g. Flak rounds are less likely)
  • Advanced Aerospace Rules
    • Allow Nuclear Weapons: this must be enabled _and_ "No Nukes" must be disabled in order for nuclear munitions to be generated.

Autoconfig logic

When Autoconfig is clicked the system assesses the battlefield conditions (day/night, ground/space), friendly forces (including TAG/NARC capabilities), enemy force composition and capabilities (if Double Blind is not set), and attempts to choose four of the most effective ammo types for each weapon system type.

  • If conditions are not daylight, illuminating munitions are weighted higher: Inferno, Tracer, and artillery Illumination, etc.
  • If friendly forces include NARC or TAG, guided munitions will be weighted more highly; if none are included, guided munitions are weighted lower.
  • Depending on Double Blind settings and enemy force composition, munitions that increase or reduce rounds/ton may be weighted differently; higher-damage munitions may be selected depending on enemy armor types; Inferno rounds are favored against energy-heavy forces and vehicles; rounds with extra anti-personnel damage will be weighted higher if there are many infantry or BA troops; etc.
  • If the enemy forces include a large number of Airborne units, Flak rounds will be weighted higher.
  • If the enemy force includes a number of high-MP units, Precision, seeking, and guided munitions may be selected

Caveats

The feature as presented in 0.49.20 is still in development, and players should note that it still has many limitations:

  • A late-breaking bug in 0.49.20 currently prevents Princess from using any ammo-based weapons!  See "Workaround" section later
  • Weather / planetary conditions outside of day/night are not considered; wind may affect missile effectiveness but this is not currently modeled.
  • "Utility" munitions such as Smoke, Thunder, Illumination, etc.  Princess doesn't know how to use these munitions so they are weighted very low and will only be generated by the Randomize button.
  • ASF bomb loadouts are always random.  We incorporated the original MHQ bomb generation code which randomly assigns munitions, but this will be improved in the next version
  • Due to the nature of the .adf file format, saved _manual_ loadouts are only applicable to the units they derive from (but can be later edited to be more generic)
  • MHQ limitations, such as players' factions or ammo supplies, do not apply.  It is possible to equip forces with munitions that they don't own in their Campaign after loading into MM for a mission

ADF Format

In order to make it possible for players to customize and re-use loadouts, we created a new file format that can be saved and loaded from this dialog.
If a player manually sets their munitions via the lobby, they can save the configuration for loading in future games.
(Note that entries will be saved for each specific chassis, variant, and pilot in the player's list, and will only apply to that specific combination.)
By contrast, the autogenerated configurations will be as generic as possible: a single imperative defining the top four munitions for each bin type will be applied to all units.
The file format is designed to be human readable and editable.

Format

Each line of an .adf file consists of two main parts:
  • The chassis, variant, and pilot to which it applies, separated by single colons
  • A set of imperatives, separated by double colons,

The imperative set is open-ended and can contain unlimited entries.
Each imperative itself consists of two parts:  ammo type, and munitions in order of importance. e.g.
   
Code: [Select]
      |-- Chassis
      |   |-- Variant (here, "any" will match any variant)
      |   |   |-- Pilot (here, "any" will match any pilot)
      |   |   |    |-- First imperative starts with Ammo bin type (if size is specified, applies only to that size; otherwise, applies to all of that type)
      |   |   |    |        |-- Primary, and default, munition to load on matching units.  The default ammo will fill any excess bins after all imperatives are fulfilled.
      |   |   |    |        |               |-- Secondary munition.  Exactly one bin will be filled with this ammo if more than one matching bin exists.
      |   |   |    |        |               |         |-- Tertiary entry.  Exactly one bin will be filled with this ammo if more than two matching bins exist.
      |   |   |    |        |               |         |            |-- Second imperative (if desired)
      |   |   |    |        |               |         |            |                                       |-- Third imperative (if desired)
Crusader:any:any::LRM 15:LRM 15 Dead-Fire:Standard:Narc-capable[::SRM 6:SRM 6 Dead-Fire:Standard:Inferno[::...]]

To set all matching bin types to the same ammo, simply provide the desired munition type as the only imperative, e.g.
Code: [Select]
::AC:Precision
Any bins that match an imperative but have no ammo type explicitly stated will receive the first, or default, ammo type.
Any bins that do _not_ match an imperative will not be reconfigured.
Any unit that does not match any entry will not be reconfigured.

Entries are applied in the following order:
  • Explicit chassis-variant-pilot match
  • Explicit chassis-variant + "any" match
  • Explicit chassis + "any" match, this will attempt to match a specific pilot or "any" for the third field
  • "any" chassis match + explicit/"any" variant + explicit/"any"

Again, any unit that doesn't match an entry at all will not be reconfigured.

Autogenerated Configuration

The current autoconfigure code produces a single maximally-applicable entry that covers all weapon types:

Code: [Select]
any:any:any::Narc:Standard:Narc Explosive::Mek Mortar:Standard:Airburst:Anti-personnel:Semi-Guided::AC:Standard:Flak:Caseless:Precision::LRM:Dead-Fire:Standard:Fragmentation:Heat-Seeking::Artillery Cannon:Standard:Fuel-Air::ATM:HE:ER:Standard::Arrow IV:Standard:Inferno-IV:Cluster:ADA::Artillery:Standard:Flechette:Cluster:Fuel-Air::Bomb:Standard:ASMissile Ammo:ClusterBomb:RL 10 Ammo (Bomb)::SRM:Dead-Fire:Standard:Tandem-Charge:Acid
Although the default configuration system selects 4 imperatives for each weapon type, fewer or more are allowed.
(Note that the ::Bomb directive is generated but not currently used)

Randomized Configuration

The randomized configuration produces an even simpler single entry:
Code: [Select]
any:any:any::Mek Mortar:Random::Narc:Random::AC:Random::LRM:Random::Artillery Cannon:Random::ATM:Random::Arrow IV:Random::Artillery:Random::Bomb:Random::SRM:Random
This matches any unit, and generates a different random ammo type for each bin of each weapon system.  Note that variation may be limited, depending on year, faction, and game settings.

Saved Manual Configuration

On the other hand, if a user customizes their loadout in the lobby and then wishes to save it for later re-use, the entries will be much more specific:
Code: [Select]
Catapult:CPLT-K2:Cheyenne Zogu::MG Ammo:Standard
Brutus Assault Tank::Monica Olba::LRM 20:LRM 20 Dead-Fire:Standard:LRM 20 Follow The Leader::SRM 2:SRM 2 Dead-Fire::SRM 6:SRM 6 Dead-Fire
Brutus Assault Tank::Bente Dybdahl::LRM 20:LRM 20 Dead-Fire:Standard:LRM 20 Follow The Leader::SRM 2:SRM 2 Dead-Fire::SRM 6:SRM 6 Dead-Fire
Crusader:CRD-3R:Ru-su Toyota::LRM 15:LRM 15 Dead-Fire:Standard::SRM 6:SRM 6 Dead-Fire::MG Ammo:Standard
Thorn:THE-S:Pori Hansson::LRM 5:LRM 5 Dead-Fire
Vedette Medium Tank:(AC2):Zak Crawford::SRM 2:SRM 2 Dead-Fire::AC/2:Flak AC/2::MG Ammo:Standard
Vedette Medium Tank:(AC2):Mikaho Joe::SRM 2:SRM 2 Dead-Fire::AC/2:Flak AC/2::MG Ammo:Standard
Awesome:AWS-8R:Iwane Jarakian::LRM 15:LRM 15 Dead-Fire:Standard
Peregrine Attack VTOL:(Kurita):Yasuo Doyle::SRM 4:SRM 4 Dead-Fire
Peregrine Attack VTOL:(Kurita):Heidi Kichida::SRM 4:SRM 4 Dead-Fire
Warrior Attack Helicopter:H-7:Teruyo Almaa::SRM 4:SRM 4 Dead-Fire::AC/2:Flak AC/2
Warrior Attack Helicopter:H-7A:Tatsui Nomura::AC/5:Flak AC/5::MG Ammo:Standard

Each entry will only match one specific chassis-variant-pilot combo, but a user can make these entries more generic and/or dynamic by:
  • Replacing variant and pilot fields with "any"
  • Removing weapon size from imperatives
  • Replacing some or all imperatives for a give weapon system with the "Random" keyword

The accepted Chassis and Variant names, as well as Weapon Type and Munition names, are determined by MegaMek's internal codes.
If in doubt, I recommend saving off a config containing the desired munitions to use as a reference before editing any .adf files.

To apply a manually-edited .adf file to a force, simply click "Load Loadout", select the file, and then click "OK"; the Lobby should show that all the player's units have been modified.
If nothing seems to be happening when using Autoconfig, Randomize, or Load Loadout, check the MegaMek log file for errors.

Workaround for Princess Not Using Ammo Weapons in 0.49.20

There is no way to enable Princess to use ammo-based weapons (other than bombs) in 0.49.20, but the autoconfiguration tools can be applied to forces for use in 0.49.19.1 (the current Milestone version).
Since MUL files record ammo loadouts for each unit, I have used this approach for some of my testing:

  • Create player and bot forces in 0.49.20
  • Run Ammunition Autoconfig in 0.49.20
  • Export MUL for each player's forces from 0.49.20
  • Create player and bots in new 0.49.19.1 game
  • Reinforce each player with the exported MULs
  • Enjoy!

Alternatively, try out the nightly builds and get a sneak peek at the next version of this new system!
« Last Edit: 01 July 2024, 15:11:54 by Sleet01 »
- I laughed, I cried, I fell down, it changed my life... it was good!

dgorsman

  • Captain
  • *
  • Posts: 2017
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #1 on: 02 July 2024, 11:30:38 »
Double blind does not prevent you from seeing what the opponent has in the lobby; it only limits what you know once game play begins.  Would it be better to limit configuration based on the Blind Drop (you can only see general details in the lobby) and Real Blind Drop (no information at all) options?
Think about it.  It's what we do.
- The Society

Thunder LRMs: the gift that keeps on giving.  They're the glitter of the BattleTech universe.

Sir Chaos

  • Captain
  • *
  • Posts: 3176
  • Artillery Fanboy
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #2 on: 02 July 2024, 12:01:47 »
Do the nightly builds include a fix for the bug that prevents Princess from using ammo-based weapons?
"Artillery adds dignity to what would otherwise be a vulgar brawl."
-Frederick the Great

"Ultima Ratio Regis" ("The Last Resort of the King")
- Inscription on cannon barrel, 18th century

Sleet01

  • Private
  • *
  • Posts: 36
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #3 on: 02 July 2024, 12:15:41 »
Double blind does not prevent you from seeing what the opponent has in the lobby; it only limits what you know once game play begins.  Would it be better to limit configuration based on the Blind Drop (you can only see general details in the lobby) and Real Blind Drop (no information at all) options?

That makes sense and is an easy update.
- I laughed, I cried, I fell down, it changed my life... it was good!

Sleet01

  • Private
  • *
  • Posts: 36
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #4 on: 02 July 2024, 12:16:15 »
Do the nightly builds include a fix for the bug that prevents Princess from using ammo-based weapons?

Yes; this got fixed within about 24 hours of the release iirc.
- I laughed, I cried, I fell down, it changed my life... it was good!

Illiani

  • Private
  • *
  • Posts: 37
  • Code Monkey
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #5 on: 02 July 2024, 12:36:45 »
Be aware that the nightly builds are for the in-dev 50.0 so will require Java 17

Sir Chaos

  • Captain
  • *
  • Posts: 3176
  • Artillery Fanboy
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #6 on: 02 July 2024, 13:09:42 »
Okay... stupid question, maybe, but where can I find the nightly builds?

Never mind, I figured it out. But all the versions I see available have warnings about either a "deprecated functionality" of some sort, or a Build Outcome apparently not going well.

Which of these nightly builds should I download to get the bugfix?
« Last Edit: 02 July 2024, 13:36:46 by Sir Chaos »
"Artillery adds dignity to what would otherwise be a vulgar brawl."
-Frederick the Great

"Ultima Ratio Regis" ("The Last Resort of the King")
- Inscription on cannon barrel, 18th century

Hammer

  • Numerorum Malleo
  • Global Moderator
  • Major
  • *
  • Posts: 4433
    • MegaMek Website
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #7 on: 02 July 2024, 14:08:20 »
Okay... stupid question, maybe, but where can I find the nightly builds?

Never mind, I figured it out. But all the versions I see available have warnings about either a "deprecated functionality" of some sort, or a Build Outcome apparently not going well.

Which of these nightly builds should I download to get the bugfix?

Any of the last couple of nightly builds should have it.
MegaMek Projects Wiki
Bug Trackers
MegaMek Tracker
MekHQ Tracker
MegaMekLab Tracker
New Units and RAT's aren't added until after the 2 month release moratorium is passed.
Join the official MegaMek Discord

Illiani

  • Private
  • *
  • Posts: 37
  • Code Monkey
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #8 on: 02 July 2024, 14:23:58 »
We’re also in the middle of transferring everything to J17, which is why the place is a bit of a construction yard atm. If you can wait a couple more days the dust should have settled by Friday.

Sir Chaos

  • Captain
  • *
  • Posts: 3176
  • Artillery Fanboy
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #9 on: 02 July 2024, 14:24:33 »
Any of the last couple of nightly builds should have it.

Okay... GitHub says 0.49.20 was released 1:10 AM (GMT +2) on the 29th... but the latest nightly build that shows any files available for download is from only 2 hours after that. The subsequent builds show a lot of error messages and no file available for download.

Like here, for example: https://github.com/MegaMek/mekhq/actions/runs/9753370078

Also, I was checking the tracker to see when the bug was fixed, but I can´t seem to find it among either the open or closed issues.
« Last Edit: 02 July 2024, 14:37:23 by Sir Chaos »
"Artillery adds dignity to what would otherwise be a vulgar brawl."
-Frederick the Great

"Ultima Ratio Regis" ("The Last Resort of the King")
- Inscription on cannon barrel, 18th century

Hammer

  • Numerorum Malleo
  • Global Moderator
  • Major
  • *
  • Posts: 4433
    • MegaMek Website
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #10 on: 02 July 2024, 15:10:48 »
Okay... GitHub says 0.49.20 was released 1:10 AM (GMT +2) on the 29th... but the latest nightly build that shows any files available for download is from only 2 hours after that. The subsequent builds show a lot of error messages and no file available for download.

Like here, for example: https://github.com/MegaMek/mekhq/actions/runs/9753370078

Also, I was checking the tracker to see when the bug was fixed, but I can´t seem to find it among either the open or closed issues.

The fix is in, but thinking more on this - we are pushing tons of fixes to our building scripts and the automated builds are a mess and will be till the weekend (we hope). If you're on the Discord you should see some chats around when they are stable.
MegaMek Projects Wiki
Bug Trackers
MegaMek Tracker
MekHQ Tracker
MegaMekLab Tracker
New Units and RAT's aren't added until after the 2 month release moratorium is passed.
Join the official MegaMek Discord

Sir Chaos

  • Captain
  • *
  • Posts: 3176
  • Artillery Fanboy
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #11 on: 03 July 2024, 07:29:33 »
Okay... Princess still isn´t using ammo-based weapons in the latest MHQ nightly build.

I see that there are more recent MM nightly builds available, though.

Would it be possible for me to Frankenstein together an MHQ build with the fix by copying the most MM nightly build - presumably with the fix - into that MHQ build that doesn´t have the fix yet?


Edited add: That is a purely hypothetical question for now; I cannot get MM to launch in either of the post June 29th nightly builds. I doubt that´s a Java thing; I downloaded and installed Java 17, and both MM and MHQ from the latest MHQ nightly build launch just fine for me.
« Last Edit: 03 July 2024, 08:20:31 by Sir Chaos »
"Artillery adds dignity to what would otherwise be a vulgar brawl."
-Frederick the Great

"Ultima Ratio Regis" ("The Last Resort of the King")
- Inscription on cannon barrel, 18th century

Hammer

  • Numerorum Malleo
  • Global Moderator
  • Major
  • *
  • Posts: 4433
    • MegaMek Website
Re: [0.49.20] Automatic Ammunition Configuration Alpha
« Reply #12 on: 04 July 2024, 09:40:01 »
Currently the nightlies are broken. We are having issues with the new Java 17 build scripts and until those are resolved (no ETA) the nightles won't build correctly.
MegaMek Projects Wiki
Bug Trackers
MegaMek Tracker
MekHQ Tracker
MegaMekLab Tracker
New Units and RAT's aren't added until after the 2 month release moratorium is passed.
Join the official MegaMek Discord