scp-fs2open / fs2open.github.com

Origin Repository for SCP FreeSpace 2 Open
https://www.hard-light.net/
Other
407 stars 164 forks source link

Lag-pursuit option for aspect-seeking missiles #6309

Closed Goober5000 closed 2 months ago

Goober5000 commented 2 months ago

Fusion mentioned that aspect-seeking missiles fly lead-pursuit in FS2 but lag-pursuit in FS1. For greater fidelity, FSPort would like the option to switch to lag-pursuit for certain missions. The mission "The Hammer and the Anvil" is much harder in FSPort than in FS1 and this could be one reason why.

This should be configurable via an ai_profiles flag so that different missions can use different pursuit techniques.

Baezon commented 2 months ago

Would it not be sufficient to simply have a interceptor variant for use in that mission? Not sure I'm a fan of just having ai profiles arbitrarily modify a single weapon value when existing methods can do the same thing without much hassle.

Goober5000 commented 2 months ago

That sounds like it would be fine.

naomimyselfandi commented 2 months ago

Isn't this already configurable?

Goober5000 commented 2 months ago

I guess it is. Thanks, I didn't know about that field.

Is there some sort of rubric for calibrating these values? From reading that description, my assumption is that I should use -1.0, to correspond with the +1.0 for lead-pursuit. I did a search on +Target Lead Scaler: in downloaded mod files; there's only one instance of a negative number and it's not for a fighter-based weapon.

I also did a search for target_lead_scaler in the code and found two potentially incompatible checks. The first is for heat seekers and the second is for aspect and javelin.

if (optional_string("+Target Lead Scaler:"))
{
    stuff_float(&wip->target_lead_scaler);
    if (wip->target_lead_scaler == 0.0f)
        wip->wi_flags.remove(Weapon::Info_Flags::Variable_lead_homing);
    else {
                    wip->wi_flags.set(Weapon::Info_Flags::Variable_lead_homing);
    }
}
if (optional_string("+Target Lead Scaler:"))
{
    stuff_float(&wip->target_lead_scaler);
    if (wip->target_lead_scaler == 1.0f)
        wip->wi_flags.remove(Weapon::Info_Flags::Variable_lead_homing);
    else {
        wip->wi_flags.set(Weapon::Info_Flags::Variable_lead_homing);
    }
}

The discrepancy dates all the way back to the feature's introduction in c19d78f82f. I'm not familiar enough with the homing code to know whether this is a true copy-paste error or if this is really how the flags need to be handled.

EatThePath commented 2 months ago

I think the default steering behavior for heat seekers and aspect seekers is different, which probably makes that logic sensible.

From what I can tell with a little googling, what I had been thinking of as 'lag pursuit' seems to be more accurately termed 'pure pursuit', that is simply flying directly towards the target's current position. Actual lag pursuit looks to be a more complicated thing where you turn wider than your target to better catch them after the turn. That was all in dogfighting stuff, maybe it's different in missile contexts. Regardless I imagine lag pursuit in our context has been used to mean the pure pursuit concept, which should be a scalar of 0.

A negative scalar looks like it should be viable, I don't see it getting sanitized anywhere and it could lead to interesting behavior, but probably not FS1 mimicking behavior.

Goober5000 commented 2 months ago

Gotcha. Makes sense. Woolie Wool ran some tests and reported that a value of 0.0 seems to reproduce the FS1 behavior well.

Thanks all for your help, everyone. I'll close this as complete.