Post by Avi on Nov 8, 2013 18:10:58 GMT -5
Figured I made a little something to calculate it, so why not sprawl it out with a chart?
Note: the lines basically mean how much of a total delay in tics before the gun would A_Refire...
* 2101 tics technically, but one entire tic off is hardly something to write home about.
So, exactly what does this mean? Well, it's based on the assumption that the coder/(scripter?) has created a dummy item that acts like a token in order to jump to extra firing states.
Take this for example:
Looking at the first two lines of code in the Fire state more or less explain everything. I have a "token" inventory item called Fire900 that has a max capacity of 2. Without this, the entire method is useless, and therefore stupid.
Here's what's going on: the first time the gun fires, it'll start with 0 "Fire900" tokens and gives itself a token before firing. This way we know when it refires, it'll already have one. --In other words, one token given is also one bullet fired. Then, it'll get a second token with the second shot fired. Thus when it *tries* to refire a third time, the first line of the code's going to see it has 2 Fire900's and jump to the Fire900 state, thus the third shot jumps to the new state.
And to be a completionist, let's compare the tic math:
Fire state's A_FireBullets has 2 lines that last 1 tic each, meaning it'll be 2 tics total, then refires for 2 tics total. THEN jumps to the Fire900 state lasting 3 tics total. And if you look at the chart above, you'll see the 2-2-3 combo gets you exactly 900 rounds per minute --AKA 900 rounds fired in 2100 total tics. And since I assume you want your rate of fire to loop properly, the first line of Fire900's code is to remove the two tokens that got it to jumpstate in the first place. Thus, balance --or some shit.
Does this make sense, or do I have to find a better way to explain it?
Note: the lines basically mean how much of a total delay in tics before the gun would A_Refire...
Line 1 | Line 2 | Line 3 | Total RPM |
1 | --- | --- | 2100 :V |
2 | --- | --- | 1050 |
3 | --- | --- | 700 |
4 | --- | --- | 525 |
5 | --- | --- | 420 |
----- | ----- | ----- | --------- |
1 | 2 | --- | 1400 |
2 | 3 | --- | 840 |
2 | 2 | 3 | 900 |
3 | 3 | 2 | 526 |
3 | 3 | 4 | 420 |
4 | 3 | --- | 600 |
4 | 4 | 3 | 382* |
* 2101 tics technically, but one entire tic off is hardly something to write home about.
So, exactly what does this mean? Well, it's based on the assumption that the coder/(scripter?) has created a dummy item that acts like a token in order to jump to extra firing states.
Take this for example:
// Federation MP7 code without all the extra fluff
Fire:
TNT1 A 0 A_JumpIfInventory("Fire900",2,"Fire900")
TNT1 A 0 A_GiveInventory("Fire900",1)
TNT1 A 0 A_PlaySoundEx("MP7_FIRE","SoundSlot5")
MP7B A 1 A_Firebullets (5,5,-1,35,"MidBulletPuff",FBF_NORANDOM|FBF_USEAMMO)
MP7B B 1 BRIGHT A_GunFlash
MP7B A 0 A_ReFire
MP7B CDEFGHIJKLMNOPQRST 2 A_WeaponReady(WRF_NOBOB)
MP7B A 0 A_JumpIfNoAmmo(1)
goto ReadyLoop
MP7B A 0 A_GiveInventory("Reloading",1)
goto Reload
Fire900:
TNT1 A 0 A_TakeInventory("Fire900",2)
TNT1 A 0 A_PlaySoundEx("MP7_FIRE","SoundSlot5")
MP7B A 1 A_Firebullets (5,5,-1,35,"MidBulletPuff",FBF_NORANDOM|FBF_USEAMMO)
MP7B B 1 BRIGHT A_GunFlash
MP7B C 1
MP7B A 0 A_ReFire
MP7B DEFGHIJKLMNOPQRST 2 A_WeaponReady(WRF_NOBOB)
MP7B A 0 A_JumpIfNoAmmo(1)
goto ReadyLoop
MP7B A 0 A_GiveInventory("Reloading",1)
goto Reload
Looking at the first two lines of code in the Fire state more or less explain everything. I have a "token" inventory item called Fire900 that has a max capacity of 2. Without this, the entire method is useless, and therefore stupid.
Here's what's going on: the first time the gun fires, it'll start with 0 "Fire900" tokens and gives itself a token before firing. This way we know when it refires, it'll already have one. --In other words, one token given is also one bullet fired. Then, it'll get a second token with the second shot fired. Thus when it *tries* to refire a third time, the first line of the code's going to see it has 2 Fire900's and jump to the Fire900 state, thus the third shot jumps to the new state.
And to be a completionist, let's compare the tic math:
Fire state's A_FireBullets has 2 lines that last 1 tic each, meaning it'll be 2 tics total, then refires for 2 tics total. THEN jumps to the Fire900 state lasting 3 tics total. And if you look at the chart above, you'll see the 2-2-3 combo gets you exactly 900 rounds per minute --AKA 900 rounds fired in 2100 total tics. And since I assume you want your rate of fire to loop properly, the first line of Fire900's code is to remove the two tokens that got it to jumpstate in the first place. Thus, balance --or some shit.
Does this make sense, or do I have to find a better way to explain it?