Anti-Cheat system for Unity3d

Does anybody knows any use-case of an anti-cheat system being used with Unity?

Anyone implemented a Punk-Buster solution?
Anyone implemented a GameGuard solution?

Does unity have any official and supported anti-cheat system?

I could not find any reference, any help would be appreciated.

Thanks, Ricardo Mello

To me that sounds by far too general. Cheating can be so many different things. Manipulating network packets in multiplayer games, manipulating client data at runtime, manipulating game data files, simulating inhuman input (fast-click-scripts) or using entire bots which imitate human interactions.

There is no general “thing” to fight against cheaters. Well, punkbuster and others try to implement such guardians, but they have to be very tolerant to minimize false alerts which in the end makes them almost useless. I play a lot QuakeLive and i know there are a lot cheaters out their and non of them got detected by punkbuster. Only a manual “check” by an operator / admin / supervisor can really detect or decide who’s cheating.

There’s not much Unity can do to prevent cheating in general. For multiplayer games you can enable the security layer to encrypt the transmitted data to prevent man-in-the-middle manipulations.

All other security checks have to be implemented and adjusted by yourself to fit your setup.

make a second variable for health, ammo, exp etc. then whenever you would change that variable change the second one as well and then if someone tries to change one of the variables through hacking it will be different to the second one so you can put

var health = 12
var health2 = 12
if(health != health2){
Application.Quit();
}

so if they try to hack to get more health it will close the game

also people could try to change both variables at once so to hide the second one you can make the second variable double the first one and then put

var health = 12
var health2 = 24
if(health != health2 / 2){
Application.Quit();
}

A better example of this would be to have two variables, one exposed and one modified with a random number.

For example (C#):

Random rndm = new Random();
//Random integer
int randomint = rndm.Next(0, 1000);
//Actual used integer
int ammoUnexposed = 32 * randomint;
//exposed integer
int ammo = ammoUnexposed / randomint;

public void Update()
{
    ammo = ammoUnexposed / randomint
    checkMemHack(ammoUnexposed, ammo, randomint);
}

public void checkMemHack(int unexposedInt, int exposedInt, int randomInt)
{
    if (exposedint != (unexposedInt / randomint))
    {
        //You can put your own code here that basically defines what happens if
        //the exposed and unexposed variables don't match, for example:
        Accounts.banCurrentPlayer("Memory hack");
    }
}

This isn’t too hard to move over to javascript, as for the random function, remove the first statement and replace the function with var randomint : int = Mathf.Random(min, max). You’ll also have to remove the public void from the start and replace with function.

Hey there, I have released Anti-Cheat Toolkit on Asset Store some time ago: Unity Asset Store - The Best Assets for Game Making
You may find it suitable for your needs if you need to hide some variables from memory scanners or prevent saves cheating.

Depending on the game you’ve designed, and the resources you have available, you could restrict your variable operations to a master server. That puts your logic behind whatever protection the server has available, and prevents tampering of such variables from the client.

That means you’d need to put all of your variables on the server. All the visual parts of the game will have to wait on the server or do guesswork to ensure no tampering can be done.

So none of this:

void shoot(float damage) //damage parameter can be hacked.
{ }

All this:

void shoot() //damage parameter on server.
{ }

This works for client-server models, which are slow. I don’t know how the pros do it with other models.