Ren'Py RPY,RPYC,RPA file

no im not

Newbie
Game Developer
Oct 5, 2018
31
64
What's the difference between rpy,rpyc and rpa file.
how can i pack my script.rpy to archies.rpa and how can i read rpa rpyc file ?
sorry for my bad english
 

Hones

Forum Fanatic
Game Compressor
Aug 10, 2018
4,155
8,594
What's the difference between rpy,rpyc and rpa file.
how can i pack my script.rpy to archies.rpa and how can i read rpa rpyc file ?
sorry for my bad english
ren'py packs the files
rpa = ren'py archive
rpyc = rpy files compiled by ren'py this happens automatically when the game is run or compiled
rpy = ren'py script files
to generate rpa files from rpy/rpyc files you could use ren'py or rpatool
to get rpy files from rpyc just use unren
 

Rich

Old Fart
Modder
Respected User
Donor
Game Developer
Jun 25, 2017
2,480
6,971
What's the difference between rpy,rpyc and rpa file.
how can i pack my script.rpy to archies.rpa and how can i read rpa rpyc file ?
sorry for my bad english
As @Hones indicates:
  • .rpy files are the ones that you create when you're writing a Ren'py game. They're the "source code" for the game. (You can, in theory, write parts of your game in .py files, but very few people do.)
  • .rpyc files are the compiled version of the .rpy files. Ren'py reads through the .rpy file and converts the text-based command that you write in the .rpy file into its own internal .rpyc format that it then uses to play the game. If you'd like details, PyTom published an article about .rpyc files not long ago: Note that if you put a new .rpy file into the "game" folder of a Ren'py game (or update an existing one), Ren'py will automatically recompile it into an .rpyc file the next time you launch or reload the game - you don't have to have the Ren'py development environment for this.
  • .rpa files are archives, sort of like ZIP files. When you set up your Ren'py game, you can give it configuration information (usually in "options.rpy") that will tell Ren'py to package various files into .rpa files, rather than leaving them "raw". Details here: The .rpa file isn't encrypted or anything, and doesn't really save much in the way of space - packaging files that way just cuts down on the total number of files in your game distribution. Some people also like doing that because it puts a tiny speed bump in the way of people extracting their code and images from the game. Only a tiny speed bump, because there are easy-to-use tools to get around that, but for the non-technical, it is a minor impediment.
So that's the normal production process - you write .rpy files, Ren'py compiles them into .rpyc files and then (when you're building your distribution) optionally packages them into .rpa files.

To go in the opposite direction:
  1. To extract the contents of a .rpa file, use unren or "rpatool -x archive.rpa"
  2. To "decompile" .rpyc files back into .rpy files, use unren or unrpyc
These tools are (obviously) not supported by PyTom, but work perfectly well, because Ren'py makes no attempt to encrypt or even obfuscate what it builds.

Although I use rpatool and unrpyc (mostly out of habit) unren looks very easy to use:
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,293
15,152
.rpa files are archives, sort of like ZIP files.
Here it can be confusing. They are achives, but not compressed ones. Generally the size of a RPA file is higher (but not this much) than the sum of all its files' size. This because the interest of those archives is more to optimize the loading time of game's elements, than effectively reduce the size of the game.
Ideally, you should split your file between RPA archive according to their meaning and the moment they'll be used.


To go in the opposite direction:
  1. To extract the contents of a .rpa file, use unren or "rpatool -x archive.rpa"
  2. To "decompile" .rpyc files back into .rpy files, use unren or unrpyc
Note that some dev like to mess with the world and try to make RPA/RPYC files none reversible. [ads]But for the RPYC files it can be correct by using .
There's no easy way to do the same with RPA files, but the unren.bat thread (linked by Rich) generally help when it happen.


[...] how can i read rpa rpyc file ?
If you mean "from my game", you don't need to. It's totally transparent for Ren'py, and it will search by itself for a file in RPA archive and the disk. In fact it's so transparent that Ren'py don't even have a function for this.
In case of doubt about a file, you can always use . If it return a True value, then Ren'py can load the file without problem.
 

RVNSN

Drunken Pirate Skirtchaser
Game Developer
Jan 17, 2019
774
464
I was just trying to figure how to archive (basically just make it take a couple extra steps to copy or alter) and found what I wanted on , scroll down to donmai's response.

Or, simply, make changes in your options.rpy file. At this moment, I have the following section:

## 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)
build.classify('game/**.rpy', 'None')
build.classify('game/**.psd', 'None')

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

build.classify('game/**.png', 'archive')
build.classify('game/**.jpg', 'archive')
build.classify('game/**.psd', 'archive')
build.classify('game/**.mp3', 'archive')
build.classify('game/**.ogg', 'archive')
build.classify('game/**.ogv', 'archive')
build.classify('game/**.wav', 'archive')
build.classify('game/**.rpy', 'archive')
build.classify('game/**.rpyc', 'archive')
build.classify('game/**.rpt', 'archive')
build.classify('game/**.ico', 'archive')
build.classify('game/**.icns', 'archive')
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,293
15,152
I was just trying to figure how to archive (basically just make it take a couple extra steps to copy or alter) and found what I wanted on , scroll down to donmai's response.
You could have found exactly the same thing in the official documentation (that come with the SDK) in the " " section of the "Building Distributions" part.
 

frelon71

Active Member
Nov 29, 2018
610
444
Hello, you tell me that it's not possible, but some translators have translated and put it in rpa, so it's possible. I don't know how to do it.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,293
15,152
you can't
It's less definitive than this. Ren'Py being Open Source, many tools exist to manipulate RPA files.

Using the SDK is better when you are building your own game, but there's other cases when you could need to build one. When you are translator, modder or compressor, it permit to present cleaner data. It's not recommended to add something to the official RPA files that come with a game, but creating your own RPA file(s) without the SDK is possible.

By example there's , that is used by unren to extract the content of the RPA files. And there's even a bat User Interface for Windows, for those who want.
 

frelon71

Active Member
Nov 29, 2018
610
444
Hello, ok for rpa.bat but how to compile the specific files of the folder tl\french, for the other software it does not work to compile but just extract thanks
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,293
15,152
Hello, ok for rpa.bat but how to compile the specific files of the folder tl\french, for the other software it does not work to compile but just extract thanks
rpatool works perfectly to compile, it's what rpa.bat use...

As for how... ok, the documentation is limited, but relatively explicit:
Replace 'NAME OF YOUR ARCHIVE' by the name you want to give to the archive WITHOUT the leading '.rpa'. For an archive named "my patch.rpa", you MUST have:
set "dest=my patch"

Add the path to the directory where the files you want to archive are located. Note that '%gamedir%' already point to the 'GAME'S NAME\game' directory. For files located in 'GAME'S NAME\game\images\my patch" you MUST have:
cd "%gamedir%images\my patch"
So, line 31: set "dest=french"
and line 38: cd "%gamedir%tl\french"
 
  • Like
Reactions: osanaiko