I have read that it is very easy to hack and recompile an unity game.
Also, I read that they have a function (provided by the engine) to
determine that the game has been recompiled.
Yes, Unity has a function to determine if your game has been de-compiled and recompiled or modified in any way. But the hacker would be smart enough to modify what that function returns, before re-compiling the game. Any protection code you write can be modified or removed by the hacker.
I release the game, a bad guy hacks it and publish as his own, but
somewhere in the depth of the code still there is a check that the
game has been recompiled, so that I can display some note to the user
or to make the game unplayable.
Some one will always try to hack your game. This will be likely if your game is famous and is played by many. Displaying some note to the user wont stop hackers from hacking your game. Making the game unplayable wont either.
Is it easy to hack a cocos game? Do I need to worry about it? How to
make a small copy protection for my game?
Any game can be hacked. Depending on the hacker’s experience, the hack could be hard or easy for them. You don’t need to worry about this. Large game companies have dedicated team of programmers that protects their games but it only takes hackers weeks or months to remove every protection from the game and make the game playable once again.
Spend most of your time making great games and make the game cost to be affordable, then less people will pirate your game. There is no way you can fully stop people from hacking your game no matter the programming language or operating system the game was designed for.
EDIT:
-
To add a simple protection you, should obfuscate your C++ code.Obfuscation will make your code more un-readable. For example, if you have a class called
PlayerInfo
that contains the score, Obfuscation will rename the class name toEsfjhsakm4
. The hacker would have to go through everything one by one to realize what’s going on in your app. You can google C/C++ Obfuscator for more information. -
Another way to protect your code is to give your game a limit of player score over time. Maybe if a player points goes from 0 to 100 within a second and you know that is not possible with your game mechanics, you can detect this as a hack and then take action.
-
If this is a network game, make the game so that players would have to register and sign in to play. Then you can ban the player’s account if you catch them cheating. Also ban their IP Address for 3 days then lift the ban after 3 days but don’t lift the ban on the player’s account.
-
Detect if an item has been unlocked while the user has not played the level that is required to unlock that item.
The big advice is that you don’t let user know that you detected hack in their game. Just take a background action such as changing the games mode from easy to hard, banning the player and make the game annoying. If you close the game when hack is detected, they will remove the code that closes the game.
7
solved How to make a simple check that the game was recompiled? [closed]