Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:Ren'Py

From ReverseEngineering.wiki
Library
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

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 loads of renpy/compat/pickle.py (script.py lines 850 and 903). That Unpickler.find_class only rewrites datetime and _ast names 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