BrettRyland / BDArmory

Gun turrets and other weapon systems for KSP
32 stars 23 forks source link

Active radar homing missiles should turn on their radar when losing lock before pitbull #628

Open ko-82 opened 1 month ago

ko-82 commented 1 month ago

Is your feature request related to a problem? Please describe. Active homing radar missiles (non fire&forget) time out and detonate shortly after the parent radar lost lock if the missile is outside active radar range.

Describe the solution you'd like I think they should turn on their own radar and fly to the target's last known location, or predict the target's location based on last known location, heading and velocity

Describe alternatives you've considered I'm not sure what other alternatives might be, but I'd love to hear yours.

BillNyeTheIE commented 1 month ago

Use INS guidance with terminal radar guidance. When you're using radar guidance you're using pure semi-active guidance while the missile isn't yet active, the missile requires a radar return to determine its trajectory. INS guidance (in real world terms, hybrid semi-active and command guidance) is what you're thinking of, where the missile is tracking its position and is being continuously updated regarding the target's position via datalink.

ko-82 commented 1 month ago

Use INS guidance with terminal radar guidance.

How can I do that? I've been searching the Githuib wiki but I don't think I've seen any mention of INS.

BillNyeTheIE commented 1 month ago

My bad, the actual targetingType is inertial. You'll need to also set up terminalGuidanceType = radar and terminalGuidanceShouldActivate = true, with terminalGuidanceDistance = whatever range you want the radar to activate at. You'll might also want to tweak gpsUpdates = which is the time between target data updates in seconds and inertialDrift = which is the drift of the INS system in m/s.

vv-23 commented 1 month ago

I set up the missile like that and it behaved pretty much like what I wanted, which is very nice. Only thing is that the AI doesn't react to it and doesn't do evasive maneuvers like notching or cranking or going cold, and the DLZ and launch range indicator don't show up on radar GUI. I wonder if I missed something.

BillNyeTheIE commented 1 month ago

The radar "remains" in track mode rather than guidance mode so the AI isn't aware that it was fired upon as no warning is given of the launch. Yeah, there is some stuff missing on the UI when using it for air-to-air, INS is a broader guidance mode than just for air-to-air missiles which is why I think it wasn't implemented originally.

BillNyeTheIE commented 1 month ago

In the process of looking at your issue, we've found a small bug in the inertial guidance code, if you're manually firing the missiles you will need to clear a GPS target that is accidentally not being cleared in the manual firing mode. This shouldn't matter if you're engaging a single target in a relatively short period of time and have the active radar activate at a good distance away from the target because it should still get you within the general vicinity of the target but it's not going to work if your engagement is happening over a long time or if you're engaging multiple targets. That's getting fixed for the next update.

ko-82 commented 1 month ago

I see. I suppose my ultimate desire is have a BVR fight where the AI shoots, defends then recommits instead of just pushing straight toward the enemy. The addition of kinematic missile evasions was amazing and I love it, but it ran into the issue of mixed SARH/active radar missiles timing out and self destructing when the fighter loses lock during an evasive maneuver. Using inertial targeting fixed the self destructing issue but the AI won't react to or evade the missile.

I wonder if there's a way to combine radar and inertial guidance. I've been looking at the code and I'm curious the condition branch in MissileBase.cs:917 (if radar not active and (target outside range or boresight)) can be reworked to turning on the missile's radar and fly to last known location (like inertial guidance) instead of nullifying the existing target. But I'm not super knowledgable about these things so I might just be talking nonsense 😄

BillNyeTheIE commented 1 month ago

Inertial guidance is supposed to do what you're talking about, that's the entire point of it. Semi-active radar guidance is not supposed to have that level of knowledge regarding the target, which is why it's a separate guidance type. Code-wise it's not impossible, but it won't be done on the basis of how the missiles work. SuicidalInsanity told me though that for the next update the AI will react to inertial missiles and evade, but it will only do so if you have a RWR with omniDetection = true or have an IRST that can detect the missile.

ko-82 commented 1 month ago

Ah I see. That'd be awesome :D. I shall be looking forward to the update