user-hoodieAnti-Cheat System

The Enemy Masses Anti-Cheat System provides server-side protection against common multiplayer cheats in RTS games. This guide covers configuration, integration with Netcode for GameObjects 2.7.0, and building custom admin tools.

circle-info

Naming Note: The component appears as "Anti-Cheat Manager" in the Unity Inspector and Add Component menu, but the C# class is named AntiCheatComponent. They refer to the same component.

Context
Name

Unity Inspector

Anti-Cheat Manager

Add Component Menu

Enemy Masses/Networking/Anti-Cheat Manager

C# Class

AntiCheatComponent

Namespace

Arawn.EnemyMasses.Runtime.Networking


Should You Use It?

✅ When to Use

Scenario
Reason

Competitive Multiplayer

Ranked matches need protection

Authoritative Server

Server validates all actions

PvP Games

Players gain advantage by cheating

Games with Economy

Cheating devalues items/currency

Free-to-Play

Higher cheat motivation

❌ When NOT to Use

Scenario
Reason

Single-Player Only

No cheaters to protect against

Co-op Only

Cheating only affects the cheater

Client-Authoritative

Anti-cheat requires server validation

Prototype/Testing

Adds complexity during development

Trusted LAN Play

Friends rarely cheat


Architecture Overview

What It Detects

Cheat Type
What It Does
How We Detect It

Speed Hack

Move units faster than allowed

Velocity monitoring

Teleport Hack

Instantly move units

Distance-per-frame checks

Damage Hack

Deal more damage than possible

DPS and per-hit limits

God Mode

Take no damage

Health reconciliation

Command Flooding

Send thousands of commands

Rate limiting

Ownership Violation

Control other players' units

Ownership validation

Range Hack

Attack from across the map

Distance calculations

Graduated Response System

The anti-cheat uses a suspicion score instead of instant bans:

This prevents false positives from network lag or edge cases.


Quick Start

1. Add the Component

Option A: Menu

Option B: Code

2. Choose a Preset

Preset
Suspicion Threshold
Speed Tolerance
Best For

Default

5.0

1.5x

Most games

Strict

3.0

1.2x

Competitive/ranked

Lenient

10.0

2.0x

Casual/co-op

Custom

Your choice

Your choice

Fine-tuning

3. Access at Runtime


NGO 2.7.0 Integration

Server-Only Initialization

Validating Damage RPCs

Validating Command RPCs


Configuration Reference

Suspicion Settings

Property
Default
Description

suspicionThreshold

5.0

Score that triggers cheater flag

suspicionDecayRate

0.1

Points decayed per second

Damage Validation

Property
Default
Description

maxDamagePerHit

500

Maximum single-hit damage

maxDPS

300

Maximum damage per second

maxAttackRange

25

Maximum attack distance

Speed Detection

Property
Default
Description

speedTolerance

1.5

Multiplier over max speed

speedViolationThreshold

5

Violations before flagging

teleportThreshold

50

Distance considered a teleport

Command Validation

Property
Default
Description

maxCommandsPerSecond

30

Rate limit per player

maxAgentsPerCommand

200

Max agents in one command

Reconciliation

Property
Default
Description

reconciliationInterval

1.0

Seconds between state snapshots

enableDeltaCompression

true

Only send changed fields


API Reference

AntiCheatComponent

Properties

Methods

Events

AntiCheatStatistics

CheatType Enum


Building Admin Panels

In-Game Dashboard Example

Player Row UI Component

Server Console Commands


Responding to Cheaters

Graduated Response Pattern

Logging for Review


Performance Considerations

Validation Overhead

Operation
Overhead

Damage validation

~0.01ms per check

Command validation

~0.02ms per command

Speed detection

~0.01ms per update

State reconciliation

~0.1ms per snapshot

Optimization Tips


Troubleshooting

High False Positive Rate

Symptoms: Legitimate players getting flagged

Solutions:

  1. Use Lenient preset

  2. Increase speedTolerance to 2.0+

  3. Increase suspicionThreshold to 10+

  4. Network lag may cause position jumps — increase tolerances

Cheaters Not Detected

Symptoms: Obvious cheaters slip through

Solutions:

  1. Use Strict preset

  2. Decrease suspicionThreshold to 3

  3. Lower speedTolerance to 1.2

  4. Verify anti-cheat is enabled on server

Performance Issues

Symptoms: Server lag with anti-cheat enabled

Solutions:

  1. Increase reconciliationInterval to 2.0+

  2. Ensure anti-cheat is server-only

  3. Reduce unit counts or command frequency


Best Practices

✅ Do
❌ Don't

Enable only on server

Run validation on clients

Start with Default preset

Jump to Strict without testing

Log incidents before punishing

Auto-ban on first detection

Warn players before kicking

Instantly remove players

Reset between matches

Carry suspicion across sessions

Combine with server authority

Rely solely on anti-cheat

Review logs for false positives

Assume all detections are valid


Editor Tools

Anti-Cheat Monitor Window

Access via: Tools → Enemy Masses → Network → Anti-Cheat Monitor

Features:

  • Real-time statistics

  • Per-player suspicion levels

  • Detection log

  • Quick actions (reset, flag, kick)

Debug Logging

Enable in Inspector to see detections in Console:

Test Mode


See Also

  • Networking Overview - How Enemy Masses networking works

  • NGO Integration Guide - Full NGO 2.7.0 setup

  • Local Network Authority - Testing without real networking

Last updated