documentation indexreference manualfunction index

Obfuscating Your Game

For some reason, many people seem to want to distribute their games in an obfuscated form, making it difficult to read the script, or to view the images associated with a game. Ren'Py supports this, to a point, by compiling scripts and allowing images to be archived. While a moderately skilled programmer could easily crack this obfuscation, it should be enough to protect a game from casual browsing.

Obfuscating the script is practically automatic. Every time the game runs, any .rpy file in the game directory is written out as an .rpyc file. These .rpyc files are enough to run the game, so simply running the game once (to create the .rpyc files) and then deleting (or more appropriately, moving away) the .rpy files will leave you with a runnable game with an obfuscated script. As a bonus, the .rpyc files are already parsed, improving game load time. (If a directory contains .rpy and .rpyc files with the same stem, the newer one of them is chosen, meaning all games get this performance improvement.)

Images can be archived using the Ren'Py launcher. Just choose "Archive Images" from the "Tools" menu, and Ren'Py will create an archive containing your images. It will also add a script file that contains code telling Ren'Py where to look for the archived images.

When building distributions, you can use the option to exclude files to exclude .rpy files.


documentation indexreference manualfunction index