Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Mastadon on May 17, 2012, 02:11:41 am

Title: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 02:11:41 am
Hi SCP coders!

I've been following the Source Code Project for a while now and have decided that I'd like to join in on the fun.

For my first contribution to the SCP community, I present to you a patch that causes swarm missiles to lead to their target.

[attachment deleted by a ninja]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: niffiwan on May 17, 2012, 04:06:57 am
Thanks for the patch, however this would change balance fairly significantly - why use harpoons when you've got lead-tracking hornets? :)  This would be more useful as a weapon flag that could modify the behaviour of swarm missiles.  Having said that, there is the corkscrew flag which effectively gives lead-tracking "swarmers", albeit with slightly different launch characteristics.

If you're keen on joining the SCP, we like bugfixes, some of these would be useful to look at   ;)

http://scp.indiegames.us/mantis/view.php?id=2649
http://scp.indiegames.us/mantis/view.php?id=2637
http://scp.indiegames.us/mantis/view.php?id=2605
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 17, 2012, 08:10:09 am
Actually, this has already been implemented. +Target Lead Scaler: controls whether a missile leads it's targets, lags behind or just uses pure pursuit path.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 08:39:20 am
I think there's a more general note to be made about the aims of the SCP here - it's a core rule of the project that nothing should ever change retail behavior by default.

Creating a system that would allow modders to make Hornets fly lead pursuit if they wanted is, of course, totally cool. It just shouldn't be on by default.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 17, 2012, 08:46:32 am
Agreed. Though you should also check if the system you're trying to implement doesn't already exist (which is the case here, since +Target Lead Scaler: does exactly the same thing as this, except it allows more customization).
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 09:01:20 am
Agreed. Though you should also check if the system you're trying to implement doesn't already exist (which is the case here, since +Target Lead Scaler: does exactly the same thing as this, except it allows more customization).

I'm sure that's a really encouraging thing for a new coder to hear. Please be more considerate.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Goober5000 on May 17, 2012, 10:45:54 am
Welcome Mastadon!

:welcome:


For my first contribution to the SCP community

Ooh, you have more? ;7
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 11:52:40 am
Thanks for the patch, however this would change balance fairly significantly - why use harpoons when you've got lead-tracking hornets? :)  This would be more useful as a weapon flag that could modify the behaviour of swarm missiles.  Having said that, there is the corkscrew flag which effectively gives lead-tracking "swarmers", albeit with slightly different launch characteristics.

If you're keen on joining the SCP, we like bugfixes, some of these would be useful to look at   ;)

http://scp.indiegames.us/mantis/view.php?id=2649
http://scp.indiegames.us/mantis/view.php?id=2637
http://scp.indiegames.us/mantis/view.php?id=2605

The biggest reason you would still want to use harpoons over hornets are when you are dogfighting fast and maneuverable targets, such as Manticores and Maras. Another reason why Harpoons still remain an essential part of a fighter pilot's missile diet is that even with hornet's "leading" their target, they are still inherently inaccurate due to the fact that the swarming code has the swarm missile turn towards the homing position plus certain vector offsets from the homing position as determined in the swarm_update_direction(*objp, frametime) function. In my field testing of the new swarm tracking code, hornets still routinely miss fast and maneuverable targets such as Manticores due to the fact that the swarm missile is never truly turning towards the intended homing position. The fact that swarm missiles are never fully turning towards the homing position also causes it to occasionally miss larger targets, such as moving freighters and possibly moving light cruisers.

In short, if you load up a heavy assault fighter with nothing but hornets thinking you'll never need the fast, nimble, and accurate punch of a harpoon missile, you'll be in for an unpleasant surprise when you try and dogfight anything faster than a Basilisk.

I'll respond to some of the other comments in separate posts.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 17, 2012, 11:56:29 am
Still, it alters the way gameplay works, and this is generally what SCP tries not to do. None of SCP modifications actually alter retail behavior by default, only add options for mods to enable. To think of it, this could come in handy as AIProfiles flag. It'd certainly save people some hassle with defining the lead scaler for a large number of different missiles, in case of TC mods which are not constrained like SCP is.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: The E on May 17, 2012, 12:11:20 pm
If this is going to be a flag, weapons.tbl is the logical place to put it in.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 12:29:46 pm
Actually, this has already been implemented. +Target Lead Scaler: controls whether a missile leads it's targets, lags behind or just uses pure pursuit path.

I did some checking on how the +Target Lead Scalar flag is implemented and discovered that the parse_weapon(subtype, replace) indeed processes the +Target Lead Scalar flag at line 1605 of weapon.cpp (as of r8789):

Code: [Select]
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 variable the target lead scalar gets stored to (wip->target_lead_scalar, I think) is utilized at exactly one point in the weapon_home( *obj, num frame_time) function: at line 4277 (again, as of r8789):

