aliens

Author Topic: [DONE] [Suggestion] 'Realistic' Shotgun Behavior  (Read 3969 times)

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1766
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: 'Realistic' Shotgun Behavior Executable
« Reply #15 on: August 16, 2016, 06:56:26 pm »
Huh, I didn't know that.  Thanks for the tip, I'll try it and add the windows executable to my archive!

Also, thanks for helping me figure out how to do this - I don't think I'd know what to do just figuring out the C++ code myself.

Edit: Got it to compile!  Had to mess around with Makefile.mxe though, specifically adding -lyaml-cpp to the libs in LDFLAGS.  I'll update the first post and the archive with the new executables.
« Last Edit: August 16, 2016, 09:25:54 pm by ohartenstein23 »

Offline HelmetHair

  • Colonel
  • ****
  • Posts: 350
  • He who laughs last thinks fastest.
    • View Profile
Re: 'Realistic' Shotgun Behavior Executable
« Reply #16 on: August 18, 2016, 02:47:29 am »
Does this mean if I had a near miss with a shotgun that I could still hit them with the spread?

So if my soldier actually "missed" by not hitting with the first pellet then one from the spread might hit?

I'd love to shoot and miss and still "wing" a target from a near miss beyond point blank range.

Anyways...

best regards

-HH

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1766
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: 'Realistic' Shotgun Behavior Executable
« Reply #17 on: August 18, 2016, 04:14:52 am »
Yes, depending on the spread parameters, a near miss could still hit the target.  The larger (wider) the shotgunSpread value and the lower the shotgunChoke value, the more likely it is you'll still hit the target on a miss.  At low spreads, all the pellets will probably hit in the same tile and a miss means a complete miss.

Offline Eddie

  • Commander
  • *****
  • Posts: 539
    • View Profile
Re: [DONE] [Suggestion] 'Realistic' Shotgun Behavior
« Reply #18 on: February 15, 2019, 02:03:41 am »
Sorry to resurrect this topic, but I think there is an important error in the description.

It says that a shotgun spread of 50 should result in roughly 50% of the pellets hitting the target. I did some testing to see if that is true, and it seems the scaling is not linear but quadratic. So it's not "pellets*0,5" but rather "pellets*(0,5^2)"

What I did: shoot a double barrel shotgun from piretez mod with buckshot at a target 15 tiles away. That thing has a spread of 48,75% and 10 pellets.
According to the description for his mod, this should result in roughly 5 pellets hitting your target on average. What I actually saw was an average of 2.1, which is significantly less than 5 but quite close to 2.37 that you would expect if the quadratic scaling was true.
I did some further testing with the military shotgun and buckshot. That thing has a spread of 75 and 7 pellets. Linear scaling will give you 5.25 pellets on average, quadratic scaling 3.9. What I saw was exactly 3.9 pellets hitting on average. This weapon I also tested at 20 tiles and got roughly the same number.
The quadratic scaling makes sense since you fire in a cone and the spread is in 2D and not 1D.

Now what really bugs me: Is this quadratic scaling also true for non shotgun weapons, or is that just ohartenstein23's code? Like, a 50% shot will actually only hit 25% of the time.
That seems congruent with my gut feeling. When playing I try to avoid 50% shots if I can because those always miss anyway. 75% and up is an accuracy where I feel comfortable that it is worth taking the shot...

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1766
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [DONE] [Suggestion] 'Realistic' Shotgun Behavior
« Reply #19 on: February 15, 2019, 03:47:56 am »
The accuracies reported in X-Com aren't actually percentages, they're measurements of maximum possible/likely deviation from the direct line of fire to the target. 0% accuracy means maximum possible deviation, 110% means minimum possible. I think it works out to approximate chance to hit at either 10 or 20 tiles from when I did the math on it, but the point is lower spread is better, higher spread is worse.