# Running, linting and building the game The Ren'Py project in `vn/` is generated by [vnpipe](https://github.com/Dasemu/vnpipe); never edit it by hand. All commands below run from the repository root and use **Bash on Linux x86-64**, matching the release runner. Other hosts need the corresponding SDK launcher and bundled Python executable. Generic details: [vnpipe running guide](https://github.com/Dasemu/vnpipe/blob/main/docs/running.md). ## 1. Clean clone and common setup Install Git, [uv](https://docs.astral.sh/uv/), curl, tar (with bzip2 support) and unzip. Python >=3.12 is required; uv can provision it. ```bash git clone https://github.com/Dasemu/faust-vn.git cd faust-vn uv sync --locked uv run vnpipe --work . renpy ``` vnpipe is a Git dependency pinned by `uv.lock`, not a sibling path dependency. Do not change `[tool.uv.sources]` for normal use. To reproduce a specific release, check out its tag before `uv sync --locked`. The committed inputs are sufficient; fetching, parsing, annotating and rebuilding translations are optional content-development tasks, not part of this startup path. Install **Ren'Py 8.5.3** (the SDK is not committed; `tools/` is gitignored): ```bash mkdir -p tools/renpy-sdk curl -fsSL https://www.renpy.org/dl/8.5.3/renpy-8.5.3-sdk.tar.bz2 \ | tar -xj --strip-components=1 -C tools/renpy-sdk ``` This provides `tools/renpy-sdk/renpy.sh` and the desktop distribution templates. Install the matching web or RAPT add-on only for that target (below). The examples use this fixed SDK path; `RENPY_SDK` is also recognized by the Python tests, but does not automatically replace paths in shell commands. ## 2. Regenerate the project ```sh uv run vnpipe renpy # from data/annotated.json uv run vnpipe renpy --from-parsed # trivial annotations built from parsed.json uv run vnpipe renpy --out some/dir # default output: vn ``` Generation is deterministic: running it twice gives identical files (no timestamps). It rewrites `game/{options,gui,screens,styles,menus,support,characters,images,menu_data,script}.rpy`, `game/gui/`, `game/fonts/`, `game/images/` and, when the work has an `audio/` directory, `game/audio/` (a copy of `audio/**/*.ogg`; it is gitignored in `vn/`). Music, credits, scene select and title-card subtitles are configured in `work.toml` and `audio/credits.toml` (see vnpipe's `docs/work-config.md`). Images come from `assets/assets.json` (statuses `processed`, `approved`, `placeholder`); anything missing or unusable is replaced by a generated placeholder so the game always runs. Art styles (manifest v2, `--style` on every `vnpipe assets` command, per-style status matrix and `assets check`) are documented in vnpipe's `docs/running.md` and `docs/art-bible.md`. ### GUI template and licences `renpy_templates/` in vnpipe holds the default Ren'Py GUI (`gui.rpy`, `screens.rpy`, `options.rpy` and `gui/*.png`). It was generated once with the SDK's own command and then edited minimally (dark palette, ivory text, accent `#c9a25b`, Roboto Slab font, NVL tweaks, `@@TOKEN@@` placeholders for title/build name/about text/menu background): ```sh tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher generate_gui OUT --width 1920 --height 1080 \ --accent '#c9a25b' --boring '#14110e' --template "$PWD/tools/renpy-sdk/gui" --start ``` These files are part of Ren'Py (MIT licence, Tom Rothamel and contributors). The font `game/fonts/RobotoSlab-*.ttf` is Roboto Slab (Apache 2.0), taken from the SDK documentation assets. ## 3. Lint ```sh tools/renpy-sdk/renpy.sh vn lint ``` The expected result is a statistics block with no warnings above it. ## 3b. End-to-end playthrough test Lint does not catch runtime errors (missing GUI images, display bugs). `--with-test` also writes `game/e2e_test.rpy`, a Ren'Py `testcase` that clicks "Start", advances through the whole game up to the final card (`label the_end`) and back to the main menu (then opens and closes the Scenes and Credits screens), failing on any exception (`traceback.txt`). Use a throw-away output directory so the test file never ends up in `vn/` or in a build: ```sh uv run vnpipe renpy --with-test --out build/e2e HOME=$TMPDIR/renpy-home SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy RENPY_RENDERER=sw \ tools/renpy-sdk/renpy.sh build/e2e test ``` The headless run needs the software renderer (`RENPY_RENDERER=sw`, no GL under the dummy video driver); matrix tints are therefore not rendered but all game logic is exercised. `tests/test_faust_e2e.py` runs this when the SDK exists (`RENPY_SDK` or `tools/renpy-sdk`; slow: about a minute). On a desktop with a display, drop the three variables. ## 3c. Headless screenshots (visual QA) The same test runner takes screenshots (`screenshot "name.png"` inside a `testcase`, saved under `_test.screenshot_directory`; an existing file is *compared*, so delete it before re-taking). Copy `vn/` to a scratch directory, add a `game/qa_test.rpy` with the `e2e_ticker` screen of `e2e_test.rpy`, `run Start("scene_noche")` + `pause 9.0` + `screenshot ...`, and run `renpy.sh test` with the variables of section 3b. `Start(label)` only works from the main menu (one test run per scene); `ShowMenu("preferences")`, `"load"`, `"history"`, `"vn_credits"`, `"vn_scene_select"` work anywhere. Set `persistent.art_style` with `run SetField(persistent, "art_style", "anime")` (a bare `$` does not redraw). ## 4. Desktop: play and package After the common setup, launch the game: ```bash tools/renpy-sdk/renpy.sh vn ``` Build a desktop package (outputs are gitignored): ```bash mkdir -p build/dist tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher distribute vn --package linux --destination build/dist ``` Use `win` or `mac` instead of `linux` for those targets. Extract the resulting package on its target OS and run its launcher. Ren'Py is bundled in desktop distributions. ## 5. Web and Android builds ### Web (HTML5) After the common setup, install the matching web add-on explicitly, as CI does: ```bash curl -fsSL -o /tmp/faust-renpy-web.zip https://www.renpy.org/dl/8.5.3/renpy-8.5.3-web.zip unzip -q /tmp/faust-renpy-web.zip -d tools/renpy-sdk tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher web_build vn --destination build/web rm -f vn/progressive_download.txt uv run python -m http.server --bind 127.0.0.1 --directory build/web 8000 ``` Open ; serve the build over HTTP rather than opening its HTML with `file://`. The build also creates `build/web.zip`. `vn/progressive_download.txt` is temporary web-build output, not a source input. ### Android APK After the common setup, install **JDK 21**, set `JAVA_HOME` to its installation and put `$JAVA_HOME/bin` on `PATH`; check `java -version` reports 21. Use ASCII-only absolute paths for the checkout and SDK (for example `/home/dario/src/faust-vn`); Gradle's `local.properties` uses Latin-1. If necessary, move or copy the checkout to such a path before setup. Install RAPT 8.5.3 and its Android SDK once: ```bash curl -fsSL -o /tmp/faust-renpy-rapt.zip https://www.renpy.org/dl/8.5.3/renpy-8.5.3-rapt.zip unzip -q /tmp/faust-renpy-rapt.zip -d tools/renpy-sdk ( cd tools/renpy-sdk/rapt ../lib/py3-linux-x86_64/python -c ' import runpy, sys sys.path[:0] = [".."] sys.argv = ["android.py", "installsdk"] runpy.run_path("android.py", run_name="__main__") ' ) ``` Review and accept the Android SDK licences when prompted. The `[android]` table in `work.toml` makes vnpipe generate `vn/android.json`, icons and presplash. For an update to an existing release, restore its private signing key as both `vn/android.keystore` and `vn/bundle.keystore` **before** building (alias `android`, password `android`). For a first independent local build, RAPT creates keys when absent; back them up. Both files are gitignored. Always reuse the same signing key for updates and never commit it. ```bash mkdir -p build/dist tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher android_build vn --destination build/dist ``` Transfer the APK from `build/dist` to the Android device, permit installation from that source and install it. An APK signed with a different key cannot update the official installed app. ### Developing vnpipe itself (optional) A separate checkout can live anywhere. To try unpublished changes without editing the project's source configuration or upgrading its lockfile: ```bash uv run --with-editable /absolute/path/to/vnpipe vnpipe --work . renpy ``` Maintainers intentionally updating the pinned dependency run `uv lock --upgrade-package vnpipe` after pushing the upstream changes, then review and commit the updated lockfile. ## 6. Releases (CI) `.github/workflows/release.yml` builds Windows, Linux, macOS, web and the signed APK. - Push to `development` or a manual run: builds are kept as workflow artifacts (7 days). - Merge `development` into `main`: `version.yml` bumps the version, then `release.yml` publishes the GitHub release `vMAJOR.MINOR.PATCH` with desktop and web files (and the APK when signing is configured). - The APK needs the `ANDROID_KEYSTORE_B64` repository secret (`base64 -w0 android.keystore | gh secret set ANDROID_KEYSTORE_B64`); without it the Android build is skipped.