Fractal Softworks Forum

Starsector => Suggestions => Topic started by: Ekental on September 26, 2022, 08:57:24 PM

Title: Missiles are underweighted when determining engagement range
Post by: Ekental on September 26, 2022, 08:57:24 PM
I did a test with the Heron modded with the hint "CARRIER, COMBAT, NO_AUTO_ESCORT" in an effort to understand what determines the range ships try to stay at during combat.

I put 1 Medium Sabot (1200m) and 1 Longbow as armament against a balanced venture which resulted in a maneuver_range_from_target of ~1350m, slightly out of sabot range but at least it fired once in a while.

Add standard laser PDs -> maneuever_range_from_target ~ 435m : Slightly outside of laser PD range
Swap with LR laser PDs -> maneuever_range_from_target ~ 900m : Slightly outside of LR laser PD range

Use  2 longbows          -> maneuever_range_from_target ~ 1730m
Only 2 longbows          -> maneuever_range_from_target ~ 1730m: This appears to be the standard "only strike craft range".

Swap Sabot with a HVD-> maneuever_range_from_target ~ 1050m: Slightly outside of HVD (Hypervelocity Driver) range
Add ITU to the HVD      -> maneuever_range_from_target ~ 1430m: Slightly outside of HVD range
Add 2 longbows to this -> maneuever_range_from_target ~ 1430m: Slightly outside of HVD range

(EDIT: To be clear all weapons fired while the sabot fired a little less frequently than the cooldown)

Neither the missile or the strike craft appear to matter. I swapped longbows with Lux fighters and sabots with a reaper (if anything this increased the engagement range).

So the range priority appears to be: Guns > Strike craft > Point defense > Missiles.

I think this behavior is a bug, as I think it's absurd that a craft would let 1 PD dictate engagement ranges before a medium missile.

General behavior appears to be crafts try to be in range of their longest range weapon that isn't a strike craft.

I believe that a craft should try to be in range of all non-pd weapons someone puts on them. Non-finisher missiles should be treated as normal weapons and finishers something to close the gap for when opponent flux is high.
Title: Re: Missiles are underweighted when determining engagement range
Post by: cytokine on September 27, 2022, 12:52:55 AM
Quote
General behavior appears to be crafts try to be in range of their longest range weapon that isn't a strike craft.
I believe that a craft should try to be in range of all non-pd weapons someone puts on them.

I think you inadvertently chose the wrong model organisms to experiment on. Both the Drover and Heron are outliers when it comes to engagement range. E.g. putting salamanders on drovers will not make them get close enough to ever fire the missiles. And if you give the engage command to a pack of drovers, they will actually get in range, but get themselves blown up. So I think it's for the best that non-combat carriers are such cowards, it keeps them alive longer. Carriers are not representative of normal combat behavior.

The "slightly outside range" thing seems odd. But what was the actual behavior? I mean... was the herons actual distance to the enemy influenced by the range of its armament? The intended behaviour might be that of a cautious officer, having one weapon within range, but ends up being pacifist as a glitch. But I'm thinking the intended engagement range of carriers to be dictated by the equipped fighters only, otherwise staying out of combat.
Title: Re: Missiles are underweighted when determining engagement range
Post by: Ekental on September 27, 2022, 01:51:07 AM
I think you inadvertently chose the wrong model organisms to experiment on. Both the Drover and Heron are outliers when it comes to engagement range. E.g. putting salamanders on drovers will not make them get close enough to ever fire the missiles. And if you give the engage command to a pack of drovers, they will actually get in range, but get themselves blown up. So I think it's for the best that non-combat carriers are such cowards, it keeps them alive longer. Carriers are not representative of normal combat behavior.
My mistake, let me clarify.

In \starsector-core\data\hulls\ship_data.csv in the hints field you can edit the special behavior of craft, if any.

CARRIER results in a ship that actively avoids combat and escorts a friendly target with its craft.
COMBAT removes combat avoidance
NO_AUTO_ESCORT removes automatically escorting friendly targets

