Would I be correct to summarize as follows:
General agreement: Any patch that (significantly) alters retail balance = bad. Afaik Mastadon's original patch falls under this category, and I believe this is what Dragon and NGTM-1R have been talking about.
An SCP addition already exists which should allow fine-tuning of this without breaking retail: +target lead scalar. However as indicated by some experimentation by Qent, that feature doesn't work. At worst, a patch to make this SCP addition work as described might affect the balance of a few mods.
This is correct.
Mastadon's original patch (that is no longer attached to any of his posts as far as I can tell) would have broken retail balance because it would have "fixed" every swarm missile.
The current patch in the OP just fixes +target lead scalar:. +target lead scalar: is a SCP addition added (it was added in revision 5502 by Wanderer) for 3.6.12. That is, compatibility of retail is not affected by the currently proposed solution. Compatibility of any mods that were built against 3.6.11 and newer may be affected if this flag is used on swarm missiles. However that is assuming that anyone actually uses this flag on swarm missiles because if they had they would have noticed that is has no effect at all. There is no mantis ticket on this bug (closed or otherwise); there is no (public) post that talks about this weapon flag (except for this thread).
The above combined with the fact that SCP does not guarantee compatibility of any SCP feature regardless of its release status (though we are less likely to break something that has seen an official release, like this feature has) means that the simple fix of just making the existing flag +target lead scalar: work with a swarm missile is the correct fix.
I have to agree with Droid803, the current alternative patch proposed by Mastadon that adds +swarmLeadTarget is of no value to SCP because the feature is attempting to work around a problem that doesn't actually exist and just adds resource and support requirements that are not necessary.
If I am understanding you correctly, you are stating that when
+Target Lead Scaler is set to a non-zero value, the missile is supposed to lead to it's intended target, correct?
If this understanding is correct, then
+Target lead Scaler does
not work for swarm missiles because after the "lead" value is calculated for a missile, a check is made at the end of weapon_home() to see if a missile is a swarm missile:
if ( wp->swarm_index < 0 ) {
ai_turn_towards_vector(&target_pos, obj, frame_time, wip->turn_time, NULL, NULL, 0.0f, 0, NULL);
vel = vm_vec_mag(&obj->phys_info.desired_vel);
vm_vec_copy_scale(&obj->phys_info.desired_vel, &obj->orient.vec.fvec, vel);
}
Patching the code to check for whether the WIF2_VARIABLE_LEAD_HOMING flag is set for a swarm missile wouldn't work if a mod creator wanted to have swarm missiles have a lead scaler of 1.0, which is documented as
default value for all aspect missiles. This is because that flat is unset for cases where the Target Lead Scaler is set t0 1.0:
if (optional_string("+Target Lead Scaler:"))
{
stuff_float(&wip->target_lead_scaler);
if (wip->target_lead_scaler == 1.0f)
wip->wi_flags2 &= ~WIF2_VARIABLE_LEAD_HOMING;
else {
wip->wi_flags2 |= WIF2_VARIABLE_LEAD_HOMING;
wi_flags2 |= WIF2_VARIABLE_LEAD_HOMING;
}
}
The only three options that come to mind to enable swarm missiles to properly lead their targets w/o breaking the cardinal rule are:
- Don't turn off the WIF2_VARIABLE_LEAD_HOMING flag for missiles with a default target lead scaler and store the new homing position to wp->homing_pos when the WIF2_VARIABLE_LEAD_HOMING flag is set.
- Add a special flag for swarm missiles to indicate that the mod designer wants them to lead in cases where the target lead scaler is set and store the new homing position to wp->homing_pos when that special flag is set.
- Add a tag such as +swarmerLeadTarget and store the new homing position to wp->homing_pos when that flag is set.
While the first solution would probably work, doing so will increase the missile lead calculation time for all missiles by for instruction cycles (a multiplication operation costs two instruction cycles if I remember correctly and there are two multiplication operations executed...see below:
While four cycles might not sound like much, this code is executed up to every millisecond, so it adds up quickly. The second option should also work, and sounds like the best of the three options the more I think about it.
If you believe that the problem that I am describing with swarm missiles doesn't exist, I would encourage you to download the two attached files and run them with the latest and greatest version of FSO (I'm using 3.6.14 RC6). The first one modifies the stats for the swarm missiles so as to make the bug very easy to see. The second file is a test mission that starts you off with being able to fire swarm missiles at a freighter's 3 o-clock position. If the swarm missiles were leading their target at all, they would be roughly turning towards the ships target lead indicator. Instead, however, they behave like FS1-style missiles and turn directly towards the ship (that is, enter pure pursuit mode).
[attachment deleted by a ninja]