Code: [Select]
// Only lead target if more than one second away.  Otherwise can miss target.  I think this
// is what's causing Harbingers to miss the super destroyer. -- MK, 4/15/98
if ((old_dot > 0.1f) && (time_to_target > 0.1f)) {
if (wip->wi_flags2 & WIF2_VARIABLE_LEAD_HOMING) {
vm_vec_scale_add2(&target_pos, &hobjp->phys_info.vel, (0.33f * wip->target_lead_scaler * MIN(time_to_target, 6.0f)));
} else if (wip->wi_flags & WIF_LOCKED_HOMING) {
vm_vec_scale_add2(&target_pos, &hobjp->phys_info.vel, MIN(time_to_target, 2.0f));
}
}


The wip->target_lead_scalar variable is used to modify a local, l-valued vec3d called target_pos, which is later used at line line 4324 (again, r8789) to turn the missile to the leaded target:

Code: [Select]
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);

}

However, in the unpatched code, the target_lead_scalar is never used again anywhere else in the codebase---I know because I used grep -n 'target_lead_scaler' $(find . -type f) inside the code directory of the project to find all usages of the target_lead_scalar attribute. This would mean that even if a swarm missile supplied this flag it would never actually be leaded towards the target. That's what my patch fixes:
Code: [Select]
if ( wp->swarm_index < 0 ) {
// ...

}
    else {
        // Mastadon: store target_pos back to wp->homing_pos so that the swarm_update_direction(*objp, frametime) code does it's
        //           magic on the _leaded_ values for the target, not the _actual_ target, since we want the swarm missile to
        //           actually lead into the target, not vainly aim directly at the ship.
      wp->homing_pos = target_pos;
    }
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 12:45:28 pm
I think there's a more general note to be made about the aims of the SCP here - it's a core rule of the project that nothing should ever change retail behavior by default.

Creating a system that would allow modders to make Hornets fly lead pursuit if they wanted is, of course, totally cool. It just shouldn't be on by default.

