Cheat Engine Detection?

Hello

Im here trying to protect my game from cheats!

As we all know the worlds most used memory editing software is cheat engine

So what i want to know is do we have the ability to detect cheat engine?
I guess we have to select the app in the cheat engine for editing

Is there anyway we can detect cheat engine , If the user tries to scan a value , the app detects it and does a Application.Quit()

I tried anticheat toolkit by codestage but it protects only speed hacks(or maybe i dont know) , i kind of want more explanation on this

The best way that I have done it is by doing simple checks on your variables.

For instance lets say you have a health variable. You have it between 0-100. One simple check you can do is if its over 100 then they’ve messed with it.

Another way would be to make 2 variables one called health one called tmpHealth and make tmpHealth always 20 points higher than normal health. Then always make sure health is 20 less than tmpHealth. And if not they’ve messed with it. Simple checks like that can do what you want.

EDIT:
You can also just detect if cheat engine is running on the computer using this:

foreach (Process pro in Process.GetProcesses())
            {
                if (pro.ProcessName.ToLower().Contains("cheat") && pro.ProcessName.ToLower().Contains("engine"))
                {
                    //Cheat engine is running!
                }
            }

Then you can either do Application.Quit() or do pro.Kill() to force close cheat engine. You should do this a few times while the program is running to make sure they dont start it after they start your game.

I think its good to note though that if its a singleplayer game it doesnt really matter if they hack it because its only effecting them. If its multiplayer then there is much more you can do to prevent this some of the methods even involve streaming your entire DLL to the server for validation.(Which only takes 1-2 seconds)

EDIT2:

Getting the hash of a DLL is simple. Then its just a matter of sending it to the server and having the server get the hash as well. Then the server verifies if the hashes match. You’re going to want to hash the ‘Assembly-CSharp.dll’ file that Unity3D makes for every game(Found in _Data/Managed/Assembly-CSharp.dll)

You can get the files hash with this code:

static string GetHash(string FilePath)
        {
            FileStream fStream = null;
            try
            {
                fStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR:" + ex.Message);
                Console.ReadLine();
            }
            byte[] myArray = new byte[fStream.Length];
            fStream.Read(myArray, 0, myArray.Length);
            fStream.Close();
            fStream.Dispose();
            string hash;
            using (SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider())
            {
                return Convert.ToBase64String(sha1.ComputeHash(myArray));
            }
        }

BUT BE WARNED! They can modify the code client-side to send the server a false hash! Dont use this as your only authentication!

use anticheat toolkit perfect for obscuredType

Hi, Process.GetProcesses() give only processes of the current user, Cheat Engine can be started by the admin user.

To be sure I suggest you to use a script on a GameObject like that :

using System;
using UnityEngine;
using UnityEngine.UI;

public class CheckFlowOfTime : MonoBehaviour {
    //attributes to see changes during tests
    [SerializeField]
    private Text time;
    [SerializeField]
    private Text systemeTime;
    [SerializeField]
    private Text updatedText;
    [SerializeField]
    private Text lifeText;
    [SerializeField]
    private Text toleranceText;

    [SerializeField]
    private int life = 3;
    [SerializeField]
    private int gapTolerance = 3;

    private DateTime startDateTime = System.DateTime.Now;
    private DateTime updatedDateTime = System.DateTime.Now;
    

    public void Start() {
        InvokeRepeating(nameof(checkTime),0,1);
    }

    //not optimized, remove it when you will finish tests
    private void Update() {
        time.text =        "time       " + Time.time.ToString();
        systemeTime.text = "systemTime " + System.DateTime.Now.ToString();
        updatedText.text = "updateTime " + updatedDateTime.ToString();
        lifeText.text =    "life       " + life.ToString();
        toleranceText.text =    "tolerance  " + gapTolerance.ToString()+" s";
    }

    private void checkTime() {
        updatedDateTime = updatedDateTime.AddSeconds(1);
        if (updatedDateTime > System.DateTime.Now.AddSeconds(gapTolerance)) {
            updateLife();
        }
        
    }
    private void updateLife() {
        life--;
        if (life == 0) Application.Quit();
        TimeSpan timeSpan = updatedDateTime - System.DateTime.Now;
        double realGap = timeSpan.TotalSeconds;
        gapTolerance += Convert.ToInt32(realGap);
    }
}

I have found a way!

https://docs.samsidparty.com/Docs/1azjbu9Xr5z2FGJla1iKmiU9Juikb5kA8Y28WFshw3-M?options=1

Make sure this browser tab is not active, it will trigger a false positive :wink: