web analytics

Hacking Age of Empires 2

In this tutorial, we will hack the famous Age of Empires 2 game with Cheat Engine. Cheat Engine is an open-source debugger designed specifically to support the modification of single-player games which is perfect for this style of reverse engineering. Our goals for this first tutorial will be to identify where our resources are stored in the process and modify them to give 9999 of each.

To start, we will open the game and join a standard single-player game against the computer. To simplify this round, I will pick a small map with one opponent set to easy. After the game loads, I will set about my villagers to identify the bushes and begin harvesting food. While they go about their villager lives, I open Cheat Engine and attach the “Age of Empires II: HD Edition” process to the debugger.

As you can see above, my tenacious villagers have already harvested an additional 60 food from those berry bushes for a total of 260. To identify where that food variable is stored, we are going to run a scan against the game process for all variables that equal 260. To do this, you enter the value of 260 into Cheat Engine, change value type to all, and hit first scan.

As you can see in the image above, there are 430 places where the value of 260 is stored. Rather than sorting through each of these locations to see if they might match the food location, we are going to allow the game to keep playing. I’ll allow my villagers to do another harvest which will bring our total food to 287. Using Cheat Engine, I can now run a scan against the 430 records for one that now equals exactly 287.

This new scan has now cut our list of 430 down to a much more reasonable 3 records. This same process can continue across multiple scans as you continue to use Cheat Engine to hone in on the specific variables that you want to identify. Once you have the variables you are looking for, you can bring them down to the bottom pane of Cheat Engine so you can continue to monitor them as you scan elsewhere. Here we can start modifying the variables to see the impact that it has on the game.

By double-clicking on the value, you can easily modify it and monitor the impact that it has on the game. For these three variables, they are all part of the core game loop where the float holds the real value while the cleaned up 287 is used for display purposes. Through experimentation, if you modify the top 287 located at address 102B438C it will quickly return to its correct address while the float located at 10828000 stored the actual value and modified the game to update the food permanently. Using these same techniques you can quickly sort through Cheat Engine’s scans to identify where the variables are stored to modify your resources however you like.

At this point, we have now achieved our goal of modifying our resources but we have barely scratched the surface of truly reverse engineering how the game works which would be necessary for more complex enhancements or development of bots. In the next tutorial, I will go over following these memory instructions in Cheat Engine to determine where the structs are located for each object so we can begin making modifications directly to villagers, buildings, or any other item on the map.

Tags: Age of Empires, Cheat Engine, Game Hacking, Hacking, Reverse Engineering

Related Posts

Previous Post

Comments

    • cuckoohash
    • April 7, 2021
    Reply

    Great writeup! Is the next tutorial available?

Leave a Reply

Your email address will not be published.

0 shares