Universal - Memory Tampering - Detector
Important data such as positions or health status are usually stored in the runtime memory, which can be susceptible to manipulation by cheat tools or data sniffers. AntiCheat offers protected data types to prevent such memory manipulations and also to recognize and react to them.
Detector
Use the 'PrimitiveCheatingDetector' to detect such manipulation attempts. The detector does not require an additional monitor, the protected data types themselves are the data providers and inform the 'PrimitiveCheatingDetector' about memory manipulations or attempts.
Observed Subject
The detector is no active observer of the protected data types because this would create a performance and memory overhead. In this case it is the other way around, the protected data types inform the detector of detected manipulation or attempts. To learn more about the protected data types look here.
Detector Status
When the detector gets informed by the protected data types, it directly informs the observers about the threat using a 'CheatingDetectionStatus'. The status contains the following properties:
- PossibilityOfFalsePositive: A value indicating the possibility of a false positive when assessing threats for the implementing subject from 0.0 to 1.0.
- ThreatRating: The threat rating associated with the detected cheating, indicating the assessed level of a potential threat.
Supported Platforms
The detector is available on all platforms.
Requirements
There are no requirements.
How To Use
The usage is quite simple, attach a 'PrimitiveCheatingDetector' to a child GameObject of the 'AntiCheat-Monitor' and define a reaction on cheating detection.
Requirements
There are none. No additional monitor is required.
Add Detector Component
Manual
Add the 'PrimitiveCheatingDetector' MonoBehavior from the 'GUPS.AntiCheat.Detector' namespace to your 'AntiCheat-Monitor' GameObject or better to a child GameObject.
Add the 'PrimitiveCheatingDetector' as Component.
Prefab
There is also a prefab, including the detector, which you can directly attach as a GameObject to the 'AntiCheat-Monitor'.
Add the 'Primitive Cheating Detector' prefab to the 'AntiCheat-Monitor'.
Settings
After attaching the 'PrimitiveCheatingDetector' MonoBehavior to a GameObject, you will see the following in the inspector:
The settings of the 'PrimitiveCheatingDetector' Component.
- General Settings: Define here if the detector should be active.
- Threat Rating Settings: Define here the severity of the detected cheating.
- Observable Settings: Add here callbacks invoken when a cheating got detected.
Runtime
In this case, recognized memory manipulations are not provided directly by a monitor, but by the protected data types themselves. There are several protected data types that have been introduced by AntiCheat:
Protected Primitives: This includes default value types like int, float, string, ... and all Unity value types like Vector, Quaternion, ...
Collection (Pro): Important information can be not only within basic data types such as integer or float, but also within collections. AntiCheat provides protected alternatives for commonly used collections such as List, Queue and Stack, allowing you to monitor changes and check their integrity.
DataChain (Pro): A data chain is similar to a linked list consisting of a sequence of elements arranged in a specific order. It is used to maintain the order of these elements while preserving their integrity. Data chain can be useful in scenarios where you want to manage e.g. "Digital Assets", "Achievements", "Virtual Currencies" etc.
Once one of this protected data types recognize manipulation or an attempt of it, it notifies the 'PrimitiveCheatingDetector' which also notifies its observers of the detected cheating.
React On Cheating
When the detector (data validator) is set up, you sure want to react on detected cheating.
Punisher
In general, any cheat detected is forwarded to the 'AntiCheat-Monitor', which calculates an overall threat level. Based on the threat level, you can apply punishments by using Punisher components added to a child GameObject of the 'AntiCheat-Monitor'. There are some built-in punishers that you can find here as prefabs:
The location of the built-in Punisher prefabs.
Inspector
You can set a callback in the Unity Inspector view of the detector. This callback is invoken as soon as the specific cheating is detected.
A list of callbacks invoken when cheating got detected from the detector.
Code
If you would like to write a custom listener to the detector, you can attach an observer:
// Get the detector.
var detector = AntiCheatMonitor.Instance
.GetDetector<PrimitiveCheatingDetector>();
// Subscribe as observer and get notified on inconsistency.
detector.Subscribe(myObserver);
Also the detector has an inherited property 'PossibleCheatingDetected' which is set to true once a cheating got detected.