Ren'Py How to pack files into RPA archive?

georg23623

New Member
Nov 12, 2021
5
31
Hi all! I'm really dumb at compressing files into RPA archive, could you help me with that? I need to pack all files in one directory. Preferably you can explain me this algorithm in detail and understandable, I will be sincerely thankful to all of you for your help.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
It's part of the [Build Distributions] process done automatically, from the RenPy launcher.

You just need to include a couple of extra lines in the options.rpy file.

If you scroll to near the bottom of the file, you'll start to see lines like:

Python:
    ## Classify files as None to exclude them from the built distributions.

    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')

At the very simplest level, all you would need to do is un-comment (remove the #) at the start those 2 final lines. In this case, any file ending in .png or .jpg would be put in the archive.rpa file instead.

My overkill version of that looks like this:

Python:
## Classify files as None to exclude them from the built distributions.

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    build.classify("game/**.rpy", 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/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.mp4", "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")

    build.include_i686 = False

Which is more or less the same thing, except I put images in an images.rpa archive, scripts in scripts.rpa, etc. etc. by declaring 3 separate .rpa files instead of the default one called archive.rpa.

The final line is just to tell RenPy not to bother building a 32bit version of the game. Partly because it used to generate erroneous antivirus errors and partly because anyone still using running Windows 95 or Windows XP 32bit need more incentives to update to a modern operation system. :devilish:

Mix and match whichever bits you prefer. Tweak as needed. Then next time you use the [Build Distributions] menu from the launcher, the files will be put wherever you've told them to be.
 

georg23623

New Member
Nov 12, 2021
5
31
It's part of the [Build Distributions] process done automatically, from the RenPy launcher.

You just need to include a couple of extra lines in the options.rpy file.

If you scroll to near the bottom of the file, you'll start to see lines like:

Python:
    ## Classify files as None to exclude them from the built distributions.

    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')

At the very simplest level, all you would need to do is un-comment (remove the #) at the start those 2 final lines. In this case, any file ending in .png or .jpg would be put in the archive.rpa file instead.

My overkill version of that looks like this:

Python:
## Classify files as None to exclude them from the built distributions.

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    build.classify("game/**.rpy", 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/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.mp4", "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")

    build.include_i686 = False

Which is more or less the same thing, except I put images in an images.rpa archive, scripts in scripts.rpa, etc. etc. by declaring 3 separate .rpa files instead of the default one called archive.rpa.

The final line is just to tell RenPy not to bother building a 32bit version of the game. Partly because it used to generate erroneous antivirus errors and partly because anyone still using running Windows 95 or Windows XP 32bit need more incentives to update to a modern operation system. :devilish:

Mix and match whichever bits you prefer. Tweak as needed. Then next time you use the [Build Distributions] menu from the launcher, the files will be put wherever you've told them to be.
thx so much, have a nice day