Cheat Types & Anti-Cheat
Validation (Never Trust the Client) stops messages that break the rules. Many cheats don't break any rule in a single message: an aimbot sends perfectly legal "fire at yaw 1.23" inputs, just with inhuman accuracy. This lesson sorts cheats by where they attack, then looks at the layers of defense studios combine.
A map of common cheats
| Cheat | What it does | Where it attacks | Main defense |
|---|---|---|---|
| Speed hack | runs the client clock faster, or edits movement | movement messages | server-side movement, speed budget |
| Teleport / noclip | sets the position directly | client-authoritative movement | server authority, position checks |
| Wallhack / ESP | draws enemies through walls, shows health and loot | data the client received | send less: interest management |
| Aimbot / triggerbot | reads enemy positions from memory, moves the aim and fires | legal inputs, inhuman timing | statistics, replay review, client anti-cheat |
| Packet editing / replay | changes or resends captured packets | the protocol | encryption + authentication, sequence numbers |
| Lag switch | cuts the connection briefly, then lets the backlog through | lag compensation and prediction | cap rewind time, input-gap checks |
| Duping | duplicates items through races (two trades at once, crash during a save) | backend and persistence | transactions, idempotency (Persistence) |
| Macro / bot farming | automates play for resources | economy | behaviour analysis, rate limits |
Two lessons hide in that table.
- The client can only cheat with what it has. A wallhack is possible because the server sent the position of an enemy behind a wall. If the server only sends what the player could plausibly see or hear, ESP shows nothing useful. Fog-of-war games (RTS, MOBAs) and competitive shooters do server-side visibility culling for exactly this reason.
- Authority removes whole categories. With an authoritative server, speed hacks, teleports and "I dealt 9999 damage" don't work at all. What remains are cheats that play the game too well: aimbots, triggerbots, information leaks.
Lag switches
A lag switch abuses tolerance. The cheater's inputs stop arriving for a second; other players see them frozen; then everything they did arrives at once. With generous lag compensation, their shots are judged against where targets were a second ago. Defenses:
- cap how far the server rewinds (often around 200–250 ms); beyond that the shooter must lead the target;
- don't let buffered inputs execute faster than real time: the server simulates at most a few late inputs per tick and drops the rest;
- track input gaps per player; regular one-second gaps during fights are a pattern.
Spotting the inhuman with statistics
Server-side anomaly detection compares each player with the population. It never bans by itself; it ranks players for human review. Here is a deterministic model: twelve honest players with seeded random stats and one player with an aimbot. For each metric we compute a z-score (how many standard deviations from the mean) and flag players far outside on two metrics at once.
function mulberry32(seed: number) {
return () => {
seed = (seed + 0x6d2b79f5) | 0;
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const rnd = mulberry32(2024);
const between = (a: number, b: number) => a + (b - a) * rnd();
type Stats = { name: string; headshotRate: number; reactionMs: number };
const players: Stats[] = [];
for (let i = 1; i <= 12; i++) {
players.push({ name: `player${i}`, headshotRate: between(0.12, 0.32), reactionMs: between(190, 290) });
}
players.push({ name: 'suspect', headshotRate: 0.71, reactionMs: 95 }); // locks on instantly, always the head
function zScores(values: number[]): number[] {
const mean = values.reduce((a, b) => a + b, 0) / values.length;
const sd = Math.sqrt(values.reduce((a, v) => a + (v - mean) ** 2, 0) / values.length);
return values.map((v) => (v - mean) / sd);
}
const zHead = zScores(players.map((p) => p.headshotRate));
const zReact = zScores(players.map((p) => -p.reactionMs)); // faster = more suspicious
console.log('name headshot reaction z(head) z(react) review?');
players.forEach((p, i) => {
const flag = zHead[i] > 2.5 && zReact[i] > 2.5 ? 'YES' : '';
console.log(
`${p.name.padEnd(10)} ${(p.headshotRate * 100).toFixed(0).padStart(6)}% ${p.reactionMs.toFixed(0).padStart(6)} ms` +
` ${zHead[i].toFixed(2).padStart(7)} ${zReact[i].toFixed(2).padStart(7)} ${flag}`,
);
});name headshot reaction z(head) z(react) review?
player1 28% 261 ms 0.11 -0.54
player2 25% 259 ms -0.12 -0.49
player3 22% 257 ms -0.32 -0.45
player4 19% 206 ms -0.55 0.60
player5 21% 260 ms -0.40 -0.52
player6 25% 270 ms -0.12 -0.72
player7 22% 199 ms -0.37 0.75
player8 21% 234 ms -0.39 0.02
player9 31% 206 ms 0.28 0.60
player10 12% 248 ms -1.06 -0.28
player11 32% 281 ms 0.38 -0.95
player12 18% 280 ms -0.66 -0.93
suspect 71% 95 ms 3.21 2.89 YES
Real systems use many more signals (aim snap angle per frame, accuracy against targets that are not visible, kill rate by weapon, report counts) and compare against players of similar skill, since a top professional also has unusual numbers. A single high z-score is a reason to look, never a verdict.
Client-side anti-cheat
Statistics catch cheats after the fact. Client anti-cheat tries to stop them on the player's machine: it checks the game's memory and files for tampering, looks for known cheat programs and blocks other processes from reading the game's memory. Widely used products:
- Easy Anti-Cheat (Epic Games), offered to PC developers through Epic Online Services; it supports Windows plus native macOS and Linux builds, and each game can opt in to running under Wine/Proton (which is what Steam Deck support needs).
- BattlEye, a commercial anti-cheat used by many shooters and survival games.
- Valve Anti-Cheat (VAC), built into Steam for games that enable it; known for delayed ban waves, so cheat makers can't tell which build was detected.
Some of these run kernel-mode drivers, which raises privacy and stability concerns and can block players on Linux or in virtual machines. Weigh that against your genre: a casual co-op game rarely needs it, a competitive shooter usually does. Check each vendor's current platform support and terms before you commit.
Note: Client anti-cheat raises the cost of cheating; it never makes the client trustworthy. Keep the server authoritative even when anti-cheat is on.
Replays and human review
Because a deterministic or authoritative server records inputs anyway, you can keep server-side replays of flagged matches. Reviewers (or trusted community members, as Valve's Overwatch system did for CS:GO) watch from the suspect's point of view with wallhack-style vision turned on and judge whether the player was reacting to information they shouldn't have had. Store enough per match to replay it, and keep replays of flagged players longer.
A layered defense
- Authority and validation: removes impossible actions.
- Send less: interest management and visibility culling make ESP useless.
- Secure transport: encrypted, authenticated packets with sequence numbers stop editing and replay (DTLS, or the encryption your transport library offers).
- Client anti-cheat: raises the cost of memory reading and injection.
- Statistics and reports: rank suspicious players.
- Review and delayed bans: humans decide; bans in waves.
- Economic friction: bans tied to accounts that cost something (a purchase, phone verification, play time before ranked).
See also the Cybersecurity course for general threat modelling.
Test yourself
Which defense makes a wallhack (ESP) show nothing useful, even if the cheat itself is never detected?
- Faster tick rate
- Not sending the positions of enemies the player can't plausibly see or hear
- Encrypting packets
- Delayed ban waves
An anomaly detector gives a player z-scores of 3.1 for headshot rate and 2.8 for reaction time. What should happen?
- Instant permanent ban
- The player is queued for human review, maybe with a replay
- Nothing, z-scores are meaningless
- Lower the player's MMR
How does capping lag-compensation rewind time help against lag switches?
- It reduces bandwidth
- Shots delivered after a long artificial delay are no longer judged against old target positions
- It makes the server faster
- It disconnects every player with high ping