DDLCWiki:Decompiling the game
Decompilation of Doki Doki Literature Club! is actually quite simple. To do so, you will need only Python.
DDLC is a game made in an engine called Ren'Py. People have created tools to decompile Ren'Py games, and DDLC is not special in that manner. The first tool needed is rpatool. This is a Python script which will extract files from
.rpa archives which are used by Ren'Py. The syntax for using it is as follows:
rpatool.py -o [destination path] -x [source path]
DDLC has four
.rpa archives to extract from (audio, fonts, images, scripts). For example, if I wanted to decompile the audio archive, I could use the following command:
python rpatool.py -o "C:\destination\audio" -x "C:\Doki Doki Literature Club\game\audio.rpa"
A folder would be created in
C:\destination called "audio."
Extracting Scripts (post-1.1.0)
Prior to version 1.1.0, the
scripts.rpa archive contained not only compiled code files (
.rpyc), but also uncompiled code files (
.rpy). This means that - to view scripts prior to version 1.1.0, no further action needed to be taken to view the game's code. However, this was unintentional, and has been fixed in versions since 1.1.0, meaning that another step of decompilation needs to occur to see the game's code.
The tool needed for this is called unrpyc, and is very simple to use. First, use rpatool to acquire all of the
.rpyc files from
scripts.rpa, then put them all in the
game folder in the game directory. Then, run the game. After a few seconds, all of the
.rpyc files will be accompanied by
.rpy files. Doing this will have no effect on the game, so you can remove all of the new files in the folder, including the ones which were just created by unrpyc. These
.rpy files are raw text files and can be viewed in a text editor such as Visual Studio Code, Notepad++, or Notepad.