BrettRyland / BDArmory

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

Orbital AI Improvements & Missile Fixes #637

Closed josuenos closed 2 days ago

josuenos commented 3 weeks ago
josuenos commented 2 weeks ago

Have you resolved the changes in the PR that Hatbat mentioned in https://discord.com/channels/720416076571082863/720423078533791854/1250429090914238536 . We can't use anything that comes from after he makes the license switch from CC-BY-SA to All Rights Reserved.

Yes, license is still CC-BY-SA, it has not switched yet.

BrettRyland commented 1 week ago

I'm still seeing craft that are on escape trajectories switching back and forth between intercepting targets and correcting their orbit.

I think part of the issue with craft falling into atmospheres is the distinction between unsafe and dangerous orbits. In CheckOrbitDangerous you're just checking whether the craft is below the minSafeAltitude, while fixing the orbit due to CheckOrbitUnsafe being true is dependent on whether there's a nearby target to intercept. The problem is then that if there's a nearby target, the vessel won't correct its orbit until it actually starts falling into the atmosphere, at which point it's basically too late (and requires the most Δv). I think changing the condition in CheckOrbitDangerous to something like

return (o.altitude < minSafeAltitude) || (o.PeA < 0.8f * minSafeAltitude && o.timeToPe < o.timeToAp);

might help (i.e., already below the safe altitude or heading downwards with a periapsis 20% below the safe altitude).