Reinforcement Learning – Hacking Unity Games, Part 1

The next step in this project is to hack into the roll-a-ball game and extract some important information (e.g. camera display, score). The AI will use that information to learn to play in later stages.

In this blog, I go over the internal structure of Unity games.

Figure 1 – Internal structure of Unity Games (Unity version 2019.3)

 

The folder structure of Unity games

The build of Unity games follows a general pattern, as shown in Figure 1. The root directory (center top) contains the main executable of the game, which is referred by shortcuts that usually initiate the game’s start. The data folder in this root directory is even more important – it contains all the game’s resources.

In the data folder (center right)  contains a few interesting files…

  • level0 and level0.resS represent a scene. In this case, it is the entire Roll-a-ball game.
  • sharedassets0.assets represents globally used assets (some are also stored in .resS files).
  • If there was a Resources folder, a resources.assets file that holds its data would exist in this folder.
  • A Managed folder that contains all Unity DLL files (bottom right).
    • Among these, the Assembly-CSharp.dll and the Assembly-UnityScript.dll are the most important for hacking.
      These DLL files store all C# and UnityScript files in a compiled fashion.

      • The files can be decompiled using tools like ILSpy or dnSpy.

(cf. [https://github.com])

 

What is a DLL file?

Dynamic Link Library files, or DLL files for short, are files that contain instructions that other programs can make use of , even simultaniously. The idea of DLL files is that multiple programs can share pieces of functionality in a single file.

These files are similar to executable programs (.exe). Unlike them, however, a DLL file cannot be run directly. Instead, they are called and executed by already running code. While these files typically have the .DLL file extension, some may use .OCX, .CPL, or .DRV.

(cf. [https://www.lifewire.com])

 

Sources:

[https://github.com]
Unity-game-hacking: https://github.com/xcsh/Unity-game-hacking (21.10.2019)

[https://www.lifewire.com]
What is a DLL file?: https://www.lifewire.com/what-is-a-dll-file-2625852 (21.10.2019)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

11 − 9 =