UFO:Alien Invasion

Development => Coding => Topic started by: Doctor J on May 10, 2008, 12:29:49 pm

Title: Weapon Spread
Post by: Doctor J on May 10, 2008, 12:29:49 pm
The spread values given for firemodes in the .ufo files - are these in degrees, radians, 'gosh units' or what?  I tried grepping the sources but didn't find anything like a useful comment, only it being used in G_ShootSingle().
Title: Re: Weapon Spread
Post by: BTAxis on May 10, 2008, 12:34:01 pm
They're multipliers to a gaussian random value that's generated in the code.
Title: Re: Weapon Spread
Post by: blondandy on May 10, 2008, 02:22:54 pm
I think the gaussian spread is dimensionless and the spread values are in degrees.

http://ufoai.ninex.info/wiki/index.php/Damage_rate_vs_distance

Quote from: mathlib.c, AngleVectors()
angle = angles[YAW] * (M_PI * 2 / 360);

it converts from degrees to radians before calling cos and sin.
Title: Re: Weapon Spread
Post by: Doctor J on May 10, 2008, 04:00:43 pm
I think the gaussian spread is dimensionless and the spread values are in degrees.

That's what i was looking for, thanks!
Title: Re: Weapon Spread
Post by: BhOg on March 27, 2013, 09:23:57 am
What do the different formats in the weapons_xx.ufo for "spread" mean?

Most entries read e.g. "spread 1.0 1.0", but flamer has "spread 1.5 0.5", machinegun has "spread 3 20" for full auto sweep, and grenade launcher has "spread 0 1.5" for aimed single shot?!




Title: Re: Weapon Spread
Post by: H-Hour on March 27, 2013, 11:02:02 am
From the wiki (http://ufoai.org/wiki/UFO-Scripts/weapon_*.ufo):
Quote
width of gaussian applied to attempted line of fire, in degrees (TODO: check it really is degrees). First element affects pitch, second element affects yaw. Lower values mean greater precision.
Title: Re: Weapon Spread
Post by: BhOg on March 27, 2013, 12:50:50 pm
Oh, thanks, but let me rephrase ... why have those 3 given entries those "strange" values?

Is the "3 20" used to achieve the sweep effect?
Why do flamer and GL then have different deviations in vertical/horizontal direction?
Title: Re: Weapon Spread
Post by: H-Hour on March 27, 2013, 01:24:28 pm
Is the "3 20" used to achieve the sweep effect?
Why do flamer and GL then have different deviations in vertical/horizontal direction?

First number is pitch, second number is yaw. So yes, "3 20" will mean wildly inaccurate horizontally.