September 7, 2021
Creating game cheats has always been a dream of mine. Over the past few months, I have immersed myself in this world, reading numerous articles, watching countless YouTube videos, and poring over various sources. I've finally succeeded in building my own cheat using C++ for the popular game Counter-Strike: Global Offensive.
At the start of my journey, the primary question that puzzled me was, "how do people even create game cheats?" So, settle down, grab some popcorn, and let's delve into the mechanics of it all.
Imagine a game as a standard process, not unlike the browser you're using to read this article. Each process has its own memory, comparable to human memory, and we refer to these data storage points as "addresses".
Take a shooter game as an example. The objective is to survive for three minutes while other players attempt to eliminate you. Each player possesses a health value, stored in the game's memory.
Suppose we wish to have an edge over our competitors and create an infinite health cheat, rendering us invincible. To do so, we must attach our process to the game's process. I prefer to do this using the process's name:
Now our process is linked to the game. What's next? It's time to extract some data. To read and write memory from the game, we need to secure its ID.
Firstly, we declare a variable to store the game's ID, then call a WIN32 function.
DWORD processID;
GetWindowThreadProcessId(hwnd, &processID);After obtaining the ID, we can grant ALL_ACCESS permissions to our process, allowing it to read and write memory to the game.
Having navigated through the preliminary steps, we're now ready to read and write memory to the game from our process. Remember our initial aim of creating an infinite health cheat? It's time to make it a reality (though it should be noted that many modern games make this impossible, storing player health values on a server rather than in client-side memory).
To craft our infinite health cheat, we must first find the address of the health value.
I won't delve into the process of finding a game variable's address here, but I will mention that there are tools available, like Cheat Engine, which is my personal recommendation for this task.
Once we have obtained the health address, we can start developing our infinite health cheat.
WriteProcessMemory(processHandle, (DWORD), 100, (DWORD)sizeof(100), 0);
}And that's it! With a few lines of code, we've created an infinite health cheat. It's worth mentioning that this won't work on every game. Many popular games are equipped with anti-cheat protections. However, with diligent research and some ingenuity, it's possible to bypass these safeguards.
We've explored how to attach our process to another process, what tools I recommend for acquiring variable addresses, and how to read and write memory from a process. With this knowledge at our disposal, we're equipped to create game cheats.
Enjoyed this article?
Post about it!