Guides · BossCheck team · Updated 2026-10-14

Never Trust the Client: Stopping Cheaters in Vibe-Coded Multiplayer Games

The number one rule of multiplayer security: the player controls their own machine, so anything the client says can be a lie.

What "trusting the client" looks like

AI coding tools love the simplest version that works. In multiplayer, that often means the client tells the server what happened:

// Client sends results. The server just believes it.
socket.emit("hit", { targetId, damage: 50 });
socket.emit("pickup", { item: "legendary_sword" });
socket.emit("score", { points: 12000 });

// Server
socket.on("score", (d) => { player.score = d.points; });  // anyone can send 999999

Anyone can edit memory with tools like Cheat Engine, change variables in the browser console, or send their own network messages. If the server applies whatever arrives, cheating takes minutes.

The fix: server-authoritative design

The client sends intent (inputs). The server decides outcomes.

// Client sends only what the player pressed
socket.emit("input", { seq, up, down, left, right, fire, aim });

// Server owns position, health, ammo and score
socket.on("input", (inp) => {
  const p = players.get(socket.id);
  if (!p || inp.seq <= p.lastSeq) return;      // drop replays and old inputs
  p.lastSeq = inp.seq;
  p.queue.push(inp);
});

function tick(dt) {                             // fixed server tick, e.g. 20-60 Hz
  for (const p of players.values()) {
    const inp = p.queue.shift();
    if (!inp) continue;
    const dir = normalize(inp);
    p.x += dir.x * MAX_SPEED * dt;              // speed capped by the server
    p.y += dir.y * MAX_SPEED * dt;
    if (inp.fire && p.ammo > 0 && now() >= p.nextShot) {
      p.ammo--; p.nextShot = now() + FIRE_COOLDOWN_MS;
      resolveHitServerSide(p, inp.aim);         // server does the hit check
    }
  }
}

The client can still predict movement locally so it feels responsive, then correct itself to the server's state. Engines like Unity Netcode for GameObjects, Mirror, Photon Fusion and Godot's high-level multiplayer API all support some form of server or host authority. Turn it on and use it.

Validate everything that arrives

Leaderboards and single-player scores

If there is no game server, you can't fully prove a score is real, but you can make cheating much harder. Submit scores to a server function, not straight to a database. Check plausibility (max points per second, session length). Require a signed-in account and rate-limit submissions. For high-stakes boards, submit a replay or input log and re-simulate it on the server.

What not to rely on

Prompt to paste into your AI coding tool

Audit this multiplayer code for any place the server trusts values sent by the client
(position, damage, health, score, currency, inventory, cooldowns). Refactor so the
client sends only inputs, and the server computes and validates all outcomes with
range checks, speed limits, cooldowns and per-connection rate limiting.

Want this checked automatically?

BossCheck is a security scanner for indie games built with AI tools. It's in pre-launch: join the waitlist for early access.

Join the waitlist →

FAQ

What does 'never trust the client' mean?

Anything running on a player's device can be modified, so the server must treat every message from the client as untrusted and decide the real outcome itself.

Will server authority make my game feel laggy?

Not if you use client-side prediction and reconciliation: the client shows the expected result immediately and corrects to the server's state when it arrives.

Do I need anti-cheat software?

For most indie games, server-authoritative logic and validation stop the most common cheats. Dedicated anti-cheat can add protection later, but it doesn't replace server checks.

How do I protect a leaderboard in a game without servers?

Send scores to a server function that checks plausibility, requires sign-in and rate-limits submissions, and never lets the client write directly to the database.

More guides