I read The cardinal rule (http://www.hard-light.net/forums/index.php?topic=74840.msg1479353#msg1479353) and other "read me first" posts too, but in this case I always felt that swarm missiles not even trying to lead their targets to be a bug in Freespace since FS1, and therefore felt that my patch would be fixing a fundamental flaw in how the retail engine treats swarm missiles rather than merely changing an intended behavior of FS2 retail.

But the more I think about it and the more I read comments from other members, the more I tend to agree with the critics: this sort of fix should only be turned on via a command-line flag, since it, even though arguably fixes a bug in the FS2 retail engine, results in significant gameplay changes from FS2 retail.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Kolgena on May 17, 2012, 12:51:00 pm
Remember that what we think is a fundamental flaw can massively change game balance, probably making certain campaign missions literally impossible to complete.

Think of how Trebuchets are utterly broken in that AI can't use them against any targets. However, someone in the past "fixed" this, at the cost of making shivan fighters (most of which pack trebs by default) insanely overpowered. That "fix" didn't last very long.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: headdie on May 17, 2012, 12:52:32 pm
Though there are others, there are 2 key reasons why the rule exists.

1st the retail campaign was balanced with these bugs in place so by fixing them you start unbalancing the campaign and with things like missiles where the AI uses the same missiles it wont always be in the player's favour.

2nd if you allow "bug fixes" to affect retail, where do you draw the line between fundamental flaw and minor irritation?

By abiding by the rule you change nothing in the campaign so when we all replay it it is as we remember it and when new players find the game they have the same experience we all did.

edit:

and as Kolgena says you dont risk breaking the campaign
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 12:53:36 pm
You might even be right about swarm behavior being a bug, but unfortunately there are a lot of weird behaviors in FreeSpace that might well be bugs, but which we still can't just out-and-out fix because they might alter gameplay balance. For example, at one point I believe it was concluded that beams piercing shields was a bug - but this 'fix' was quickly reverted because it altered the balance of many missions.

Fortunately we aren't in the completely idiotic position of being unable to fix anything; we just allow the fixes to be swapped on by modders. We try to avoid command-line flags that are set on the user side. Instead, flags set in weapons.tbl entries (for an individual weapon), AI profile entries (for global mission behavior), or mod.tbl (for an entire mod) allow content designers to control these features without worrying about whether a user has entered the right command line flag.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 17, 2012, 12:54:48 pm
Quote
However, in the unpatched code, the target_lead_scalar is never used again anywhere else in the codebase---I know because I used grep -n 'target_lead_scaler' $(find . -type f) inside the code directory of the project to find all usages of the target_lead_scalar attribute. This would mean that even if a swarm missile supplied this flag it would never actually be leaded towards the target. That's what my patch fixes:
Ah, so you mean that your patch makes +Target Lead Scaler: apply to swarm missiles, which it didn't do before? That part is definitely worth implementing, if I understood it right.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Legate Damar on May 17, 2012, 01:12:35 pm
Why can't the ai use Trebuchets?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Kolgena on May 17, 2012, 01:14:25 pm
Indeed. I can see mods enjoying the ability to have swarm missiles lead without doing funky corkscrew acrobatics.

AI can't use trebs because the missile has conflicting flags telling AI to:
1.Only use it on cap ships. (more accurately described as never using it against anything fighter or bomber-sized)
2. Only use it on bombers.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 01:23:12 pm
Quote
However, in the unpatched code, the target_lead_scalar is never used again anywhere else in the codebase---I know because I used grep -n 'target_lead_scaler' $(find . -type f) inside the code directory of the project to find all usages of the target_lead_scalar attribute. This would mean that even if a swarm missile supplied this flag it would never actually be leaded towards the target. That's what my patch fixes:
Ah, so you mean that your patch makes +Target Lead Scaler: apply to swarm missiles, which it didn't do before? That part is definitely worth implementing, if I understood it right.

If I understand the codebase properly---and that's a big if---yes, my patch causes the +Target Lead Scalar to apply to swarm missiles, which are currently not applied to swarm missiles.

However, before doing an "svn ci" on this patch, I think that we should consider what Kolgena, headdie, and General Battuta are saying here: that by fixing this apparent bug, we may wind up completely destroying the balance of both :v:'s campaigns and community campaigns that implicitly rely on swarm missiles not being able to reliably hit a target moving faster than a cruiser.

As for how to go about incorporating my fix, one solution might be to add a weapons.tbl flag to swarm missiles that we want to have lead their targets. However, I personally would also like to be able to turn on or off swarm missile leading at-will via a command-line switch. So before I go off implementing one or both of these solutions, what would the SCP programmers prefer I do?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Kolgena on May 17, 2012, 01:26:45 pm
I'm not a coder, but from what I know, the table option is vastly preferred over launcher flags, which are never used for gameplay-changing variables (unless camera FOV counts).
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: headdie on May 17, 2012, 01:32:29 pm
I think it's so the player cant break a mod by disabling a key feature
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 01:49:11 pm
Absolutely the table option. You can always just mod the weapons tables for your personal use.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Legate Damar on May 17, 2012, 01:52:46 pm
Indeed. I can see mods enjoying the ability to have swarm missiles lead without doing funky corkscrew acrobatics.

AI can't use trebs because the missile has conflicting flags telling AI to:
1.Only use it on cap ships. (more accurately described as never using it against anything fighter or bomber-sized)
2. Only use it on bombers.

Oh, I see. That's easy to fix.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 01:55:00 pm
Absolutely the table option. You can always just mod the weapons tables for your personal use.

Would implementing both options be considered acceptable for inclusion into the SCP?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 01:58:57 pm
I can't speak for the coders, but I know there has been a huge effort to reduce the number of command line flags in recent years. Also as a content producer for a major mod, I would be really frustrated with a launcher option, because of the possibility that a user could say 'hey, your missions are all broken!' and then it turns out they've had 'swarm missiles use lead pursuit' turned on and it's somehow made all my bombs behave differently.

I don't want to be discouraging, but I would really discourage a command line flag. In general I would say that command line flags should only alter aesthetic, visual, or interface elements, never anything gameplay-relevant.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: The E on May 17, 2012, 02:08:51 pm
Command line flags are depreciated, more or less. If anything, we want to reduce their number as much as we can. Not to mention that Battuta is correct, having more than one place to change a given setting is a recipe for disaster.
Title: Swarmers lead target patch, version 2.0
Post by: Mastadon on May 17, 2012, 02:50:38 pm
I have gone ahead and implemented conditional logic that allow the swarm missile tracking to be enabled either by the command-line switch "-swarms_lead_target " or by a weapon author / campaign editor's inclusion of the following new optional sub-flag for the $Swarm flag: the "+swarmLeadTarget" flag.

To use the +swarmLeadTarget, just add it below a $Swarm: flag, like so:
Code: [Select]
$Swarm: 4
+swarmLeadTarget;

To test out the +swarmLeadTarget; sub-flag, you can either modify your weapons.tbl file or use the attached weapons.tbl file, which modifies the FS2 reatail weapons.tbl file entry for the Hornet swarm missiles to use the +swarmLeadTarget sub-flag.

[attachment deleted by ninja]

[attachment deleted by a ninja]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Legate Damar on May 17, 2012, 03:06:33 pm
How is this patch applied to the game? Do you need to download a new build?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 03:15:12 pm
How is this patch applied to the game? Do you need to download a new build?

You apply this patch to a working copy of the FS2 source code tree. One item to note: the patch was originally generated against r8789, so if you run into problems using the patch, update your working copy to r8789, then apply the patch, then update to current and Subversion will auto-merge the changes.

If you don't know where to get the source code for FS2, read this post (http://www.hard-light.net/forums/index.php?topic=74840.msg1479352#msg1479352).
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Legate Damar on May 17, 2012, 03:18:27 pm
I think I'd rather wait until a build is released that incorporates it
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: The E on May 17, 2012, 03:19:25 pm
Patches are for coders only.

As for the patch itself: Command-line flags, especially gratuitous ones like this, will not be included. Ever. We used to have a few of these, and they are nothing but trouble.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 03:27:32 pm
Patches are for coders only.

As for the patch itself: Command-line flags, especially gratuitous ones like this, will not be included. Ever. We used to have a few of these, and they are nothing but trouble.

Ok. I've stripped out the command-line switch code and left in the weapons.tbl modifications. The patch is good against r8792.

[attachment deleted by a ninja]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Cyker on May 17, 2012, 03:41:47 pm
*puts his hand up*

Uhh, did I miss something here?

I'm pretty sure we already have lead-tracking swarm missiles - They are called Tornados...
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 03:44:38 pm
*puts his hand up*

Uhh, did I miss something here?

I'm pretty sure we already have lead-tracking swarm missiles - They are called Tornados...

Those are corkscrew missiles. The engine handles them differently, they don't use the swarm flag.
Title: Re: Swarmers lead target patch, version 2.0
Post by: Dragon on May 17, 2012, 05:18:24 pm
To use the +swarmLeadTarget, just add it below a $Swarm: flag, like so:
Code: [Select]
$Swarm: 4
+swarmLeadTarget;
Why is that needed? I though that it'd be enough to just make +Target lead scaler: work on swarm missiles. I'm asking because somebody may want them to use pure pursuit. This flag, as I understand it, only allows toggling between lead and lag pursuit.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Sushi on May 17, 2012, 05:26:41 pm
Alright, let's slow down and concretely determine the following:

Does or does not +Target lead scaler work correctly with swarm missiles?

If it is indeed the case that it doesn't, then IMO the correct solution is to fix the code so that it does. +Target lead scaler is an SCP flag, and a relatively recent one, so I think we can implement a bug fix to make it work correctly for all missiles without needing any new table or command line flags.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Cyker on May 17, 2012, 05:27:53 pm
@Bats - Ahh, I see! I didn't notice that...! Learn something new every day :)

Hrm... now you've got me wondering how that superswarmy thing in (I think) one of the JADs was implemented...
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: karajorma on May 17, 2012, 05:40:06 pm
Alright, let's slow down and concretely determine the following:

Does or does not +Target lead scaler work correctly with swarm missiles?

If it is indeed the case that it doesn't, then IMO the correct solution is to fix the code so that it does. +Target lead scaler is an SCP flag, and a relatively recent one, so I think we can implement a bug fix to make it work correctly for all missiles without needing any new table or command line flags.

I was about to say the same thing.

The SCP doesn't change the behaviour of retail. We can however change the behaviour of SCP additions. Especially if they have a bug, and especially if the bug is recent.


Sorry that you're having a hard time with such a simple patch Mastadon. If I were you, I'd move on to another feature/bug and let the SCP coders decide how we're going to implement your fix. You'll still get the credit and you won't have to worry about changing how it works every 5 minutes. :D
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 17, 2012, 06:18:13 pm
Alright, let's slow down and concretely determine the following:

Does or does not +Target lead scaler work correctly with swarm missiles?

If it is indeed the case that it doesn't, then IMO the correct solution is to fix the code so that it does. +Target lead scaler is an SCP flag, and a relatively recent one, so I think we can implement a bug fix to make it work correctly for all missiles without needing any new table or command line flags.

I was about to say the same thing.

The SCP doesn't change the behaviour of retail. We can however change the behaviour of SCP additions. Especially if they have a bug, and especially if the bug is recent.


Sorry that you're having a hard time with such a simple patch Mastadon. If I were you, I'd move on to another feature/bug and let the SCP coders decide how we're going to implement your fix. You'll still get the credit and you won't have to worry about changing how it works every 5 minutes. :D

In a nutshell, no, the +Target Lead Scalar does not work with swarm missiles, since the only time the target lead scalar information is used is to modify an l-valued vec3d called target_pos in the weapon_home method, which is then used to change the direction of non-swarm missiles. However, swarm missiles are not affected since neither the value of target_pos is stored back to the wp->homing_pos in the case of swarm missiles nor is the wip->target_lead_scaler value used at all in the swarm homing code.

BTW, no problems about the hard time for my first patch. I've learned a few useful tips for streamlining the submission process for patches to the SCP community. Unless one of the SCP members needs additional input from me regarding my patch, I'm going to move on to other features / bugs.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Ace on May 17, 2012, 07:38:26 pm
It'd be good to make sure that +target lead scalar works properly with hornets and tornadoes then, overriding default behaviors as necessary.

For instance Diaspora uses tornado flags on a bunch of weapons to give that slight trail jerkiness seen in the show on some weapons. So it'd be nice to have trailing tornadoes for some cases.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on May 17, 2012, 08:48:04 pm
It'd be good to make sure that +target lead scalar works properly with hornets and tornadoes then, overriding default behaviors as necessary.

For instance Diaspora uses tornado flags on a bunch of weapons to give that slight trail jerkiness seen in the show on some weapons. So it'd be nice to have trailing tornadoes for some cases.

The technical terms are 'swarm' and 'corkscrew' for Hornet behavior and Tornado behavior respectively.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: X3N0-Life-Form on May 18, 2012, 02:20:23 am
As for how to go about incorporating my fix, one solution might be to add a weapons.tbl flag to swarm missiles that we want to have lead their targets. However, I personally would also like to be able to turn on or off swarm missile leading at-will via a command-line switch. So before I go off implementing one or both of these solutions, what would the SCP programmers prefer I do?
Well, I think that's the sort of things you'll want to place in ai_profiles or game_settings tables.
Something like: $Swarm_missiles_always_lead:    YES ;; default: NO
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Qent on May 18, 2012, 10:15:17 am
After a quick test, I could distinguish no difference among lead 0.0, 1.0, and 10.0 for modified Hornets, so thank you for that.

A global flag would probably belong in ai_profiles yes, but I (am not an SCP programmer) really don't like having a global flag at all. It's redundant (unlike the Treb flag) because you will also be able to set the lead scalar to 1.0.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: The E on May 18, 2012, 10:21:23 am
This flag, by necessity, needs to be a per-weapon flag.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Sushi on May 18, 2012, 11:59:54 am
Do we really need a flag for this? What exactly will break if the lead scaler setting suddenly works as advertised for Hornets?

This seems like a straightforward fix of an oversight in the lead scaler feature. I'm pretty sure it's a 3.6.13/3.6.14 feature anyway, so we have no obligations of backwards compatibility to make us introduce yet another flag.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 18, 2012, 12:29:55 pm
My thoughts exactly. Just implement it as a fix to the lead scaler instead of messing around with flags.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: The E on May 18, 2012, 01:02:35 pm
Do we really need a flag for this? What exactly will break if the lead scaler setting suddenly works as advertised for Hornets?

This seems like a straightforward fix of an oversight in the lead scaler feature. I'm pretty sure it's a 3.6.13/3.6.14 feature anyway, so we have no obligations of backwards compatibility to make us introduce yet another flag.

Flag, option, straight fix, whatever. As long as it is neither a global flag nor commandline option, I am happy.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 18, 2012, 01:44:40 pm
Do we really need a flag for this? What exactly will break if the lead scaler setting suddenly works as advertised for Hornets?

This seems like a straightforward fix of an oversight in the lead scaler feature. I'm pretty sure it's a 3.6.13/3.6.14 feature anyway, so we have no obligations of backwards compatibility to make us introduce yet another flag.

Theoretically, a mission whose difficulty is balanced partially on the basis of Swarm-type missiles (namely, the Hornet, Hornet D, Hornet#Weak, and MX-52) not leading their targets. In practice, however, I have found in my somewhat limited testing that having swarm missiles lead their target tend to increase the combat effectiveness of the missiles from almost completely useless against anything smaller than a cruiser to being effective against anything at least as big as a heavy fighter but smaller than a corvette, with a swarm missile having limited usefulness against space superiority and interceptor class fighters.

In fact, leading swarm missiles are still largely ineffective against space superiority and interceptor class fighters due to the simple fact that swarm missiles, well, swarm rather than fly directly towards the target's lead point. Using the Hornet as an example, I estimate that with swarmers set to lead to their target, the hit rate of swarm missiles against anything smaller than a heavy fighter, outside of a head-on engagement, is roughly 10% -- 20% verses an AI opponent. In head-on engagements, the hit rate is closer to 70% -- 80%.

In summary, even with swarm missiles leading to their target, they shouldn't have too great an effect on the balance of missions...especially since enemy swarmers will lead towards you as well.

To help illustrate these changes, I've attached a couple of tbm files that use the +swarmLeadTarget sub-flag as well as a mission I designed for the explicit purpose of testing changes to swarm missile homing. I would also encourage you to test out these changes against a :v: mission that utilizes swarm missiles heavily, such as "Into the Lion's den" (Freespace 2, 1st Shivan mission). You will of course also need to apply my swarmer patch patch and recompile FSO to do any testing.

[attachment deleted by a ninja]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on May 18, 2012, 01:50:04 pm
Sorry, but even if it doesn't change balance all that much, it's still against FSO policy. It's up to mods if the decide to make Hornets lead their target, and you can enable them to do that by simply fixing +Target Lead Scaler: for swarmers. Something that affects default behavior like that will never get into trunk.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Goober5000 on May 18, 2012, 02:39:34 pm
Dragon, please stop making yourself annoying by carping on an issue that everyone is aware of.

Has anyone besides Mastadon actually applied the patch and played some tests?  I'll plan on looking at this later today, as Mastadon's latest attachments are intriguing.  At this time I think a weapons.tbl flag would be the best option.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: karajorma on May 18, 2012, 06:30:43 pm
I'll see Goober's "we know about it" and raise you a "He's just plain wrong" :p

Sorry, but even if it doesn't change balance all that much, it's still against FSO policy. It's up to mods if the decide to make Hornets lead their target, and you can enable them to do that by simply fixing +Target Lead Scaler: for swarmers. Something that affects default behavior like that will never get into trunk.

Bollocks. Seriously Dragon, stop talking about things you know nothing about. Given that several SCP coders have already commented on how this might simply be added as a fix without any extra flags I really don't know why you think you have the authority to tell us all that we're wrong and you're right.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: NGTM-1R on May 18, 2012, 07:10:46 pm
I really don't know why you think you have the authority to tell us all that we're wrong and you're right.

'cuz he's, uh, right, and you're wrong. Changing the fundamental gameplay like this has traditionally been verboten; beam fade as default got sunk over this sort of thing. Has that changed?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: karajorma on May 18, 2012, 07:19:41 pm
Seriously?

You're going to contradict myself, The_E and Sushi? Even after Sushi flat out stated exactly why? :rolleyes:
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: jr2 on May 18, 2012, 07:23:27 pm
I think everyone needs to re-state what they are trying to say.  In very clear, concise, explaining it with triple-redundancy terms.  'Cause I think there's a misunderstanding here.  Although it might just be me...
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: NGTM-1R on May 18, 2012, 07:38:16 pm
Seriously?

You're going to contradict myself, The_E and Sushi? Even after Sushi flat out stated exactly why? :rolleyes:

Yeah, though actually, I'm just contradicting you. Just like I contradicted a bunch of coders on the beam fade issue, which didn't actually break a single retail mission, but which had the potential to break missions designed for retail. In the end I was judged right there too.

The lag-pursuit curve on the Hornet is not a bug, Karaj. It's a feature of the engine. Simply because you/Mastadon/whoever doesn't like it does not change this fact.

Or are you still castigating Dragon for something that everyone was agreeing to on the first page and which the discussion has shifted away from? He's still correct here as he was, but apparently you're not paying attention to what he's actually talking about and assume it's all on this page because you can't be bothered to read.

Granted he can't be bothered to read (I think, we do seem to have moved to fixing lead scalar and away from altering classic behavior of swarm missiles, although it's hard to tell) either, but you could try perhaps explaining that to him and everyone else instead of acting like a jackass.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: karajorma on May 18, 2012, 07:38:54 pm
NGTM-1R, you're wrong. The coders know you're wrong. Frankly, I don't see the need to explain why again.

I think everyone needs to re-state what they are trying to say.  In very clear, concise, explaining it with triple-redundancy terms.  'Cause I think there's a misunderstanding here.  Although it might just be me...

There's no misunderstanding. Just people who know nothing about the subject trying to act as if they do.

Dragon has argued both in favour of fixing it without any other flags and then 2 posts later argued that such a patch is impossible as soon as someone else said the same thing. NGTM-1R is just being NGTM-1R and butting in on a subject he knows **** all about after it's been it's been clearly stated that the SCP reserve the right to alter features that were added in this cycle.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: NGTM-1R on May 18, 2012, 07:40:30 pm
It might help if you, you know, learned to read.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: NGTM-1R on May 18, 2012, 07:41:36 pm
Because it's really sad when Goober has a better grasp of what various people are discussing than you and you feel a need to insult random people because of it.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Zacam on May 18, 2012, 07:59:12 pm
Okay, here is a nice tall frosted glass of "Everybody Chill"

Things got a bit muddled somewhere and context got lost. Dragons response of altering code not being in SCP alignment is correctly attributable to Mastadons multi-patch post that would also have deviated the behaviour of retail missiles, not just the SCP affected flag under discussion.

However: There are also many an instance where coders (and potential coder candidates) conversations get skewed by non-coders attempting to contribute in a "backseat coding" manner that usually causes frustration, -even when they may be right- by nature of them not being coders or contributors. And while we do appreciate feedback and collaboration, we don't need a non-SCP member declaring what the SCP's basic tenants are. We know what they are, we are a part of enforcing them.

Before I decide to go about with a split-lock, I'm just going to let things stand as they are. What I would like to see is the conversation retuning to a more on-Topic conversation on the related and listed patches and feedback to Mastadon on the review process of them.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on May 31, 2012, 04:35:02 pm
:bump:
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Aardwolf on June 01, 2012, 04:21:54 pm
I'ma go with jr2 and say "recap please" ...



Would I be correct to summarize as follows:

Quote
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.




If so:

Congrats to karajorma, for repeatedly failing to explicitly clarify that you're talking about +target lead scalar, and then denying that there was a misunderstanding.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 01, 2012, 04:58:38 pm
Perhaps the best way to describe what my patch does would be to simply give an excerpt from my changelog (this will also double as a commit log entry should the SCP coders decide to include this patch):


Changed the behavior of swarm missiles so they can lead their target.
  -- Enabled by adding the new "+swarmLeadTarget" sub-flag to a swarm missile
       (needs to have the $Swarm flag as well).



That's all the patch does.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Droid803 on June 01, 2012, 07:35:01 pm
Excuse the backseat coding, but this whole deal has irked me quite a bit and I feel the need to pipe in.

Could you make it so that +target lead scaler works, because that is a more general flag that would benefit more than having to tell everyone that Target Lead Scaler does not work for swarm missiles, if you want them to lead you need to put +swarmLeadTarget instead, which just adds a layer of confusion.

Tying SwarmLeadTarget's behavior into a certain values of Target Lead Scaler would probably be the most "foolproof" way to do this and avoids it looking "hack-ish". While +swarmLeadTarget does the job, it's not..."elegant", and +target lead scaler should probably work anyway. Leaving it as it is doesn't really fix the bug (which was never about swarm missile behavior in the first place, but was entirely with target lead scaler not working (for swarm missiles)).

Unless I have read wrong and your flag doesn't cause swarm missiles to lead, but allows the use of target lead scaler to make them lead, in which case you don't even need that "flag", target lead scaler should always work.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Sushi on June 01, 2012, 08:46:10 pm
Excuse the backseat coding, but this whole deal has irked me quite a bit and I feel the need to pipe in.

Could you make it so that +target lead scaler works, because that is a more general flag that would benefit more than having to tell everyone that Target Lead Scaler does not work for swarm missiles, if you want them to lead you need to put +swarmLeadTarget instead, which just adds a layer of confusion.

Tying SwarmLeadTarget's behavior into a certain values of Target Lead Scaler would probably be the most "foolproof" way to do this and avoids it looking "hack-ish". While +swarmLeadTarget does the job, it's not..."elegant", and +target lead scaler should probably work anyway. Leaving it as it is doesn't really fix the bug (which was never about swarm missile behavior in the first place, but was entirely with target lead scaler not working (for swarm missiles)).

Unless I have read wrong and your flag doesn't cause swarm missiles to lead, but allows the use of target lead scaler to make them lead, in which case you don't even need that "flag", target lead scaler should always work.

+1. This is what I was trying to say earlier.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Iss Mneur on June 01, 2012, 08:54:50 pm
Would I be correct to summarize as follows:

Quote
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 (http://204.12.237.54/websvn/listing.php?repname=fs2open&rev=5502&sc=1) 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.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 01, 2012, 11:43:48 pm
Would I be correct to summarize as follows:

Quote
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 (http://204.12.237.54/websvn/listing.php?repname=fs2open&rev=5502&sc=1) 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:

Code: [Select]
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 (http://www.hard-light.net/wiki/index.php/Weapons.tbl#.2BTarget_Lead_Scaler:). This is because that flat is unset for cases where the Target Lead Scaler is set t0 1.0:

Code: [Select]
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:

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]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: General Battuta on June 02, 2012, 06:06:27 am
Bear in mind that swarm missiles flying pure pursuit is not a bug, it's intended behavior. It's an important part of the difference between the Hornet and Tornado.

The real bug here seems to be that Target Lead Scaler doesn't work. That is not intended behavior.

Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Iss Mneur on June 02, 2012, 02:10:12 pm
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?
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:

Code: [Select]
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);
}
Correct.  This is what your patch in the OP changes, making swarm missiles also lead by the lead factor.  Yes, I understand now that this would in change retail because of what I was looking at the heatseeker parsing code.

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 (http://www.hard-light.net/wiki/index.php/Weapons.tbl#.2BTarget_Lead_Scaler:). This is because that flat is unset for cases where the Target Lead Scaler is set t0 1.0:

Code: [Select]
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;
}
}
Okay. I see where I glossed over something.  I was looking at the heatseeker  +Target Lead Scaler: code.

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:
Yes, solution 1 would be the best solution because it doesn't add more weirdness for modders (solution 3) and for coders (solution 2 and 3).

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.
More accurately, this code would be executed for every tick of the physics.

