Markasium CS2 sheetSheet Note N3 · Sheet 07 TR / EN

Note N3 · Markasium CS2

NO AUTOMATIC BANS

Three layers instead of AI in an anti-cheat: deny information, enforce hard rules, leave evidence to a human

Sheet
MARKASIUM CS2
Topic
CS2 · C# · Anti-cheat
Source
AllInOneCore/AntiCheat/AcConviction.cs
Date
2026-11-12
Reading
6 min

Short answer: don't try to build an anti-cheat on machine learning for a small server; your data won't carry it. Build three deterministic layers: (1) deny information on the server, (2) catch hard rule violations, (3) collect suspicious behaviour in an evidence score that decays over time and leave the decision to staff. No detection punishes a player on its own; every staff verdict and every false positive is recorded.

01Why no machine learning

The first plan was to train a model on a public CS2 cheat dataset. A closer look turned up four problems:

  • The dataset's labels were per match: "there is a cheater in this match", not which shot was cheated.
  • There were few matches; a model would memorise those matches, not the cheat.
  • The data came from match recordings (demos); it is not the same as view angles sampled on a live server.
  • Some signals the model would use (such as the raw distribution of mouse movement) didn't exist on the server at all.

A "cheater" verdict from a model that can't be measured means wrong bans. Decision: no AI, measurable rules.

02Three layers

  • Deny information: an opponent a player shouldn't see is never sent (FOW). A large part of wallhacking is neutralised without detecting anything.
  • Hard rules: undisputed cases such as firing faster than the weapon allows or impossible values in the commands a player sends.
  • Evidence score: behaviour that proves nothing alone but gains meaning as it repeats, such as sudden aim locks or tracking a hidden opponent through a wall.

03How the score builds up

Every detection adds to the player's score, but the score doesn't stay put:

  • It decays: the score has a half-life; a suspicious moment months ago doesn't decide today.
  • Repeats count for less: each new detection of the same kind adds less than the last. A single bad threshold in one detector cannot push a player over the line alone.
  • Different kinds reinforce each other: two independent detectors flagging the same player is stronger evidence than one detector flagging them many times.

There are two thresholds: at the first, online staff get an alert (including a Discord webhook); at the second, the system files a report. Neither is a punishment.

04The scoring code

The whole score is computed in two small functions. Decay is exponential in the time since the last update; there is no separate timer, the score is recomputed whenever it is read or written:

private static void Decay(Suspect s, AcSettings cfg)
{
    var now = DateTime.UtcNow;
    double ms = (now - s.LastUpdate).TotalMilliseconds;
    if (ms > 0) s.Score *= (float)Math.Pow(0.5, ms / (Math.Max(1f, cfg.HalfLifeMinutes) * 60_000.0));
    s.LastUpdate = now;
    // very old evidence leaves the list; its score has already decayed
    s.Incidents.RemoveAll(i => (now - i.At).TotalMinutes > cfg.HalfLifeMinutes * 6);
}

When a new detection is added, decay is applied first, then recent evidence of the same kind is counted and the new points are scaled down by that count. On read, a multiplier for the number of distinct kinds is applied (the constant values are left out here):

// add: each repeat of the same kind brings fewer points
int repeats = s.Incidents.Count(i => i.Code == code
    && (now - i.At).TotalMinutes <= cfg.HalfLifeMinutes * 2);
float points = basePoints * (float)Math.Pow(REPEAT_FACTOR, repeats);

// read: independent detectors reinforce each other
int distinct = s.DistinctCodes(TimeSpan.FromMinutes(cfg.HalfLifeMinutes * 2));
return s.Score * (1f + SYNERGY * Math.Max(0, distinct - 1));

The windows are defined as multiples of the half-life: when the half-life setting changes, the repeat window and evidence retention scale with it, so there aren't three numbers to tune separately. There is also a short cooldown per player and kind; if a detector reports the same moment several times in a row, only the first counts.

05Bad connections get trimmed

Reflex and snap-aim detections are sensitive to network latency: packet loss or a fluctuating ping can make a player's view angle look like it jumped on the server. If the player's connection is unstable at that moment, the points for these kinds are cut sharply and the evidence record gets a [lag-shield] tag. The detection isn't deleted; staff see the record, but a bad connection alone doesn't push anyone to the alert threshold.

06One signal isn't enough for a report

Even when the score passes the report threshold, a separate check runs before a report is written. If none of these three conditions holds within the recent window, no report is filed and staff only get an alert:

public static bool Corroborated(Suspect s, AcSettings cfg)
{
    var window = TimeSpan.FromMinutes(cfg.HalfLifeMinutes * 2);
    var now = DateTime.UtcNow;
    var recent = s.Incidents.Where(i => now - i.At <= window).ToList();
    // 1) is there a measured, humanly impossible kind
    if (recent.Any(i => cfg.ReportStrongCodes.Contains(i.Code))) return true;
    // 2) are enough distinct detectors flagging the same player
    if (recent.Select(i => i.Code).Distinct().Count() >= cfg.ReportMinDistinctCodes) return true;
    // 3) has a single kind repeated enough
    return recent.GroupBy(i => i.Code).Any(g => g.Count() >= cfg.ReportMinRepeats);
}

So a single high-scoring detection, however heavy, cannot produce a report on its own. The only exception is kinds that measurement shows to be impossible for a human; those are already close to the hard rules of the second layer.

07A human decides

Staff give a suspect one of four verdicts: cheating, watch, false positive, clean. The verdict is tied to the last evidence record that produced the score; which detection led to which verdict can be queried later.

public bool Confirmed;      // staff said "cheating"
public bool Watched;        // staff said "watch"
public int FalsePositives;  // number of "false positive" verdicts
public long LastEventId;    // the verdict is tied to this evidence

All incidents are written to the database (aio_ac_incidents) and the audit log. Each detection's numeric measurements are kept too: if a model is ever trained, it will be on a set built from the server's own data, labelled by staff.

08What a verdict does to the score

Verdicts are not just labels; they change the score:

  • False positive for a specific kind: only that detector's evidence leaves the list and its points are subtracted; other detectors' evidence stays. The false-positive counter goes up by one.
  • False positive without a kind and clean: all evidence and score are reset.
  • Cheating and watch exclude each other. In the first version they were separate flags; a player who got "cheating" and then "watch" showed both on the status screen. Now each verdict clears the other.

This behaviour runs in the server's self-test against the real scoring engine: 7 points of evidence from two kinds are written, a false positive for one of them must bring the score down to 4 and keep the other kind's evidence; then the cheating, watch and clean verdicts are tried in turn.

09Emergency stop

If a detector starts producing false positives in bulk after an update, staff can stop scoring without switching the anti-cheat off entirely. The switch is turned on with a staff command and written to a settings file, so it stays on across server restarts and mode switches. While it is on, new detections are rejected and existing scores and evidence stay as they are. The self-test makes the same call first with the switch on (the score must not change) and then with it off (the score must go up); without the second step, the test would also pass a scoring engine that never worked.

10Living with false positives

One of the decoy (honeypot) based detections, once measured, was also scoring clean players: an ordinary angle hold or a quick turn counted as a trigger. The fix was to require stricter conditions on every trigger and to not count it at all if a real player is on the same line. Suppressed triggers are counted separately and shown on the staff status screen; how much noise a detector produces is measured, not guessed.

→More notes from this project

—End of notewritten by MUHAMMEDPYZ