Using AntiCheat is really straightforward. AntiCheat Pro gives you the opportunity to protect not only your fields / variables and protected player prefs. It also protects your time, computer/system time, prevents teleportation or general altering of the application.
Most of your data, for example, positions or health, is stored in the runtime memory. This memory is easily accessible by cheat tools or data sniffers. To prevent unwanted modification of the data in the memory, you have to encrypt it. To do so, you can use AntiCheats protected fields, to protect your application runtime data against cheater.
The usage is simple. Just use the protected types instead of the regular ones and read / write / calculate as you are used to:
// For example integer
ProtectedInt16 a = new ProtectedInt16(1234);
a += 1;
ProtectedInt32 b = new ProtectedInt32(5678);
b += 2;
ProtectedInt64 c = new ProtectedInt64(91011);
c += 3;
Unitys PlayerPrefs are useful to store user settings and user data. Unfortunately, these are not protected or encrypted and can be easily modified. To prevent this, you can use the AntiCheat Protected PlayerPrefs.
Also here, the usage is simple. The protected PlayerPrefs allow you to use 2 different methods:
-> ProtectedPlayerPrefs: Replaces the default functions of the Unity PlayerPrefs and adds some new ones. The protected prefs will be stored at the know default location.
-> ProtectedFileBasedPlayerPrefs: Is a custom implementation of the Unity PlayerPrefs allowing to store the player prefs protected at a custom file path. To assign a custom file path, set ProtectedFileBasedPlayerPrefs.FilePath. Now use ProtectedFileBasedPlayerPrefs like you would use the default Unity PlayerPrefs.
Unitys frame based calculation are mostly based on the UnityEngine.Time.deltaTime. This time very susceptible for cheating or hacking tools. Easily they can speed up or slow down your application. To prevent speeding / pausing / slowing down, you can use the AntiCheat ProtectedTime.
Replace your Time class with the ProtectedTime and get direct access to the protected time:
Debug.Log(Time.deltaTime + " : " + ProtectedTime.deltaTime);
Debug.Log(Time.unscaledDeltaTime + " : " + ProtectedTime.unscaledDeltaTime);
Debug.Log(Time.time + " : " + ProtectedTime.time);
Debug.Log(Time.unscaledTime + " : " + ProtectedTime.unscaledTime);
Debug.Log(Time.timeSinceLevelLoad + " : " + ProtectedTime.timeSinceLevelLoad);
Debug.Log(Time.realtimeSinceStartup + " : " + ProtectedTime.realtimeSinceStartup);
Computer time protection
Using the current date time is for many application useful. Not always you can use an internet time, so you have to trust the user / client, which is not be trusted. Many of us remember the old trick to reuse the windows xp 30 days trial, by just reseting the computer clock. Or even increase the date time to get advantages in games.
All of this is not possible anymore for the user / client by using AntiCheats ComputerTimeHackDetector. It will notify you when somebody modifies the date time and tries to get advantages.
Players or objects position are stored in the memory, like the most other variables. A user can easily access the memory with known cheat or hack tool and teleport himself or increase his speed. AntiCheats AntiTeleporation prevents this and also let you know if a user tried too.
A common way of cheating or stealing a whole application is by removing the app stores DRM protection or just changing the package name and then republish it. The genuine check can be used as an anti-piracy check to detect if the application was altered after being built.