From 190b8bc9ce83354aab1dc13cecd10c41914bdf5d Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 3 Jun 2014 21:54:10 +0200 Subject: [PATCH] Add some more experimental anticheat data collection for snap-aim and speedhacks. --- qcsrc/server/anticheat.qc | 56 +++++++++++++++++++++++++++++++++++++ qcsrc/server/playerstats.qc | 12 +++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index 99e23aabd..31b5627dd 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -46,10 +46,25 @@ MEAN_DECLARE(anticheat_div0_strafebot_new, 5); MEAN_DECLARE(anticheat_idle_snapaim_signal, 5); MEAN_DECLARE(anticheat_idle_snapaim_noise, 1); +// TEMP DEBUG STUFF. +MEAN_DECLARE(anticheat_idle_snapaim_m2, 2); +MEAN_DECLARE(anticheat_idle_snapaim_m3, 3); +MEAN_DECLARE(anticheat_idle_snapaim_m4, 4); +MEAN_DECLARE(anticheat_idle_snapaim_m7, 7); +MEAN_DECLARE(anticheat_idle_snapaim_m10, 10); + .float anticheat_speedhack_offset; .float anticheat_speedhack_movetime, anticheat_speedhack_movetime_count, anticheat_speedhack_movetime_frac; MEAN_DECLARE(anticheat_speedhack, 5); +.float anticheat_speedhack_accu; +.float anticheat_speedhack_lasttime; +MEAN_DECLARE(anticheat_speedhack_m1, 1); +MEAN_DECLARE(anticheat_speedhack_m2, 2); +MEAN_DECLARE(anticheat_speedhack_m3, 3); +MEAN_DECLARE(anticheat_speedhack_m4, 4); +MEAN_DECLARE(anticheat_speedhack_m5, 5); + float movement_oddity(vector m0, vector m1) { float cosangle = normalize(m0) * normalize(m1); @@ -103,6 +118,11 @@ void anticheat_physics() float anglespeed = angle / dt; MEAN_ACCUMULATE(anticheat_idle_snapaim_signal, anglespeed, dt); MEAN_ACCUMULATE(anticheat_idle_snapaim_noise, anglespeed, dt); + MEAN_ACCUMULATE(anticheat_idle_snapaim_m2, anglespeed, dt); + MEAN_ACCUMULATE(anticheat_idle_snapaim_m3, anglespeed, dt); + MEAN_ACCUMULATE(anticheat_idle_snapaim_m4, anglespeed, dt); + MEAN_ACCUMULATE(anticheat_idle_snapaim_m7, anglespeed, dt); + MEAN_ACCUMULATE(anticheat_idle_snapaim_m10, anglespeed, dt); } } self.anticheat_div0_strafebot_forward_prev = v_forward; @@ -122,6 +142,22 @@ void anticheat_physics() self.anticheat_speedhack_offset += (f - self.anticheat_speedhack_offset) * frametime * 0.1; } + // new generic speedhack detection + if (self.anticheat_speedhack_lasttime > 0) { + float dt = time - self.anticheat_speedhack_lasttime; + self.anticheat_speedhack_accu *= exp(-dt / 5); + self.anticheat_speedhack_accu += frametime; + self.anticheat_speedhack_lasttime = time; + MEAN_ACCUMULATE(anticheat_speedhack_m1, self.anticheat_speedhack_accu, frametime); + MEAN_ACCUMULATE(anticheat_speedhack_m2, self.anticheat_speedhack_accu, frametime); + MEAN_ACCUMULATE(anticheat_speedhack_m3, self.anticheat_speedhack_accu, frametime); + MEAN_ACCUMULATE(anticheat_speedhack_m4, self.anticheat_speedhack_accu, frametime); + MEAN_ACCUMULATE(anticheat_speedhack_m5, self.anticheat_speedhack_accu, frametime); + } else { + self.anticheat_speedhack_accu = 1; + self.anticheat_speedhack_lasttime = time; + } + // race/CTS: force kbd movement for fairness if(g_race || g_cts) { @@ -199,12 +235,22 @@ void anticheat_report() // TODO(divVerent): Use xonstat to acquire good thresholds. GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - self.anticheat_jointime))); GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack), 240, 0.1, 0.15))); + GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m1), 240, 0.1, 0.15))); + GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m2), 240, 0.1, 0.15))); + GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m3), 240, 0.1, 0.15))); + GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m4), 240, 0.1, 0.15))); + GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m5), 240, 0.1, 0.15))); GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_old), 120, 0.3, 0.4))); GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_new), 120, 0.3, 0.4))); GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_evade), 120, 0.1, 0.2))); GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2))); GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal), 120, 0.1, 0.2))); GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2))); + GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m2), 120, 0.1, 0.2))); + GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m3), 120, 0.1, 0.2))); + GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m4), 120, 0.1, 0.2))); + GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m7), 120, 0.1, 0.2))); + GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m10), 120, 0.1, 0.2))); } float anticheat_getvalue(string id) @@ -212,12 +258,22 @@ float anticheat_getvalue(string id) switch(id) { case "_time": return servertime - self.anticheat_jointime; case "speedhack": return MEAN_EVALUATE(anticheat_speedhack); + case "speedhack_m1": return MEAN_EVALUATE(anticheat_speedhack_m1); + case "speedhack_m2": return MEAN_EVALUATE(anticheat_speedhack_m2); + case "speedhack_m3": return MEAN_EVALUATE(anticheat_speedhack_m3); + case "speedhack_m4": return MEAN_EVALUATE(anticheat_speedhack_m4); + case "speedhack_m5": return MEAN_EVALUATE(anticheat_speedhack_m5); case "div0_strafebot_old": return MEAN_EVALUATE(anticheat_div0_strafebot_old); case "div0_strafebot_new": return MEAN_EVALUATE(anticheat_div0_strafebot_new); case "div0_evade": return MEAN_EVALUATE(anticheat_div0_evade); case "idle_snapaim": return MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise); case "idle_snapaim_signal": return MEAN_EVALUATE(anticheat_idle_snapaim_signal); case "idle_snapaim_noise": return MEAN_EVALUATE(anticheat_idle_snapaim_noise); + case "idle_snapaim_m2": return MEAN_EVALUATE(anticheat_idle_snapaim_m2); + case "idle_snapaim_m3": return MEAN_EVALUATE(anticheat_idle_snapaim_m3); + case "idle_snapaim_m4": return MEAN_EVALUATE(anticheat_idle_snapaim_m4); + case "idle_snapaim_m7": return MEAN_EVALUATE(anticheat_idle_snapaim_m7); + case "idle_snapaim_m10": return MEAN_EVALUATE(anticheat_idle_snapaim_m10); } return -1; } diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index f43a6399d..3186b1aa3 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -8,12 +8,22 @@ string events_last; #define ALL_ANTICHEATS \ ANTICHEAT("_time"); \ ANTICHEAT("speedhack"); \ + ANTICHEAT("speedhack_m1"); \ + ANTICHEAT("speedhack_m2"); \ + ANTICHEAT("speedhack_m3"); \ + ANTICHEAT("speedhack_m4"); \ + ANTICHEAT("speedhack_m5"); \ ANTICHEAT("div0_strafebot_old"); \ ANTICHEAT("div0_strafebot_new"); \ ANTICHEAT("div0_evade"); \ ANTICHEAT("idle_snapaim"); \ ANTICHEAT("idle_snapaim_signal"); \ - ANTICHEAT("idle_snapaim_noise"); + ANTICHEAT("idle_snapaim_noise"); \ + ANTICHEAT("idle_snapaim_m2"); \ + ANTICHEAT("idle_snapaim_m3"); \ + ANTICHEAT("idle_snapaim_m4"); \ + ANTICHEAT("idle_snapaim_m7"); \ + ANTICHEAT("idle_snapaim_m10"); void PlayerStats_Init() // initiated before InitGameplayMode so that scores are added properly { -- 2.39.2