project-navigation
Personal tools

Author Topic: Weapon Spread  (Read 6829 times)

Offline Doctor J

  • Squad Leader
  • ****
  • Posts: 265
    • View Profile
Weapon Spread
« 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().

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Weapon Spread
« Reply #1 on: May 10, 2008, 12:34:01 pm »
They're multipliers to a gaussian random value that's generated in the code.

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Re: Weapon Spread
« Reply #2 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.

Offline Doctor J

  • Squad Leader
  • ****
  • Posts: 265
    • View Profile
Re: Weapon Spread
« Reply #3 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!

Offline BhOg

  • Cannon Fodder
  • **
  • Posts: 5
    • View Profile
Re: Weapon Spread
« Reply #4 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?!





Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: Weapon Spread
« Reply #5 on: March 27, 2013, 11:02:02 am »
From the wiki:
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.

Offline BhOg

  • Cannon Fodder
  • **
  • Posts: 5
    • View Profile
Re: Weapon Spread
« Reply #6 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?

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: Weapon Spread
« Reply #7 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.