A Short Hike is a 2019 indie 3D platformer. As I was trying to speedrun the game, I developed a custom debugger that provides some useful information and functionality in order to practice more efficiently. The program attaches to the game as it is running, retrieves in-game data from memory, and uses it to feed a simple GUI.
The main challenge to make this is to locate the relevant values (player state, in-game time, …) in the game’s memory. Since A Short Hike is a Unity game, most of the game logic is written in C#. This makes a lot of the work easier because C# code can be easily decompiled/debugged using tools such as dotPeek. Now some of the essential values, such as the player position and velocity were more challenging. These are handled directly by Unity’s core engine and required to dig directly into the assembly produced by the engine’s C++ code.
Comment on the implementation
The whole thing is written in C#, for two reasons:
- The standard library makes it easy to produce Windows API calls to attach to the game and read its memory.
- Without much GUI programming experience, the WPF framework allowed to quickly produce a good enough interface.