Library:Ren'Py
| On this wiki | Facts · Code · Notes · Topics |
|---|
The Python-based visual novel engine (MIT). A game is a folder of script files (.rpy source, .rpyc compiled), RPA archives and a Python runtime; recognisable by renpy/ and lib/ folders next to the launcher script and by game/*.rpa and game/*.rpyc files.
Overview
A Ren'Py game directory holds <name>.py/.exe launcher, renpy/ (engine), lib/ (CPython and libraries per platform) and game/ with scripts, images, audio and archives. The engine is written in Python and Cython.
Files
- Format:Ren'Py RPA archive (
.rpa, older.rpi) packs the game's assets and often scripts. - Format:Ren'Py RPYC (
.rpyc,.rpymc) are the compiled scripts: zlib-compressed Python pickles of the script AST. - Format:Ren'Py save file (
<slot>-LT1.save) is a ZIP with the metadata as JSON and the game state as a pickle.
Notes
- The engine's own source (renpy/loader.py, renpy/script.py) is the reference for both formats.
- The pickled objects are the AST classes of renpy/ast.py (Node at line 254, Say at line 876), read by renpy/script.py through
loadsof renpy/compat/pickle.py (script.py lines 850 and 903). That Unpickler.find_class only rewrites datetime and_astnames and otherwise defers to the stock pickle.Unpickler (lines 342-359), so unpickling runs arbitrary callables: do it in a sandbox. Unverified: how much the pickled layout differs between engine versions (unpickle with the matching version to be safe). Commit 6202e7fb43fd23594ab866af83bf928525a06410.
Translation (tl folders)
Translations live in game/tl/<language>/ as .rpy files generated by the launcher's Generate Translations. Ren'Py gives every dialogue line a translation unit with an identifier built from the preceding label and a hash of its statements (for example start_636ae3f5), and writes translate <language> <id>: blocks that hold the original line as a comment and the replacement below it. Menu choices and strings wrapped in _() are written into a translate <language> strings: block as old "..." / new "..." pairs, a 1-to-1 substitution wherever the string appears. A game/tl/None/common.rpym file carries translations of Ren'Py's built-in interface strings. For a compiled game, the strings also sit in the .rpyc script (Format:Ren'Py RPYC) and archives (Format:Ren'Py RPA archive). Source: renpy/renpy sphinx/source/translation.rst at commit 528db0503abf168075e748e9d1bfed0a90abe234 (documentation, lines 44-72, 95-139, 245-275 read). Unverified: how the identifier hash is computed (the documentation does not say); read the translation code in renpy/translation/ before regenerating ids by hand.
Code & repositories
- https://github.com/renpy/renpy @
6202e7fb43fd23594ab866af83bf928525a06410· license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
Ren'Py engine source: renpy/loader.py (RPA handlers) and renpy/script.py (rpyc reading and writing) are the format references.
Tested on: source read, not run: source read only · checked 2026-10-18