Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fury on March 15, 2010, 03:28:49 am

Title: So what's the deal with beam whack?
Post by: Fury on March 15, 2010, 03:28:49 am
In retail AAA beams whack fighters/bombers around when they're hit. Now that was broken by Goober long time ago when he fixed another bug. What I find odd is that this has not yet been "fixed" since it alters retail behavior of AAA beams. Workaround is to increase mass values of AAA beams quite a bit, but why hasn't this been fixed either by SCP or FSU in core pack?
Title: Re: So what's the deal with beam whack?
Post by: General Battuta on March 15, 2010, 03:33:16 am
I would strongly favor either a code-side or FSU fix for the issue.

(And I assume we'll be fixing this in Blue Planet, eh Fury?)
Title: Re: So what's the deal with beam whack?
Post by: Fury on March 15, 2010, 03:37:04 am
No. I fully expect either FSU or SCP to fix this. It's not up to mods to fix bugs caused by either SCP or FSU.
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 15, 2010, 06:35:18 pm
There was a discussion about how to fix it, fairly recently too (i.e. within the past couple of months), but I don't think it ever got resolved.

The problem is that it can't strictly be fixed due to the nature of the original bug.  The beam whack is disproportionately dependent on the object's coordinates: if you get whacked at 0,0,0, you'll move a lot less than if you get whacked at 10000,10000,10000.

So, the question that was asked before remains unanswered.  What should be a good default whack intensity?
Title: Re: So what's the deal with beam whack?
Post by: General Battuta on March 15, 2010, 06:39:33 pm
Yeah, I recall that.

The best solution, as I see it, is to calculate retail whack intensity from the origin out to a reasonable distance (based on average mission size - maybe ten kilometers), average the intensities, and use that.

Alternatively, test on retail and then guess-and-check until you get something that 'feels right'.
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 15, 2010, 06:57:11 pm
Does anyone have a link to the original thread?  I searched but found nothing.
Title: Re: So what's the deal with beam whack?
Post by: FUBAR-BDHR on March 15, 2010, 09:00:39 pm
What about basing the whack on on ships distance from he firing point?  Use the same original formula (a bit in reverse) but have the firing point as 0,0,0 and the objects position be the distance for the whack.  So in the case of your ship at 10000,10000.10000 being hit by a beam fired a 0,0,0 it would get almost no whack while if that beam were fired from 10000,10000,9500 you would get knocked around pretty good. 

So I guess what I'm saying is instead of 0,0,0 use the targets position and instead of the targets position use the firing point the shot came from. 
Title: Re: So what's the deal with beam whack?
Post by: General Battuta on March 15, 2010, 09:03:55 pm
While true to retail behavior I don't think it makes any sense.

Especially as you'd end up with (presumably) negligible beamwhack inside the 1500 meter range of AAA beams.

Also, aren't your examples backwards? You'd get a ton of whack if hit by a beam fired from a long distance but almost none from a beam fired at short range.

EDIT after discussion on #scp:

I would argue very strongly for a flat-rate beam whack, or at least for a table option to switch between flat rate and range-dependent if range-dependent must be included.

If the beam whack were range-dependent by default I think we'd see issues with the whack being absurd at close range and negligible at, say, uAAA range.

I'd much rather have the whack levels under consistent, balanceable control.
Title: Re: So what's the deal with beam whack?
Post by: FUBAR-BDHR on March 15, 2010, 09:30:51 pm
Further discussion on #SCP lead to the idea of an inner and outer whack radius like shockwaves have.  This would give you the ability to have the retail style distance determined whack, no whack by setting inner and outer to 0, or a constant whack by setting inner and outer radius to the max range of the beam.  

This still leaves the need to determine a baseline for use when no values exist like in retail. 


/me wonders if whack has ever been used so much in a non gen discussion thread.  
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 15, 2010, 11:59:47 pm
All right, I found the original thread:
http://www.hard-light.net/forums/index.php?topic=65632.0

See?  I was all set to fix this bug, but nobody ever responded. :(

If there's no objection, I'll go with the 2000 and 10000 values that I arrived at by experimentation.
Title: Re: So what's the deal with beam whack?
Post by: Fury on March 16, 2010, 12:02:44 am
Or you could do what FUBAR suggested, use inner and outer radius to let modders have control over it.
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 16, 2010, 12:04:13 am
Modders already have control over it, because they can set beam mass in weapons.tbl.  This would be for the default case.
Title: Re: So what's the deal with beam whack?
Post by: General Battuta on March 16, 2010, 12:27:32 am
Wait, hang on, so modders are going to be forced to pick between either a beamwhack of 2000 and 10000, based simply on whether beam mass is above or below a certain threshold?

Yes, I strenuously object. Arguably (though not certainly) worse than the current case.

Please allow these values to be adjustable on a per-beam basis via weapons.tbl. Inner and outer radius solution would be ideal. If not that, a simple 'beamwhack force' entry in a beam's table entry?

Obviously the retail data does not have these defaults so you could use the 2000/10000 figures there.
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 16, 2010, 12:35:21 am
Modders can set beam weapon mass in weapons.tbl.  This is what will normally be used for beam whack.

In retail, for some reason, all beam weapons are hard-coded to have a mass of 100.  So the code checks to see if the mass is 100, and if so, it uses a mass predefined by the game.  This predefined mass is 500 for small beams and 1500 for large beams.  These mass values can be thought of as the defaults.

I am proposing to change the defaults to 2000 and 10000.  Experimental testing seems to indicate these are reasonable standard values.
Title: Re: So what's the deal with beam whack?
Post by: General Battuta on March 16, 2010, 12:37:00 am
Ah, I gotcha.

So all beams with mass 100 will be treated as having either mass 2000 (for small beams) or mass 10000 with large, but we can set these values to whatever we please so long as they aren't 100?

This is going to need to be very well-documented, because it's confusing as heck, but it does work.

However, I'm imagining the nightmare when some beginning modder mods the AAAf to mass 200 and suddenly sees the whack drop by a factor of 10.
Title: Re: So what's the deal with beam whack?
Post by: FUBAR-BDHR on March 16, 2010, 12:37:21 am
Wait I checked the retail tables earlier today and the only fighter beam with a mass of 100 was the Ultra anti-fighter beam.  
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 16, 2010, 12:50:29 am
So all beams with mass 100 will be treated as having either mass 2000 (for small beams) or mass 10000 with large, but we can set these values to whatever we please so long as they aren't 100?

This is going to need to be very well-documented, because it's confusing as heck, but it does work.
Yes and yes. :)


Wait I checked the retail tables earlier today and the only fighter beam with a mass of 100 was the Ultra anti-fighter beam.
You must have misread the table.  Out of the 20 beams, there are only three that do not have a mass of 100.  They are SAAA, MjolnirBeam, and MjolnirBeam#home.  These are few enough that they can be bypassed using string comparison hacks.
Title: Re: So what's the deal with beam whack?
Post by: Bobboau on March 16, 2010, 01:20:51 pm
I think a better way to handle this would be to use a different tbl string and if the default string is used then it ignores the table value and uses the default, if the new string is used then use that. maybe $beam_mass:
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 16, 2010, 04:29:35 pm
I think that would make things even more confusing.

And incidentally, I looked at the retail code and the beam mass was overridden there anyway.  So all three beams I mentioned above used the default whacks, despite having different masses.
Title: Re: So what's the deal with beam whack?
Post by: Spicious on March 16, 2010, 09:40:06 pm
I think in that case Bobboau's solution of a new parameter if you want a custom beam whack is the lesser confusion.

If you don't set it you get the new default for any mass value. If you do set it you get that value instead. Anything else seems like a horrible hack.
Title: Re: So what's the deal with beam whack?
Post by: Goober5000 on March 16, 2010, 11:13:55 pm
Except Bobboau added his == 100 fix back in 2003 or so, so there are mods that depend on it.

We have a choice here between several hacks.  Some of them are horrible, some of them less so.  I think the solution I committed is the most ideal compromise.