Ren'py Encode content

mattocean

Active Member
Oct 8, 2018
597
6,947
Hello,

I am new with renpy and I would like to ask how can I encode, packing the pictures of the exported game? I tired to export a game but every picture what I am using are in public folder after export.

Thank you.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,224
Simple as simple can be.

In the options.rpy file, there's a section that looks like this:

Python:
init python:

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)

    ## To archive files, classify them as 'archive'.

    # build.classify('game/**.png', 'archive')
    # build.classify('game/**.jpg', 'archive')

    build.documentation('*.html')
    build.documentation('*.txt')
(I've remove the majority of the comments for easier reading here).

The simple version would be to just uncomment those two "archive" lines.

Python:
    build.classify('game/**.png', 'archive')
    build.classify('game/**.jpg', 'archive')

This would create a single archive, called archive.rpa.

Although, you can get creative and create separate .rpa archives, depending on the type of file being archived.

Python:
    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)

    ## Files matching documentation patterns are duplicated in a mac app
    ## build, so they appear in both the app and the zip file.

    build.documentation('*.html')
    build.documentation('*.txt')

    # Declare three archives.
    build.archive("scripts", "all")
    build.archive("images", "all")
    build.archive("sounds", "all")

    # Put script files into the scripts archive.
    build.classify("game/**.ttf", "scripts")
    build.classify("game/**.rpy", "scripts")
    build.classify("game/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.avi", "images")
    build.classify("game/**.webp", "images")
    build.classify("game/**.webm", "images")

    # Put sounds into the sounds archive.
    build.classify("game/**.ogg", "sounds")
    build.classify("game/**.wav", "sounds")
    build.classify("game/**.mp3", "sounds")

Just set up the filters correctly, and you can put almost any file or group of files into any named archive.

Your final choice, is whether to actually include the source code into the game's distribution file. Only the .rpyc files are needed for the game to run. So you could change my final example to:

Python:
    # Put script files into the scripts archive.
    build.classify("game/**.ttf", "scripts")
    build.classify("game/**.rpy", None)
    build.classify("game/**.rpyc", "scripts")

Which would stop the .rpy files being included with the final game.
Whilst the people like Patreon aren't really looking at your source code for stuff like incest patches... no point making their lives too easy. :D:devilish: