Anti-cheating in game development and a brief introduction to its principles
Preface
How to prevent cheating still accounts for a very important proportion in game development, which also involves Regarding game profitability, if anti-cheating measures are not taken, the app we develop may be released online the next day or a cracked free version will be released the next day. I have experienced this personally. Of course, this is based on the app and is easier to be cheated by cheating companies. I’ve been following it. The once popular PC version of the chicken game is actually very rampant in cheating. This is also because there is no anti-cheating. Job seekers are often asked how to prevent cheating when applying for jobs. Of course, we can think of the simplest way. The solution is not to trust any data on the client, but to verify the server data. Of course, this solution can be designed like this in some situations where there is relatively little client-server interaction. Assuming FPS, the damage caused by each shot is one frame. There will be many shots in it. It is impossible to check with the server every time. The interaction is too frequent and the experience is very poor. But if it is not checked, the client will modify the weapon attribute value. This is the client cheating. How? To solve this problem, the following will introduce anti-cheating ideas.
How to cheat on the client
Mobile version
When I first started playing mobile games, I must have played Flappy Bird. Everyone who plays the game knows that it is a very cruel mobile game. It was also very popular at the time, and everyone in the circle of friends was posting their scores. Later, I learned that I could use an app called "Eight Gate Artifacts" to cheat and modify the scores, and then modify them to very high scores. Posting your scores in your circle of friends will make you look "very awesome" and satisfy your own vanity. The principle is to modify the score memory value to achieve the effect of cheating.
PC side
There are also corresponding software for modifying the memory on PC, such as Cheat Engine, which is similar to the eight-door artifact on the mobile phone. How to apply it is shown in the figure below:
How to prevent cheating
Unity development recommends a plug-in called Anti-Cheat Toolkit, which you can download from the Asset Store. The specific principle is that through data obfuscation, the value displayed on the UI is actually the value we calculated, so the memory modifier cannot find the memory address based on the value displayed on the UI.
Anti-cheating principle
private int curATK; private int curAtkKey; public int CurATK { get { return curATK ^ curAtkKey; } set { curAtkKey = Random.Range(0, 0xffff); curATK = value^curAtkKey; } }
Analysis: The ^ operation is an XOR operation, which requires a little bit of binary knowledge. The XOR operation means that the same is 0 and the difference is 1. Here is an example: 3 ^ 4=7, the binary number corresponding to 3 is 11, the binary number corresponding to 4 is 100, the binary number result after the XOR operation is 111, and the corresponding decimal number is 7. Verify it with the program below:
Analysis
According to the above program, do you really understand how to prevent cheating? num is the value we input. For example, the player’s current number of gold coins is 4. But the display on our UI is not directly Coin.Text = num.ToString(). In this way, the player can easily modify the memory of num, which is cheating. The value displayed on our UI is the value of hiddenValue^cryptoKey. Even if the player finds the value of num and changes it, it will not affect the actual number of gold coins we display.
Analysis Plug-in Anti-Cheat Toolkit
Our Unity developers estimate that many people will use this plug-in. How does it implement data encryption? Let’s read the manual. Know that it encapsulates Unity's basic data types into a corresponding data type, such as int->ObscuredInt, Float->ObscuredFloat, string->ObscuredString, etc. Take ObscuredInt as an example:
You will find that it encapsulates a structure corresponding to Int, and has a confusion factor cryptoKey=444444. Let’s look at ObscuredString, a class encapsulated by the string type, and its confusion The factor is string cryptoKey="4441". If we use this plug-in without modifying anything, then if I am a hacker and I know that a certain game is currently developed by Unity and the data has been anti-cheat processing, then how can I crack the anti-cheat protection? The plug-in is definitely the first thing that comes to my mind, and if I know these confusion factors, it will be relatively easy for me to crack it. Therefore, how to further prevent cheating, it is very important to confuse or modify the mixing factors of the plug-in.
The above is the detailed content of Anti-cheating in game development and a brief introduction to its principles. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



It's common for games to slow down your computer because they consume a lot of resources. It's crucial to understand your CPU usage when gaming so you can avoid overloading it. Therefore, keeping track of appropriate CPU usage is key to keeping your gaming experience smooth. In this article, we'll look at the appropriate CPU usage you should achieve while your game is running. CPU utilization during gaming CPU utilization is an important indicator of processor workload and depends on the performance specifications of the CPU. More powerful CPUs generally have higher usage. A CPU with more cores and threads can improve the overall performance of your system. Multi-threading support helps unleash the full potential of your CPU. In games, CPU usage depends on processor utilization, which can affect the game

If Nvgpucomp64.dll is causing your game to crash frequently, the solutions provided here may help you. This problem is usually caused by outdated or corrupted graphics card drivers, corrupted game files, etc. Fixing these issues can help you deal with game crashes. The Nvgpucomp64.dll file is associated with NVIDIA graphics cards. When this file crashes, your game will crash too. This usually happens in games like LordsoftheFallen, LiesofP, RocketLeague, and ApexLegends. Nvgpucomp64.dll crashes games on Windows PC if N

In today's situation where almost all games are online, it is not advisable to ignore the optimization of home network. Almost all routers are equipped with NATBoost and QoS features designed to enhance users' gaming experience. This article will explore the definition, advantages and disadvantages of NATBoost and QoS. NATBoost vs. Qos for games; which one is better? NATBoost, also known as Network Address Translation Boost, is a feature built into routers that improves their performance. It's especially important for gaming because it helps reduce network latency, which is the time it takes for data to be transferred between the gaming device and the server. By optimizing the data processing method within the router, NATBoost achieves faster data processing speed and lower latency, thus changing the

According to news from this website on February 23, NVIDIA updated and launched the NVIDIA application last night, providing players with a new unified GPU control center, allowing players to capture wonderful moments through the powerful recording tool provided by the in-game floating window. In this update, NVIDIA also introduced the RTXHDR function. The official introduction is attached to this site: RTXHDR is a new AI-empowered Freestyle filter that can seamlessly introduce the gorgeous visual effects of high dynamic range (HDR) into In games that do not originally support HDR. All you need is an HDR-compatible monitor to use this feature with a wide range of DirectX and Vulkan-based games. After the player enables the RTXHDR function, the game will run even if it does not support HD

The superpeople game can be downloaded through the steam client. The size of this game is about 28G. It usually takes one and a half hours to download and install. Here is a specific download and installation tutorial for you! New method to apply for global closed testing 1) Search for "SUPERPEOPLE" in the Steam store (steam client download) 2) Click "Request access to SUPERPEOPLE closed testing" at the bottom of the "SUPERPEOPLE" store page 3) After clicking the request access button, The "SUPERPEOPLECBT" game can be confirmed in the Steam library 4) Click the install button in "SUPERPEOPLECBT" and download

Friends who have played enough AAA masterpieces and mobile games, do you want to relive the computer games of your childhood? Then let’s look for Spider Solitaire in Windows 11 together! Click the Start menu on the interface, click the "All Apps" button; click "All Apps". Find and select "MicrosoftSolitaireCollection", which is Microsoft's Solitaire series game application; Solitaire series game selection. After loading is complete, enter the selection interface and find "Spider Solitaire"; select "Spider Solitaire". Although the interface has changed slightly, it is still the same as before
![Thrustmaster control panel not working or displaying properly [Fixed]](https://img.php.cn/upload/article/000/887/227/170831073283375.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Thrustmaster is a company that specializes in the production of gaming wheels and other gaming accessories. Its wheel products are very popular in the gaming community. Thrustmaster wheel settings can be installed and adjusted using the Thrustmaster control panel. If you encounter problems with the control panel not working or displaying, it may affect your gaming experience. Therefore, when this happens, you need to check whether the connection is normal and ensure that the software driver is installed correctly and updated to the latest version. In addition, you can also try to restart the device or reconnect the device to resolve possible failures. When you encounter problems, you can refer to Thrustmaster's official website or contact customer service for further help. How to access Thrustma

According to news from this site on April 20, ASUS recently released a BIOS update, which improves instability such as crashes when running games on Intel's 13th/14th generation processors. This site previously reported that players reported problems including that when running the PC demo version of Bandai Namco's fighting game "Tekken 8", even if the computer has sufficient memory and video memory, the system will crash and prompt an error message indicating insufficient memory. Similar crashing issues have also appeared in many games such as "Battlefield 2042", "Remnant 2", "Fortnite", "Lord of the Fallen", "Hogwarts Legacy" and "The Finals". RAD published a long article in February this year, explaining that the game crash problem is a combination of BIOS settings, high clock frequency and high power consumption of Intel processors.