Poll

Would an option for autofire recoil penalties/bonuses be appreciated?

Image#1 (square pixel, 1:1)
1 (10%)
Image#2 (non-square pixel, 1:1:2)
8 (80%)
Don't care either way.
1 (10%)

Total Members Voted: 10

Voting closed: July 25, 2014, 02:53:50 am

Author Topic: Option for autofire recoil  (Read 18634 times)

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Option for autofire recoil
« on: July 11, 2014, 02:53:50 am »
I'm about 25% the way into making changes to the code I pulled down to utilize a new field under weapons called 'recoil'.  This would be the penalty (or bonus for negative values) that each further shot in an auto-fire string takes.

I was figuring on making it account for strength, using the following equation: Recoil Adjustment = (sqr(Str * 1.5)) - (5 + Weapon Recoil Stat) with minimum of 1. This would be deducted on every shot past the first. So soldier with a 35% chance to hit with a burst will have 35 for the first shot, then 35 - Recoil Adjustment, then 35 - (2* Recoil Adjustment) and so on.

NEW FORMULA: Recoil Adjustment = Recoil - ((sqr(Str * 1.5)) - 5)

Depending on logistics, I could also see about having it show the 'average' hit rate for the burst, instead of the first shot's percentage.

This would be a further option with default values of zero and only be exposed for modders and have no effect if the option is turned off, like the range based accuracy.
« Last Edit: July 11, 2014, 08:30:13 pm by KingMob4313 »

Offline Sturm

  • Colonel
  • ****
  • Posts: 132
    • View Profile
Re: Option for autofire recoil
« Reply #1 on: July 11, 2014, 03:13:52 am »
Yes.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11702
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Option for autofire recoil
« Reply #2 on: July 11, 2014, 06:31:49 am »
In order to have an opinion, I would have to test this against the UFO Extender Accuracy, which I'm currently using with good results. I don't know how exactly UFO EA works, so your formula tells me nothing. Besides, I can never derive much from formulas when it's a matter of a gameplay - it's all in the practice.

Having said that, I hope you'll finish your code, the idea is interesting.

Offline Gifty

  • Colonel
  • ****
  • Posts: 138
    • View Profile
Re: Option for autofire recoil
« Reply #3 on: July 11, 2014, 07:08:29 am »
The difference is that UFO Extender accuracy just applies a "flat-rate" accuracy to all auto shots, making every shot the same within that burst. This new method would alter the accuracy dynamically after each shot, so the first shots in a burst have a higher chance than the final shots, simulating weapon recoil. It would add a whole new angle to weapon stats and give modders one more way to make weapons distinct from one another.
« Last Edit: July 11, 2014, 10:29:46 am by Gifty »

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Option for autofire recoil
« Reply #4 on: July 11, 2014, 11:21:49 am »
so you give a weapon a adjustment of 6
now compare a strength 45 (20-70 average) with a strength 70 (cap) guy
math.sqrt(45*1.5)-(5+6)=-2.7841616374225087
math.sqrt(70*1.5)-(5+6)=-0.753049234040402
so each shot gets more accurate but if you are stronger its accuracy gain is less?
ok perhaps the arbitrary chosen number 6 is way of lets try 2
math.sqrt(45*1.5)-(5+2)=1.2158383625774913
math.sqrt(70*1.5)-(5+2)=3.246950765959598
so here the accuracy decrease with each shot but more strength also means less accuracy
so where is now the position where the bonus turns negative into a for a weapon
ok so lets take a look using value 2 with increasing strength
strength20=>-1.5227744249483388
strength30=>-0.2917960675006306
strength40=>0.745966692414834
strength50=>1.6602540378443873
strength60=>2.486832980505138
strength70=>3.246950765959598
but using value 4 with increasing strength
strength20=>-3.522774424948339
strength30=>-2.2917960675006306
strength40=>-1.254033307585166
strength50=>-0.3397459621556127
strength60=>0.4868329805051381
strength70=>1.246950765959598
your turning point moves

in my opinion there are some flaws in the formula
better strength decreases accuracy
it is not obvious what that recoil parameter does/what is a useful value
the result can switch between positive and negative value - thats not a problem - but there is no clear border/turning point and the resulting behaviour a bit unpredictable
higher values make less recoil ?

Offline Muukalainen

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Option for autofire recoil
« Reply #5 on: July 11, 2014, 02:58:48 pm »
Interesting.

You could make it in a way that with laser weapons the accuracy slightly increases the longer you fire.

We used to play paintball, and they have so big "bullets" that you can see them when they fly. And you can have like 200 of them in your clip / loader. When you keep shooting fast enough it looks almost like a laser. And you can aim by just looking where that "laser beam" goes, if you just keep shooting :)

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #6 on: July 11, 2014, 03:49:14 pm »
so you give a weapon a adjustment of 6
now compare a strength 45 (20-70 average) with a strength 70 (cap) guy
math.sqrt(45*1.5)-(5+6)=-2.7841616374225087
math.sqrt(70*1.5)-(5+6)=-0.753049234040402

Whoops, screwed it up writing it down.

Try this:

Recoil - ((math.sqrt(STR*1.5)-(5))

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #7 on: July 11, 2014, 03:50:47 pm »
The difference is that UFO Extender accuracy just applies a "flat-rate" accuracy to all auto shots, making every shot the same within that burst. This new method would alter the accuracy dynamically after each shot, so the first shots in a burst have a higher chance than the final shots, simulating weapon recoil. It would add a whole new angle to weapon stats and give modders one more way to make weapons distinct from one another.

That's exactly the point.  It opens up so much more differentiation between the weapons.  Suddenly weapons that have a ton of autoshots per autofire action have some disadvantages.

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #8 on: July 11, 2014, 03:52:19 pm »
Interesting.

You could make it in a way that with laser weapons the accuracy slightly increases the longer you fire.

We used to play paintball, and they have so big "bullets" that you can see them when they fly. And you can have like 200 of them in your clip / loader. When you keep shooting fast enough it looks almost like a laser. And you can aim by just looking where that "laser beam" goes, if you just keep shooting :)

That could be the flipside of laser weapons. With laser weapons, you won't see the shot fly.  It'll just be 'there' just like how lights there on the wall when you turn on the flashlight.

I'd more see it with lower ROF plasma weapons, that would be a lot like paintball.

Offline Muukalainen

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Option for autofire recoil
« Reply #9 on: July 11, 2014, 04:01:10 pm »
That could be the flipside of laser weapons. With laser weapons, you won't see the shot fly.  It'll just be 'there' just like how lights there on the wall when you turn on the flashlight.

I'd more see it with lower ROF plasma weapons, that would be a lot like paintball.

Yes. Ofcourse it depends on the laser. At least I can see very well the laser beams that X-Com use :)

But that was just an idea, so if you change the code, you could make it in a way so modders have this option too.

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #10 on: July 11, 2014, 04:19:22 pm »
Yes. Ofcourse it depends on the laser. At least I can see very well the laser beams that X-Com use :)

But that was just an idea, so if you change the code, you could make it in a way so modders have this option too.

