![]() ![]() ![]() Now let's move to a regular example of a script without any obfuscation:.The script above will be used to generate a random number and 2 simple methods to obfuscate and deobfuscate the values. Public static float Deobfuscate(float obfuscatedValue) Public static float Obfuscate(float originalValue) Create a new script, call it 'SC_Obf', and paste the code below inside it:.The key is to have a value that is displayed on the screen to have completely different value from the variable, leading hackers in a completely wrong way when scanning. The random value is generated at the start, then the real value is subtracted from it (subsequently hiding it), then when needed, the hidden value is subtracted from a generated random value, with a difference being the original number. There are many ways to obfuscate a variable, but I will be using a method that I call Randomizer. Obfuscation is the action of making something obscure, unclear, or unintelligible. So the question is, how to protect the important values against a Value Scanning attack? The answer is Obfuscation. So most of the time only "exposed" values need to be protected.įor example on the screenshot above, every value on the screen is a potential target for hacking. Generally, novice hackers only target the values that are displayed on the screen and are known what they are used for (For example player health, ammo, etc.). Technically speaking, every value in the game can be overwritten/changed, but does it mean all of them are needed to be protected? Not necessarily. Most commonly used to increase player Health, Weapon Ammo, or any value that would give a hacker an unfair advantage in the game. Value scanning is a process of finding relevant values in the game's allocated memory and overwriting them with different values. To use the script make sure it's attached to any Object in the Scene. Once the difference between both times becomes too great (in this case 7 seconds, but you can choose any value, just make sure it's not too small to avoid false positives) the script calls the SpeedhackDetected() method which signalizes the presence of SpeedHack. ![]() Normally both times are updated at the same rate (assuming the Time.timeScale is set to 1), but when the SpeedHack is activated, it accelerates the in-game update frequency, making the in-game time accumulate faster. The script above compares the in-game time with a computer's (system) time. Speedhack was detected, do something here (kick player from the game etc.) Public class SC_SpeedhackDetector : MonoBehaviour ![]() SC_SpeedhackDetector.cs using UnityEngine Multiplayer games, however, are still able to do it by relying on server-side checks to detect any mismatch in the player-server time and take the appropriate action (kicking/banning the player, etc.). NOTE: As of today, this method no longer works, therefore, detecting speed hack has become much more difficult in single-player games. Speed hack works by speeding up the game's update rate, making everything faster, thus giving hackers an edge over the players who play at the normal speed.įortunately, there is a way to detect this hack in Unity. When it comes to hacking with Cheat Engine there are 2 most common attacks: Speed Hacking and Value Scanning.īeing the easiest to execute (only requires 2 clicks), the Speed Hack is usually the first choice for novice users. If you need more out-of-the-box solution feel free to check this Asset Store Package. NOTE: This article only briefly covers the most common attacks and basic protection against them. In this post, I will be showing how to make your game more secure against such attacks, which in turn will improve the experience for non-hacking players. Now, in single-player games, hacking doesn't really matter that much, but it becomes a problem when it's a multiplayer game where the other players are involved. The answer is, they're most likely using a program to inject their own values into the memory, with the most popular of such programs being Cheat Engine. Your first thought is of course they're hacking, but how do they do that? But days go by and you notice some players popping up on top of the scoreboard with unrealistically high scores. You finally released the game that you've been working so hard on, and maybe even added a leaderboard to add challenge to the game. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |