Monday, April 16, 2012

[FA]Rate of Fire (practical limitaions)

Ok, so I just last night finally got my home computer working enough to where FA runs. As I was doing this, I had yet another idea pop into my head for a mod (oh boy...), and so I've been jotting notes down about it and calculating stats and what have you in my spare time (where I can't work on my current mods) to leave for future reference... once I've finished most of my other projects so I'm not adding yet another onto my plate at this time.
The rate of fire number in the weapon table is one of the things I've been trying to calculate out for this mod. Now, the issue that's been raised in my mind, is that I seem to remember someone, somewhere, mentioning something about how FA rounds off the RateOfFire number to the nearest tenth or hundredth, or something like that.
I was wondering if anyone seems to recall anything about this? Does the game actually do this, round off the RateOfFire figure, or is there just a practical limitation on the rate of fire based on: "Is the weapon ready this tick? No. Wait for next tick."|||Well it would have to round it simply because the game time is in ticks. Ten ticks to a second so anything requiring a firing rate higher then this will always max at out 1 shoot per tick. Though I'm sure due to script limitations this would be very hard to achieve.
Resin|||Resin_Smoker|||Ok, well that's basically what I'm trying to figure out, I guess.
A good example maybe would be assigning a unit a RoF of 1.2. This should equate to a unit firing every 0.8333... seconds, but with the limitations of a tick, this would instead come out to be every 0.9 seconds (which would be the equiv of a RoF of 1.1111...). But if I punch in a value of 1.111111, is it going to round it off at some point, where now it sees the RoF as being 0.9009 or some such, and thus wait till the next tick again, making it a 1 shot/second weapon?
I suppose as I think about it, I can always manipulate the RoF number to where it'll always fire in the interval I want, like assigning a rate of 1.12. I just want to make sure it isn't going to round off the wrong digit!
(and yes, I know in this example I gave I'd still get the RoF I want with 1.2, but that was an arbitrary example)|||I don't know how the engine deals with odd RoFs exactly, but I believe that it *should* correctly interpolate between ticks to give the best approximation.|||Ok. Thanks to the both of you for your replies. They help a lot.|||It does not interpolate. It rounds to the nearest tenth of a second delay. Interpolation would throw off the lua-based fire clocks.
So 1.2 = 0.833_ rounded to 0.8, or every 8 ticks. The actual rate of fire at 0.8s delay is of course 1.25.
The actual, practical rates of fire above 2 are 2.5 (0.4s), 3.34 (0.3s), 5 (0.2s), and 10 (0.1s). If you specify a rate of fire of 4 (0.25s), it rounds up to 0.3s, effectively 3.34. Likewise, any ROF of 6.67 (1.49s) or higher will round down to 0.1s and effectively be 10.
For an example, look at the Stinger or the Riptide. Specified ROF of 3, yet they fire consistently every 0.3s (3.34 actual ROF).|||Ok, great. Thanks Mithy.

No comments:

Post a Comment