In the the hint field of the Heron the tag CARRIER was replaced with "CARRIER, COMBAT, NO_AUTO_ESCORT", which gives it the same behavior as the Legion, so it will fight like any vessel but also use its carrier craft.
I wanted to see what factors influence ship combat ranges so I needed something with guns, missiles, pd, strike craft and some speed to control the engagement range. I had a Heron so a minor edit let me do my test.

Slightly outside of range seems to not be an issue for anything but missiles. Projectiles are usually faster and have slightly higher range than listed so that combined with a distance measurement that I suspect comes from the craft's center means guns will fire just fine but some missiles like Sabots may not because I presume the increased risk they run out of fuel before reaching the target.

For the test I did also try 2km missiles like the Salamader and they worked fine. I do have an unedited Drover that already uses them in actual play and it sits at the "default"? 1.7km range to do so. That said with too few missiles the Drover will sit at 2.7km so I'm guessing that total missile weighting was so low it didn't even bother trying to fire them and acted like it was basically weaponless.

I don't think officer behavior matters when enough strike craft(2+ in my case) are involved. I tried most of these tests using a mod that allows you to set the officer behavior of the ship. For my Heron with the listed tests nothing changed even if I set it to aggressive. I did not attempt reckless on all tests so unsure there.
Title: Re: Missiles are underweighted when determining engagement range
Post by: cytokine on September 27, 2022, 03:46:56 AM
Oh, so your Heron was more like a regular combat ship then. And it did usually get within firing distance, i presume.

But, with two 'weapons', longbow and sabot pod, ranges 1200 and 4000 respectively (or 1200 and 2000?), against a venture, and the Heron chose an engagement distance you... disagreed with? Well, what makes you think closing in on the Venture would be a good idea for the Heron? A venture with two HAC, a graviton, two harpoon pods, two sabots, with cruiser-tier ITU and fast missile racks, that's a lot of dakka to be wary of.

I usually have the opposite problem, of the AI making an overaggressive dps-distance tradeoff, closing in to fire its frikkin burst PD lasers at the enemy, then with high hard flux, having to back way off, all the while getting punished for overextending.

You might be on to something, I'm just not following your line of reasoning.

Title: Re: Missiles are underweighted when determining engagement range
Post by: Ekental on September 27, 2022, 05:02:12 AM
But, with two 'weapons', longbow and sabot pod, ranges 1200 and 4000 respectively (or 1200 and 2000?), against a venture, and the Heron chose an engagement distance you... disagreed with? Well, what makes you think closing in on the Venture would be a good idea for the Heron? A venture with two HAC, a graviton, two harpoon pods, two sabots, with cruiser-tier ITU and fast missile racks, that's a lot of dakka to be wary of.
...
You might be on to something, I'm just not following your line of reasoning.

Using a debug mod you can see the range a ship is attempting to engage at. This is called maneuever_range_from_target.

The Longbow is a strike craft with no listed range. With only a Longbow the Heron sits at ~2.7km. With the Sabot + 2 Longbows it sits at 1.7km. This is out of the range of the Sabot (1.2km).

My understanding of what determines this range is that it's a value that takes into account all weapons put on the ship.
So each weapon is assigned a weighting based on what I assume they're expected to contribute -> The engagement range is set to favor weapons that are expected to contribute the most.

Testing tentatively supports this idea as removing and adding different weapons changes the engagement range. Refer to given info there to see results.

The point is missiles seem to count for less than they should. As far as testing goes ship AI will set engagement range to practically point blank if you have 1 sabot and 1 laser PD (~500m). So if we go by the weapon weighting theory then that means ship AI thinks the best bet is to get into PD range for dmg rather than only standing off with a sabot at 3x the distance.
If range is set by weapon weighting then I think missiles are valued much lower than they should be.

As far as I can tell ship AI does not consider opponent weapons as much as they simply react to being under fire. This is why burst dmg is so effective in game. AI don't have the ability to withdraw due to ship limitations and die instead.

So it really doesn't matter what the opponent venture is armed with, any ship will fight it until they start taking shots. Then from observation the rate their flux goes up usually determines how quickly they pull back.

