BattletechModders / CleverGirl

Helps the AI be a bit more intelligent.
MIT License
4 stars 4 forks source link

CG does not evaluate range based off CAC weapons, only vanilla code #25

Open IceRaptor opened 3 years ago

IceRaptor commented 3 years ago

From rogueticket-3372 -

Several enemy units stopped acting in this battle. The first one was the Kit fox, after being knock down it never attempted to stand up: The the Wasp LAM. It did lose both torsos, it didn't fall down. Even if it had functioning legs it never tried to land and walt. At that point I saved the following logs: Attachment file type: archive RogueLogs.zip 16.78 MB Continuing the battle, in the last turns, a Hunter stopped acting, it had still working missiles and mech in its frontal arc. Second set of logs. Attachment file type: archive RogueLogs2.zip 17.55 MB All three units had the possibility to do something, eve if it wasn't really useful. Harkonnen — 05/03/2021 hmmm.... ok, this is really interesting, two different bugs 1st log - NRE at BattleTech.PreferExposedAlonePositionalFactor.EvaluateInfluenceMapFactorAtPosition_Patch0 @KMiSSioN 2nd log. If i am reading the log correctly, there is a serioius logic lapse in CleverGirl. It reject weapons due to been in minRange before the point where its should evalute Ammo/Modes. So while LRM20 could be Hotloaded, its not getting to a point where its should check this @FrostRaptor KMiSSioN — 05/03/2021 @Harkonnen i'm a victim here Harkonnen — 05/03/2021 so CleverGirl.Helper.AOHelper.MakeAttackOrderForTarget makes wrong call? FrostRaptor — 05/03/2021 So if I'm reading the transpiler on WeightedFactorHelper correctly, this log line in the CU logs:

patching class BattleTech.PreferExposedAlonePositionalFactor can't find WeightedFactorHelper.CollectMasksForCellAndPathNode call Indicates that the transpile is effectively a no-op, correct? Since that immediately returns the instructions unchanged. Thus the error is in the raw HBS code. If that's the case... NRE candidates are pretty thin. Would have to be BehaviorTree or maybe enemyUnits Jago — 05/04/2021 I don't know if it is the same bug, but the Firefly in these logs did spent its last turns moving around without firing. It wasn't overheated and had weapons. Attachment file type: archive RogueLogsFirefly.zip 10.48 MB Harkonnen — Today at 12:59 AM @FrostRaptor did you fix the 2nd issue here? i dont remember you mentioning it CG changes... FrostRaptor — Today at 8:32 AM This firefly looks like it only has medium pulses, and in all cases it was either out of range or had no LOS to the target Last round it was out of range to the Stalker, Uziel, Valkyrie. It was in range to the Bushwacker, but it couldn't get LOS (willFireAtTarget: False) If I had to guess, it's got a weak melee attack but good move, so the AI is taking nodes that are outside enemy retaliation range. But that puts it outside MPulse range. My thought is that this is WAD, but the role needs to be customized to allow the Firefly with it's short range weapons? Presumably something like a Flea with lots of SLas would have a similar flaw. I could also put logic in the PreferAvoidMeleeWhenOutTonned influenceMap Factor to say if all weapons are out of range, move into melee ragne Which is I think the correct solution here. It won't fix it, fix it - but won't make it worse. Interactive Rubber Dolphin — Today at 8:40 AM @FrostRaptor I think harkonnen was asking about the other thing It reject weapons due to been in minRange before the point where its should evalute Ammo/Modes. So while LRM20 could be Hotloaded, its not getting to a point where its should check this not the firefly logs, but the second issue in first logs FrostRaptor — Today at 9:01 AM No, I didn't change that. It's a pretty substantial rewrite as the API KMission exposes for me to use doesn't directly let me access modes/ammoPairs until I've calculated expected damage for the target So I have what I need, but the structure of CG code - based off HBS code - doesn't lend itself well to introducing this check at the position I need it checked, without slowing down the process with multiple damage evaluation checks

IceRaptor commented 3 years ago

Problem is that CAC's CleverGirl helper only exposes the modes through the DamagePredictions, which are evaluated much later in the flow. Need to fundamentally restructure the logic to support this check by evaluating the CAC logic as early as possible, then filling out the weapons lists.