Your FPS's effect on firing rate in Half-Life and its mods

by Mirvin_Monkey (mirv@madabouthats.org)

 

In Team Fortress Classic, there's a class called HW Guy. When playing as this guy you're equipped with an autocannon, a big chaingun-like hitscan weapon.

There's a common understanding that the rate at which this gun fires depends on your fps, and that a higher fps results in a higher rate of fire. I thought that a good way to spend a boring evening would be to test to see if this was the case.

1) A quick look

Armed with my trusty stopwatch, I head onto a TFC server to shoot some walls. My method is to simultaneously start the stopwatch and press the mouse button to start firing, then stopping as soon as the AC starts making the out-of-ammo sound effect. The average time taken to empty the AC is about 20secs, so any human error with the stopwatch should be quite a small percentage of this.

Using fps_max I timed it at some random fps's. Results are below.

Fps Time to empty AC
20fps (vsync on) 20.9s
100fps (vsync on) 22.8s
20fps 20.9s
100fps 22.7s
400fps 26.1s

So there was definately some variation, but it didnt seem to show that the firing rate went up with fps. In fact, it seemed to show the opposite. More readings were needed obviously.

2) A deeper look

Same process again, but more results recorded. These were all taken with v-sync off.

Fps Time to empty AC

20

20.9s
25 24.7s
30 27.3s
35 23.7s
40 24.2s
45 24.8s

These results suggested that there didnt seem to be any sort of linear relationshipat all. You could argue that it might have been due to human error with the stopwatch, but with almost 4secs difference between 30fps and 35fps, I'd have to have pretty lousy reactions for that.

3) A wider look?

I had an idea for how to test this more accurately, but it relied on one thing - is this a TFC thing only or does it exist throughout all Half-Life mods? The Counterstrike para and HLDM's mp5 were soon being fired into a poor unsuspecting wall as I timed them under different fps. They both showed the same characteristics - far slower at 100fps than 20fps, and even slower so at 400fps. Now I could get some accurate timings.

4) Time to make a MOD

One quick download of the latest version of the HL SDK later, and I had everything I needed to make my little mod. My plan: add a timer onto hldm's mp5 to time the duration between starting to fire and the clip running out. It would only take a few lines of (sloppy) code, so I got to work.

nb. The rest of part 4 is involved in the programming of my timer, feel free to skip over to part 5 if this doesnt interest you (you wont miss out on anything by doing so).

First I had to add some new variables to the MP5 class, so here are bShooting and timeShooting. bShooting just holds true or false depending on whether we are firing or not, and timeShooting holds the CPU clock time of when we first started firing.

weapons.h

The PrimaryAttack() function is called while the gun is firing. If they've just started shooting (ie. bShooting was false) then we just set bShooting to true and store the clock time into timeShooting. If m_iClip is 0 or less then they've run out of ammo, so get the current clock time and work out the time elapsed between now and when we first started.

mp5.cpp (CMP5::PrimaryAttack() function)

Now all we have to do is reset bShooting to false when the gun isn't firing. So a good place for that is in WeaponIdle().

mp5.cpp

I then compiled my shiny new client.dll and stuck it in my Steam Half-Life's cl_dll directory (write-protected so Steam didn't try to update it).

5) A proper test

Now when I emptied my mp5 clip I got an accurate value for the duration!

I spent a fun (ha!) hour or so getting multiple readings for every fps from 20 to 120 (with the help of developer 1). Next came putting all the values into Microsoft Excel. I wasn't really sure what to expect, a jumble of values? If it ended up like that then all this would have been a bit of a waste of time.

6) The results!

I thought Excel's scatter graph would be a good way of depicting the results, and so I went for that. This is what I got:

The graph proved just what I hadn't been expecting all along. For those of you who don't really understand what they're looking at, the lower the dot is on the graph the faster your gun is firing at that fps. The graph shows that at lower fps your firing rate changes a lot more from fps to fps than at high fps, but crucially the higher speeds are all found at a lower fps.

Below is an annotated graph which makes it slightly easier to find the better fps's:

7) Conclusion

So what does this show? Well, 20fps gives you the fastest firing gun. The difference between the fastest and the values used by most people (60fps - 100fps) can be up to 0.5seconds quicker. That's about 10% quicker. For the HWGuy's autocannon that means you can empty your clip 2 seconds quicker, which is a fair amount of damage. In Counter-strike, 10% quicker rate of fire could let you fire off that final bullet that kills somebody before they kill you. It's not a huge advantage but it certainly isn't negligable.

You can download the excel spreadsheet I made from here. In it there's also columns which give you an idea of the percentage faster your weapons will fire if you swap from your fps to one of the two 'optimums' (20fps or 50fps).