Absolutely, that's the idea of this. If you want shots past the first one to get more accurate, you enter a negative recoil value.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Option for autofire recoil
« Reply #11 on: July 11, 2014, 04:32:07 pm »
Recoil - ((math.sqrt(STR*1.5)-(5))
ah that makes more sense now more strength=more accuracy and higher number=higher accuracy loss
Spoilerdata:
for x in itertools.product(range(1,7),range(20,71,10)): print (x,x[0]-(math.sqrt(x[1]*1.5)-5))
(1, 20) 0.5227744249483388
(1, 30) -0.7082039324993694
(1, 40) -1.745966692414834
(1, 50) -2.6602540378443873
(1, 60) -3.486832980505138
(1, 70) -4.246950765959598
(2, 20) 1.5227744249483388
(2, 30) 0.2917960675006306
(2, 40) -0.745966692414834
(2, 50) -1.6602540378443873
(2, 60) -2.486832980505138
(2, 70) -3.246950765959598
(3, 20) 2.522774424948339
(3, 30) 1.2917960675006306
(3, 40) 0.25403330758516596
(3, 50) -0.6602540378443873
(3, 60) -1.4868329805051381
(3, 70) -2.246950765959598
(4, 20) 3.522774424948339
(4, 30) 2.2917960675006306
(4, 40) 1.254033307585166
(4, 50) 0.3397459621556127
(4, 60) -0.4868329805051381
(4, 70) -1.246950765959598
(5, 20) 4.522774424948339
(5, 30) 3.2917960675006306
(5, 40) 2.254033307585166
(5, 50) 1.3397459621556127
(5, 60) 0.5131670194948619
(5, 70) -0.24695076595959797
(6, 20) 5.522774424948339
(6, 30) 4.291796067500631
(6, 40) 3.254033307585166
(6, 50) 2.3397459621556127
(6, 60) 1.5131670194948619
(6, 70) 0.753049234040402
in my opinion the points: "it is not obvious what is a useful value"/"behaviour a bit unpredictable" are still valid
to be clear i dont want to discourage here i just see it from a modder perspective who wants to use this value and give it a useful meaning .. 
perhaps a wiki page that sums up a list like above would be enough to explain
and to go one step further i had an idea about an alternative base for strength
one could go and use "free" strength points (strenght-weight?) so you can increse the reliability in using a heavy recoil weapon with a 30 strength guy if you get rid of all his other items medipacks,grenades, second ammoclip,... like: (Recoil - ((math.sqrt(max(0,(STR-WeightOfAllItems)*1.5))-5))

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #12 on: July 11, 2014, 05:20:25 pm »
ah that makes more sense now more strength=more accuracy and higher number=higher accuracy loss
Spoilerdata:
for x in itertools.product(range(1,7),range(20,71,10)): print (x,x[0]-(math.sqrt(x[1]*1.5)-5))
(1, 20) 0.5227744249483388
(1, 30) -0.7082039324993694
(1, 40) -1.745966692414834
(1, 50) -2.6602540378443873
(1, 60) -3.486832980505138
(1, 70) -4.246950765959598
(2, 20) 1.5227744249483388
(2, 30) 0.2917960675006306
(2, 40) -0.745966692414834
(2, 50) -1.6602540378443873
(2, 60) -2.486832980505138
(2, 70) -3.246950765959598
(3, 20) 2.522774424948339
(3, 30) 1.2917960675006306
(3, 40) 0.25403330758516596
(3, 50) -0.6602540378443873
(3, 60) -1.4868329805051381
(3, 70) -2.246950765959598
(4, 20) 3.522774424948339
(4, 30) 2.2917960675006306
(4, 40) 1.254033307585166
(4, 50) 0.3397459621556127
(4, 60) -0.4868329805051381
(4, 70) -1.246950765959598
(5, 20) 4.522774424948339
(5, 30) 3.2917960675006306
(5, 40) 2.254033307585166
(5, 50) 1.3397459621556127
(5, 60) 0.5131670194948619
(5, 70) -0.24695076595959797
(6, 20) 5.522774424948339
(6, 30) 4.291796067500631
(6, 40) 3.254033307585166
(6, 50) 2.3397459621556127
(6, 60) 1.5131670194948619
(6, 70) 0.753049234040402
in my opinion the points: "it is not obvious what is a useful value"/"behaviour a bit unpredictable" are still valid
to be clear i dont want to discourage here i just see it from a modder perspective who wants to use this value and give it a useful meaning .. 
perhaps a wiki page that sums up a list like above would be enough to explain
and to go one step further i had an idea about an alternative base for strength
one could go and use "free" strength points (strenght-weight?) so you can increse the reliability in using a heavy recoil weapon with a 30 strength guy if you get rid of all his other items medipacks,grenades, second ammoclip,... like: (Recoil - ((math.sqrt(max(0,(STR-WeightOfAllItems)*1.5))-5))

Well, once the value reaches less than zero, it flatlines at 0 or 1. Otherwise, yes, at high strengths and lower recoil values, high strength squadies would see their accuracy increase per shot.  That's not intended.  Generally a higher strength always lets you have better control of the weapon with this equation.


Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Option for autofire recoil
« Reply #13 on: July 11, 2014, 05:49:17 pm »
hm so how about two numbers?
recoilstep and recoilstrength
recoilstep is the base decrease in accuracy for each shot
recoilstrength is a value that is substracted from the recoil for every 10 strengthpoints
now:
recoilstep=0 => no recoil
recoilstep>0 => weapon has recoil that decrease accuracy
recoilstep<0 => weapon aims with more shots (laser)
recoilstrength=0 means strenght has no influence
e.g. recoilstep=4, recoilstrength=0.3 , strength=40 is easy to calculate each shot you get 4-(40/10)*0.3 = 2.8 accuracy loss
a laser weapon would be like: recoilstep=-3, recoilstrength=0 # no strength benefit but increasing accuracy by 3 per shot

the formula allows for recoilstep=0 and recoilstrength>0 so real recoil but strenght gives accuracy - could be an option for very heavy weapons with autofire?

Spoiler:
for x in itertools.product([-5,0,5,10],[-0.5,0,0.5,1],range(20,71,25)): print (x,x[0]-(math.ceil(x[2]/10)*x[1]))

(-5, -0.5, 20) -4.0
(-5, -0.5, 45) -2.5
(-5, -0.5, 70) -1.5
(-5, 0, 20) -5
(-5, 0, 45) -5
(-5, 0, 70) -5
(-5, 0.5, 20) -6.0
(-5, 0.5, 45) -7.5
(-5, 0.5, 70) -8.5
(-5, 1, 20) -7
(-5, 1, 45) -10
(-5, 1, 70) -12
(0, -0.5, 20) 1.0
(0, -0.5, 45) 2.5
(0, -0.5, 70) 3.5
(0, 0, 20) 0
(0, 0, 45) 0
(0, 0, 70) 0
(0, 0.5, 20) -1.0
(0, 0.5, 45) -2.5
(0, 0.5, 70) -3.5
(0, 1, 20) -2
(0, 1, 45) -5
(0, 1, 70) -7
(5, -0.5, 20) 6.0
(5, -0.5, 45) 7.5
(5, -0.5, 70) 8.5
(5, 0, 20) 5
(5, 0, 45) 5
(5, 0, 70) 5
(5, 0.5, 20) 4.0
(5, 0.5, 45) 2.5
(5, 0.5, 70) 1.5
(5, 1, 20) 3
(5, 1, 45) 0
(5, 1, 70) -2
(10, -0.5, 20) 11.0
(10, -0.5, 45) 12.5
(10, -0.5, 70) 13.5
(10, 0, 20) 10
(10, 0, 45) 10
(10, 0, 70) 10
(10, 0.5, 20) 9.0
(10, 0.5, 45) 7.5
(10, 0.5, 70) 6.5
(10, 1, 20) 8
(10, 1, 45) 5
(10, 1, 70) 3
« Last Edit: July 11, 2014, 05:52:39 pm by Falko »

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: Option for autofire recoil
« Reply #14 on: July 11, 2014, 08:10:17 pm »
Here's a link to what I currently have: https://docs.google.com/spreadsheets/d/1stJwQFVcpN6S6AaULgckqQSA4oVlEz0G8yPWf6_auxY/pubhtml

I'm still playing with the numbers.

Current formula is: B$2-(SQRT($A3*$B$1)-$C$1)