I'd be nothing but pleased if someone could point me to where engagement range is determined but the API appears to keep that private.
Title: Re: Missiles are underweighted when determining engagement range
Post by: cytokine on September 27, 2022, 07:22:00 AM
I've watched more sim duels than any sane or normal person would, but I'm still not sure whats going on under the hood. So I can't offer much criticism of it, since I don't understand it. One thing that's possible to do, is point out cases where things have gone obviously wrong. And I don't know if that's the case here.
Quote
My understanding of what determines this range is that it's a value that takes into account all weapons put on the ship.
So each weapon is assigned a weighting based on what I assume they're expected to contribute
I think engagement distance is more complicated than that. Otherwise, having two mismatched ranges would put the average right between them. A ship with assault chainguns(450) and heavy maulers(1000) will pick one range or the other, based on 'confidence level', and not some point in-between them. And this 'confidence level' is not a purely internal state either. It's largely flux-dependent, but increases with raised enemy flux level too. Also increases with lowered enemy armor.
Quote
As far as I can tell ship AI does not consider opponent weapons as much as they simply react to being under fire.
I swear, adding lame-ass tactical lasers to a conquest will make it better against destroyer swarms, because the destroyers are 'scared' of the 'DPS field' and won't swarm the bigger ship. It's not the flux or the damage that does it. It drops their 'confidence level', and consequently increases their engagement distance.
Title: Re: Missiles are underweighted when determining engagement range
Post by: Ekental on September 27, 2022, 04:55:56 PM
I think engagement distance is more complicated than that. Otherwise, having two mismatched ranges would put the average right between them. A ship with assault chainguns(450) and heavy maulers(1000) will pick one range or the other, based on 'confidence level', and not some point in-between them. And this 'confidence level' is not a purely internal state either. It's largely flux-dependent, but increases with raised enemy flux level too. Also increases with lowered enemy armor.

Ships definitely move in for the kill if their opponent is fluxed out, overloaded etc, "confidence".

I'm more concerned with the default engagement range when ships are healthy. So I'm guessing that the maulers are weighted more heavily and the chaingun is ignored at the start. Then when the opponent is stressed ship AI moves in with the chaingun.

That's what weapon weighting is for. Rather than taking various ranges and averaging them the procedure would be to add some coefficient to various weapon systems then pick the grouping with the greatest weight once summed.

For example a chaingun + heavy mauler when both opponents are healthy and the ships are deciding a default engagement range.

If we assign a weight to the mauler of 2, and the chaingun to 1, 2>1 so:
When a ship is stressed via overload etc the weights are changed. Perhaps the chaingun is now weight 3, the mauler 1. Each weapon then is part of a profile that has the coefficients for all weapons based on ship confidence.
By swapping between profiles based on ship and opponent ship state that determines ship behavior.

So I'm guessing there's a weighting system, and that missiles are weighted too low, because right now my ships would rather brawl with a single PD laser+ 1 M Sabot than only use 1 Sabot.

I definitely don't know however and I'm not clear on how ship AI interacts with other ship loadouts.
They seem to be able to know when they're in the crosshairs but are happy to attack till then. Frigates happy yolo straight at my paragon until a moment before it shoots.

Either way. I know enough to game the system by putting on a single "real" gun but slightly resent the wastefulness of it. That's OK for now but in case there is a weighting system similar to what I described I was hoping someone would take a look at the missile section to make sure current behavior is intentional.
Title: Re: Missiles are underweighted when determining engagement range
Post by: Ekental on September 27, 2022, 05:01:06 PM
EDIT: Oh this is a double post 0_o
Title: Re: Missiles are underweighted when determining engagement range
Post by: cytokine on September 28, 2022, 02:19:33 AM
Quote
I was hoping someone would take a look at the missile section to make sure current behavior is intentional.
Well, from what you've learned, maybe you can contrive a situation where the AI is acting irrationally in a more obvious way.

If what you're trying to fix is not obviously broken, you're most likely going to just break something else.