However, I don't understand how using solution 1 would affect every missile.

It would only affect missiles that use +Target Lead Scaler:, which is an optional flag. I just checked, Mediavps does not use the flag.  BP WIHR1 uses it for the "Dart" missile, but the Dart is a Corkscrew missile which is already an expensive missile from a computation standpoint. In addition, the dart is a heatseeker with a +Target Lead Scaler: of 1.0 so it is already using the more expensive path.

So, to reiterate what I stated in my post yesterday, considering how long this feature has been in the engine and you being the first to notice, we should just fix the bug using solution 1 and call it a day (yes, this is not quite the same position as what I had yesterday because of the oversight noted above), because nobody is using the feature and expecting default behaviour.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 02, 2012, 03:08:59 pm
Bear in mind that swarm missiles flying pure pursuit is not a bug, it's intended behavior. It's an important part of the difference between the Hornet and Tornado.

The real bug here seems to be that Target Lead Scaler doesn't work. That is not intended behavior.

It is becoming more and more clear that my issues with swarm missiles are not that :v: introduced a bug when they added target leading to missile tracking to FS2, but rather that I don't agree with their decision to make it so you have to get an aspect lock on a target to fire a group of missiles that chase their target as if they were heat seekers rather than chase the target like all other aspect missiles do.

I'm going to go ahead and implement the solution Iss Mneur suggested and be done with this (I could have never imagined that a one-liner "fix" could evoke so much controversy!), but for my reference, how should I go about making a mod available so that everyone else can benefit from having swarm missiles that at least have half a chance of hitting their target (and you as well)?
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Iss Mneur on June 02, 2012, 03:53:30 pm
I'm going to go ahead and implement the solution Iss Mneur suggested and be done with this (I could have never imagined that a one-liner "fix" could evoke so much controversy!),
:D its only just beginning (http://www.hard-light.net/forums/index.php?topic=78344)  :drevil:

but for my reference, how should I go about making a mod available so that everyone else can benefit from having swarm missiles that at least have half a chance of hitting their target (and you as well)?
Checkout the modding portal (http://www.hard-light.net/wiki/index.php/Portal:Modding) on the wiki.  Though basically, create a weapon .tbm to make the changes to the swarm weapon spec's, write a mod.ini, put everything into its own mod directory, zip it up, and release it in Freespace Modding (http://www.hard-light.net/forums/index.php?board=8.0).
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 02, 2012, 04:12:42 pm
I'm going to go ahead and implement the solution Iss Mneur suggested and be done with this (I could have never imagined that a one-liner "fix" could evoke so much controversy!),
:D its only just beginning (http://www.hard-light.net/forums/index.php?topic=78344)  :drevil:

Fun.

Checkout the modding portal (http://www.hard-light.net/wiki/index.php/Portal:Modding) on the wiki.  Though basically, create a weapon .tbm to make the changes to the swarm weapon spec's, write a mod.ini, put everything into its own mod directory, zip it up, and release it in Freespace Modding (http://www.hard-light.net/forums/index.php?board=8.0).

Will do. Thanks Iss Mneur!
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 02, 2012, 04:20:16 pm
I've finished writing the patch so that swarmers can lead if the mod author adds the +Target Lead Scaler flag to a swarm missile. Below is a commit log entry should the SCP community wish to commit it:


Changed the behavior of swarm missiles so they can lead their target.
  -- Enabled by setting the "+Target Lead Scaler" flag to a swarm missile.


I've also attached the patch along with two tbm files that set +Target Lead Scaler to 1.1 for every swarm missile. In my limited testing, this leads the swarm missiles just enough so that they are effective against heavy fighters on up through cruisers but not so much that they can reliably hit a fast moving target, like a Mara or a Manticore.



EDIT: You actually need to have +Target Lead Scaler set to 2.0 for swarm missiles to reliably hit moving heavy fighters on up through cruisers. I also tried these modifications out on the Silent Threat Reborn campaign. One thing I noticed in my playthrough is that some of the missions are harder to complete because an enemy's swarm missiles will actually reliably hit a moving target. This appears to happen on the mission where you have to protect the Einstein escape pods and on the Exodus mission. I guess that's one reason why the cardinal rule is in place.

In any event, I'll release the mods I created that cause swarmers to lead their target if / when the +Target Lead Scaler bug is patched so as to not put undue presssure on the SCP coders to apply a patch that might not be ready.

[attachment deleted by a ninja]
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Droid803 on June 03, 2012, 06:21:35 pm
Yay! Thanks! This r awesome, now I can more deadlier make missile.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Dragon on June 03, 2012, 08:51:53 pm
Looks great. Glad to see it done and cleared up. :)
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: jr2 on June 04, 2012, 03:43:09 am
-snip-


Uploaded the files to my DropBox public folder so you can download it here (http://dl.dropbox.com/u/52352268/mastadon%20swarm%20patch%20and%20mod.7z) when the attachments get nuked, until Mastadon releases this as a mod.
Title: Re: Patch for the "My entire bank of swarm missiles missed a moving freighter" bug
Post by: Mastadon on June 18, 2012, 06:12:06 am
:bump:

Out of curiosity, was a decision ever reached on this patch?