Skip to content

Add anti-cheat GM test tooling (.spoof cheat simulator + .anticheat test/score/top inspection)#389

Open
Krilliac wants to merge 3 commits into
mangoszero:masterfrom
Krilliac:feature/anticheat-tooling
Open

Add anti-cheat GM test tooling (.spoof cheat simulator + .anticheat test/score/top inspection)#389
Krilliac wants to merge 3 commits into
mangoszero:masterfrom
Krilliac:feature/anticheat-tooling

Conversation

@Krilliac

@Krilliac Krilliac commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

This change is Reviewable

Krilliac and others added 3 commits June 20, 2026 22:50
…ection + enforcement)

Introduces a config-gated, server-side anti-cheat / movement-validation
framework. OFF by default (AntiCheat.Enable = 0) — fully inert until enabled.

Core pieces:
- AntiCheatMgr: central scoring manager. Detectors only observe and score via
  a single RecordViolation() ingress; the manager owns ALL enforcement. Score
  decays over time and escalates through capped actions (log -> GM alert ->
  rubberband to last validated position -> kick), with an optional account-level
  autoban accumulator (escalating ban durations, slow hourly decay).
- MovementAnticheat: per-player validator running cheap, event-driven detectors
  on each movement packet — fly/flag-spoof (water-walk/hover/slow-fall/transport/
  swim, aura- or grant-aware), teleport/blink, speed, acceleration gate, vertical
  climb, root/stun-break, opcode-legality, no-clip (VMap LoS), jump (infinite/
  mid-air), fall-damage suppression, packet burst, client-timestamp regression,
  bot-movement heuristic, and spell-cast timing (GCD bypass + cast spam).
- PhysicsValidator: side-effect-free terrain-plausibility stage (float-above /
  below-surface), invoked only on suspicion to stay off the hot path.

Integration: movement validation in the movement opcode handler; spell-injection,
item-in-trade, GO-use and NPC interaction-distance hooks; cast-timing hook;
server-granted movement flags recorded in the Player Set* setters so the
flag-spoof detectors don't fire on legit grants; a rolling latency EWMA fed from
CMSG_PING for latency-aware tolerances. GM commands: .anticheat status / report /
reload / warn / jail / unjail / delete. Violations persist to
character_anticheat_violation; account autoban state to account_anticheat.

Time-sync, the spoof/test GM tooling, and the violation-marker visualizer are
follow-ups that build additively on this core.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ctor, move-time-skip handling)

Builds additively on the anti-cheat core. Adds a vanilla-compatible time-sync
layer; fully inert until TimeSync.Enable=1 (the core latency EWMA stays always-on
so movement detectors keep their latency-aware tolerances either way).

- Per-session client<->server clock-offset service in MovementAnticheat (smoothed
  serverMs - clientTime; its drift is the desync signal).
- DESYNC detection feeding the core scorer: per-packet client/server elapsed-time
  divergence (incl. zero-client-time-while-moving) + a latency-spike check raised
  on the network thread and recorded on the safe world thread.
- CMSG_MOVE_TIME_SKIPPED handling: relays the skip to nearby observers (kills
  observer-side warp after a client clock jump), re-baselines the clock service +
  graces the desync detector for the legit case, and scores oversized/spammed/
  accumulated skips as a time-based movement-masking vector.
- Move-ack timestamp validation (force-speed / water-walk acks): flags client
  timestamp regression and folds the sample into the clock-offset service.
- Optional movement-timestamp correction (default OFF) normalising the relayed
  timestamp to the server clock so observers interpolate on one timebase.
- Optional desync auto-resync (default OFF): rubberbands a sustained-desync client
  to its authoritative position (the only vanilla resync lever), cooldown-limited.
- GM commands: .timesync status / config / set / resync / skip. Full TimeSync.*
  config block in mangosd.conf.dist.in; all OFF by default.

The spoof/test GM tooling (.timesync desync, SimulateCheat) and the violation
marker visualizer remain separate follow-ups and are intentionally not included.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…est/score/top, .timesync desync)

Builds additively on the anti-cheat core + time-sync. GM/dev tooling that
exercises and live-tests every detection vector by actually driving the cheats,
so admins can verify the AC end-to-end:

- .spoof <kind>|all|bots — crafts the packet signature of a named cheat
  (speed/teleport/fly/waterwalk/hover/slowfall/swim/transport/vertical/jump/
  desync/noclip) and runs it through the REAL detectors, restoring the
  validator baseline afterwards so live tracking is unaffected.
- .anticheat test — injects a synthetic violation (one type or all) through the
  full scoring/persist/escalation pipeline on the caller.
- .anticheat top / score / set — score triage and direct score manipulation to
  exercise the warn/rubberband/kick thresholds; .anticheat rubberband.
- .timesync desync — the time-sync vector's simulator (deferred from the
  time-sync PR because it depends on this tooling).

A transient manager test-bypass lets the simulators drive the detectors even on
an exempt GM / with AC disabled, scoped tightly around each synchronous run on
the world thread. Commands are console-capable (usable via SOAP when compiled).
No default-enable changes; reuses the existing AntiCheat.* config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 high

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
Compatibility 2 high

View in Codacy

🟢 Metrics 483 complexity · 6 duplication

Metric Results
Complexity 483
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AppVeyorBot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants