((Damage_Given / Time_Played) * (Hits / Shots)) + ((Damage_Given / Time_Played) * (Headshots / Hits)) - (Damage_Received / Hits)
Headshot ratio and accuracy must not be divided by time played, or if two players have equal aim, the one who played longer would get less rating. Because of this, frag rating will not be given in points and ppm. Damage_Given needs to be divided by time played, and a single rating is issued for that session, which will then be compared with your rating and other players ratings and session ratings.
I don't see any easy way to fix divide by 0s without throwing off accuracy of the rate, without conditional statements. Conditional statements should be possible though. (If hits = 0, then...)
Giriel's first stat example with this formula, low hs, damage, and acc for play time used for calculation:
Damage Given : 3005
Damage Received : 1657
Head Shots : 9
Hits : 81
Shots : 349
Time Played : will use 30 min on these because unknown, though probably much lower with this sample
((3005 / 30) * (81 / 349)) + ((3005 / 30) * (9 / 81)) - (1657 / 81)
23.247851 + 11.1296296 - 20.4567901
13.9206905
13.92
Stats example 2, smg with low damage and more received than given:
Damage Given : 7564
Damage Received : 10004
Head Shots : 34
Hits : 312
Shots : 1439
((7564 / 30) * (312 / 1439)) + ((7564 / 30) * (34 / 312)) - (10004 / 312)
54.666852 + 27.4760684 - 32.0641026
50.0788178
50.08
Example 3, panzer yielding relatively very high damage:
Damage given : 20334
Damage received : 12394
Head Shots : 16
Hits : 256
Shots : 740
((20334 / 30) * (256 / 740)) + ((20334 / 30) * (16 / 256)) - (12394 / 256)
234.482162 + 42.3625 - 48.4140625
228.430599
228.43
Example 4, mortar, high damage but did worse than panzer, but almost no damage received:
Damage given : 16742
Damage received : 702
Head Shots : 5
Hits : 140
Shots : 275
((16742 / 30) * (140 / 275)) + ((16742 / 30) * (5 / 140)) - (702 / 140)
284.106667 + 19.9309524 - 5.01428571
299.02
Obviously the heavy weapons did much better, but smg is more skill dependent, and I would like to try this out with my own stats some time. I don't think it is overly powered to the high-damage heavy weapons, I think it is just the sampling, and uknown times.
Anyone else have thoughts on the formula?
Edit: Played The last 9.73 minutes of Oilraid to get some stats really quick, even though there was very few players playing on the server and the session was short, but I wanted to get a realistic calculation from an accurate play-length:
Code:
>>> Map: oilraid
Overall stats for: -=PDP=-Scarhand (0 Rounds)
Weapon Acrcy Hits/Atts Kills Deaths Headshots
-------------------------------------------------
Knife : 0.0 0/6 0 0 0
MP-40 : 35.0 21/60 4 1 5
Thompson : 30.7 107/348 20 4 34
Dynamite : 100.0 1/1 1 0
K43 Rifle: 0 1 0
Foot Kick: 100.0 1/1 1 0
Damage Given: 3679 Team Damage: 0
Damage Recvd: 1627
Damage Given : 3679
Damage Received : 1627
Head Shots : 39
Hits : 130
Shots : 414
((3679 / 9.73) * (130 / 414)) + ((3679 / 9.73) * (39 / 130)) - (1627 / 130)
118.729861 + 113.432682 - 12.5153846
219.647159
219.65