I tried the Strike Legion in the sim a few times (2 mark9s, 5 sabots, 4 piranhas, with vulcans removed), mostly vs dominators and conquests, and I didn't see any under-use of the sabots. Sometimes the legion would only use the guns, sometimes it would dip in to fire the sabots, sometimes it would burn drive up close, even up to point-blank range. With that many sabots, it does not necessarily disprove your initial suspicion, but it's an instance of a stock battle carrier, with sabots, working as intended, using its missiles as expected.
Title: Re: Missiles are underweighted when determining engagement range
Post by: Ekental on September 30, 2022, 04:58:55 AM
In the first post I wrote
So the range priority appears to be: Guns > Strike craft > Point defense > Missiles.

I think this behavior is a bug, as I think it's absurd that a craft would let 1 PD dictate engagement ranges before a medium missile.

Which means I think weapons follow a weighting system which determines their use. That the weighting is explicitly: all things equal Guns take precedent over Strike Craft, which take precedence over PD, which takes precedence over missiles.

So in your test of a Strike Legion the reason it shot the sabots is because you used 2 Mk 9s. Which are guns that have 900m range.

Guns > Strike craft > PD > Missiles. So your range was weighted to your guns. Mk9 guns have < range than Sabots. So you will always be in range for Sabots.

If you want to see those Sabots do nothing once ranges settle throw on Integrated Targeting Unit. 900m x 1.6 = 1440m. That will bump the legions engagement range to ~1550m and you can watch it: Burn Drive to <1km -> Slowly back up to 1.5km if the opponent will let it -> by default never use sabots unless opponent is faster and charges or overfluxes and the Legion charges.

The legion isn't a great test because its Burn Drive yolos it into opponents and it's so slow it takes a long time to settle into a range. That said if you look at the range a legion with the following equipment wants to be at via mod:


So umm... yeah still checks out to what was written in the 1st post.

If there's a weighting to weapons, which testing seems to imply, missiles are so far down that list it's not right. 1 Vulcan shouldn't convince a legion to get into kissing range when it also has 5 sabots.

EDIT: To be clear there are also finisher missiles and those are different from normal spammable missiles. Those don't fire till opponents are fluxed out or near to that or your boat is dying. (i.e. Harpoons)
Title: Re: Missiles are underweighted when determining engagement range
Post by: cytokine on October 01, 2022, 04:13:09 AM
I think we agree that the AI picks the wrong engagement distance at times.

And this error can contextual or not. It's can be either "Always too reckless", "Always too cautious", or "Too reckless/cautious given the context", with context being summarized into something like 'confidence level', which in a duel would be mostly determined by flux, DP values and armor values of the ship and its opponent.
I think most instances of poorly chosen engagement distance is contextual, even when it seems to be constant.

I don't think your Heron example is necessarily an example of a ship being "always too cautious", or necessarily of a poorly chosen engagement range. It's perhaps an unusual edge case. And if you make small tweaks to the code for unusual edge cases, you will likely produce many more edge cases, you just don't know when or how many. It turns into a game of whack-a-mole.
~
(https://i.imgur.com/yWznrS3.jpg)
(gryphon_Reckless.jpg)
A better 'poster boy' for this family of glitches might be what new players do with the Gryphon, equipping it with missiles and some PD, and then thinking it useless when it just keeps ramming into things and dying. The default load-outs for the Gryphon all have kinetics, but that doesn't prevent the 'noob trap' of expecting a missile ship not to go insane if equipped like one. And I don't know any explanation for that, other than that some weapon types take precedence over others, and others will be completely ignored. I.e, "PD > Missiles", as you put it.

(https://i.imgur.com/iiaK5XC.jpg)
(apogee_Reckless.jpg)
I have another example lying around. The pulse lasers on this apogee here will turn it into as much of a ramming ship as the Gryphon. I don't have a good explanation of why, as it can't even shoot straight ahead with them. And for your theory to explain it, it has to account for why the beam weapons get ignored once the pulse lasers are put on. So "Guns > Strike craft > Point defense > Missiles" isn't enough, the list would also need beam weapons crammed in there.
~
I think we agree that your initial theory has not been disproven.  And I think we agree that some of the code needs to be looked over. But I think it's hard to make a case for it, given the current evidence is mostly outliers, and given that there's no problem with the default variants.