AntiCheatState struct
#include <Jazz2/Multiplayer/PeerDescriptor.h>
Server-side anti-cheat state of a peer.
Both the client and the server simulate the player, so their views of it always deviate a little (latency, jitter, a different frame rate), and a single implausible update is not evidence of cheating. Violations therefore only accumulate a suspicion score, which decays over time, and the server escalates in stages based on it — see MpLevelHandler for the thresholds. Owned by the main thread.
Public functions
- void ResetMovement()
- Forgets the movement history, the next update is checked only against the server position.
- void ResetMovement(Vector2f pos)
- Forgets the movement history and anchors it to the specified position with a full budget.
Public variables
- float Suspicion
- Accumulated suspicion, decays over time.
-
std::
uint64_t SuspicionUpdatedMs - Server time in milliseconds when Suspicion was last decayed.
-
std::
uint64_t IncidentStartMs - Server time in milliseconds when the current incident started, i.e., when Suspicion rose from zero.
-
std::
uint32_t IncidentViolations - Number of violations in the current incident.
-
std::
uint64_t NotifiedMs - Server time in milliseconds when the server console was last notified about this peer.
- bool Notified
- Whether the server console was already notified in the current incident.
- bool Kicked
- Whether the peer was already kicked, so it's not kicked again by updates still in flight.
-
std::
uint64_t SpeedViolationMs - Server time in milliseconds when an implausible speed was last counted (it's reported in every update).
- Vector2f LastAcceptedPos
- Last position reported by the client that was accepted.
- bool HasLastAcceptedPos
- Whether LastAcceptedPos is valid.
- float MoveBudget
- Remaining movement budget in pixels, refilled with the server time.
-
std::
uint64_t MoveBudgetUpdatedMs - Server time in milliseconds when MoveBudget was last refilled,.
-
std::
uint64_t ClockWindowStartMs - Server time in milliseconds when the current clock-drift window started,.
-
std::
int64_t ClockWindowMinOffset - Minimal difference between the server and the client time in the current window.
-
std::
int64_t ClockPrevMinOffset - Minimal difference between the server and the client time in the previous window,.
Variable documentation
std:: uint64_t Jazz2:: Multiplayer:: AntiCheatState:: MoveBudgetUpdatedMs
Server time in milliseconds when MoveBudget was last refilled,.
0 to refill it completely
std:: uint64_t Jazz2:: Multiplayer:: AntiCheatState:: ClockWindowStartMs
Server time in milliseconds when the current clock-drift window started,.
0 if not started yet
std:: int64_t Jazz2:: Multiplayer:: AntiCheatState:: ClockPrevMinOffset
Minimal difference between the server and the client time in the previous window,.
INT64_MAX if none