# 🗂️ Asset Import

The `.sspj` file is converted to `.ssab` **during development, never while the game runs**. At **runtime (during gameplay)**, the game simply loads the converted `.ssab` and textures to render the animation, so the original `.sspj` workspace files stay out of your distributed game.

The Auto Importer (Method 1) converts when you launch the game from the Ren'Py launcher — the route the README takes. Methods 2–4 convert without Ren'Py running: a desktop GUI, a CLI for scripts and CI, and a browser tool.

```
graph LR
    SS[" .sspj / Images<br>(Source Assets) "]

    subgraph Convert ["① During development"]
        AUTO[[" Auto Importer<br>(On Ren'Py Startup) "]]
        GUI[[" SSConverter GUI<br>(GUI App) "]]
        CLI[[" ssconverter-cli<br>(CLI Tool) "]]
        WEB[[" ssconverter-web<br>(Web Browser) "]]
    end

    DEPLOY(("Deploy"))

    subgraph RenPy ["② Your Ren'Py project"]
        BIN[" game/ss_assets/Ringo/<br>.ssab + Textures "]
    end

    SS -- "Place in SpriteStudio_Source/" --> AUTO
    SS -- "Drag & Drop" --> GUI
    SS -- "CLI / CI" --> CLI
    SS -- "Drop in Browser" --> WEB

    AUTO -. "Auto Generate" .-> BIN
    GUI -. "Manual Deploy" .-> DEPLOY
    CLI -. "Manual Deploy" .-> DEPLOY
    WEB -. "Unzip & Deploy" .-> DEPLOY

    DEPLOY --> BIN

    classDef generated stroke-dasharray: 5 5;
    class BIN generated;
```

> [!TIP]
>
> If you do not have a `.sspj` yet and just want to try this out, the [official SpriteStudio sample data](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/>) works as-is (that page is only available in Japanese; the downloads themselves are language-neutral). [Ringo](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#ringo>) is a good character sample, and [Particle](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#Perticle_sample>) is a good one if you want effects. The downloaded project feeds any of the conversion methods below as-is.

> [!NOTE]
>
> **Which SpriteStudio file becomes which converted file** (the roles of `.sspj` / `.ssae` / `.ssce` / `.ssqe` and how they map) is the same for every Player, so it is documented in the portal — [Asset Conversion — How a project's files map to the output](<https://cri-middleware.github.io/SpriteStudio-Docs/overview/conversion/#how-a-projects-files-map-to-the-output>).
>
> Two points matter. **One `.ssae` becomes one `.ssab`**, and **cell positions are baked from the `.ssce` into the `.ssab`**. Because of the latter, whenever you add, move or resize cells, or change the image size, **rebuild the `.ssab` and ship it alongside the image** — replacing the image alone leaves the old source rectangles in place and the artwork shifts.

---

## Method 1: Auto Importer

This feature automatically detects updates to `.sspj` files when Ren'Py starts, runs the conversion behind the scenes, and imports them into your game. It is recommended for quick iterations (adjustments and verification) as it eliminates the hassle of manual conversion.

> [!WARNING]
>
> This feature only works **in developer mode**, which is how the Ren'Py launcher starts your game. A release build for players never converts.

### Basic Usage

1. Create a folder named **`SpriteStudio_Source`** in the root directory of your game project (at the same level as the `game/` folder).
2. Inside the created `SpriteStudio_Source` folder, place the entire project dataset (`.sspj`, `.ssae`, images, etc.) created in SpriteStudio.
3. Press **Launch Project** in the Ren'Py launcher. A game that is already running picks the project up when you turn hot reload on with `Shift + R` (see below).

**Result:** If a file update is detected during the startup initialization phase, the conversion will run automatically, and a folder with the same name as the project will be generated under **`game/ss_assets/`**. (Example: If you placed `SpriteStudio_Source/Ringo/Ringo.sspj`, the converted data will be output to `game/ss_assets/Ringo/`.)

> [!NOTE]
>
> **One output folder per project name.** The folder is named after the `.sspj`, so two projects with the same file name — `Enemies/Boss/Enemy.sspj` and `Enemies/Minion/Enemy.sspj`, say — would both write into `game/ss_assets/Enemy/`. Only the first in path order is converted; the others are skipped: the in-game notice says how many, and the console names them (started from the launcher, the console's lines are in `log.txt` in your project folder). Rename one of the `.sspj` files to import both. Names that differ only in case count as the same name, because they are one folder on Windows and macOS.
>
> **Updating SpriteStudio Player for Ren'Py converts every project once more.** A project is converted again whenever the converter in `game/spritestudio/` differs from the one that last converted it, so after you replace that folder with a newer release, the next launch brings every project up to date. That launch takes longer than usual.
>
> **The importer deletes nothing.** Remove or rename an `.ssae`, an image or a sound, and the file converted from it stays in `game/ss_assets/<project>/`, where it still loads, lists in the SpriteStudio Browser, is registered as an image and ships with the game. After each conversion the importer names such files on the console and counts them in the in-game notice; delete the ones nothing uses.

### Hot reload

Press **`Shift + R`** once in the running game and you are done pressing it: the Auto Importer hands your `SpriteStudio_Source/` files to Ren'Py's autoreload, so from then on **saving in SpriteStudio re-imports and reloads the game on its own**. The change is picked up by modification time, only the updated project is re-converted, and the asset index is refreshed. Dropping a whole new project into the folder works the same way, as long as the folder held a project when the game last loaded; if it was empty, launch the game again. Each import reports itself in the running game — `SpriteStudio: imported Ringo`, or the same line naming what failed and pointing at the console.

> [!WARNING]
>
> **`Shift + R` is Ren'Py's autoreload toggle.** The first press turns autoreload **on** and reloads; a second press turns it **off** without reloading. Press it once per launch. The Auto Importer prints which side you are on at startup (`Hot reload ON` / `Hot reload OFF`). `Alt` (`Option`) `+ R` is the same command.

> [!TIP]
>
> **See it in action — live iteration with an external tool.** Edit the animation in SpriteStudio and save it: with hot reload on, the running Ren'Py re-converts only the updated project and shows the result on the spot (developer mode only).
>
> ![](<https://cri-middleware.github.io/SSPlayerForRenPy/assets/1-auto_import_live.webp>)

> [!TIP]
>
> **Customizing Output Paths** If you want to change the source location or output destination path, you can override them by defining variables on the Ren'Py script side.
>
> ```text
> # Example: Define this in options.rpy or similar, before the auto-importer (init -10)
> define -15 ss_source_dir = "my_custom_source_folder"
> define -15 ss_output_dir = "game/my_converted_assets"
> ```

> [!IMPORTANT]
>
> **Methods 2–4 convert without Ren'Py running, so you place the output yourself.** Put the converted folder in `game/ss_assets/` as it comes: the `.ssab`, its textures (`.png`) and any external instance packs it references stay in the same folder, because the player finds them beside the `.ssab`. Leave **Embedded Assets** (SSConverter GUI, `ssconverter-web`) and `--embedded` (`ssconverter-cli`) off: the player does not read textures and sounds from inside the `.ssab`.

---

## Method 2: Manual Conversion via Standalone GUI Tool (SSConverter GUI)

If you are not familiar with command-line operations or prefer to convert files easily using drag-and-drop, we recommend using the dedicated desktop application **SSConverter GUI**.

### Download and Usage

1. Download and launch the latest version suitable for your OS from the [SSConverter GUI Releases page](<https://github.com/cri-middleware/SSConverterGUI/releases>).
2. Directly **drag and drop** the `.sspj` file or a folder containing `.sspj` files into the designated area of the application window.
3. (Optional) Specify the output directory and press the "Convert" button to generate the `.ssab` files all at once.
4. After conversion, manually move the output folder into your Ren'Py project's `game/` directory (e.g., `game/ss_assets/Ringo/`).

> [!NOTE]
>
> It is extremely easy to use, as dropping a folder automatically finds and batch-converts all `.sspj` files inside it.

---

## Method 3: CLI / CI using CLI Converter (`ssconverter-cli`)

For automated builds in CI/CD (Continuous Integration) or batch processing across large-scale projects, we recommend using the independent execution tool **`ssconverter-cli`**. This tool, which is also commonly used for Godot and Unity, allows you to perform conversions directly from the command line without needing Python or Ren'Py execution environments.

### How to Download

From the [SpriteStudio-SDK Releases page](<https://github.com/cri-middleware/SpriteStudio-SDK/releases>), download the `ssconverter-cli` executable suitable for your OS (e.g., a ZIP containing `ssconverter-cli.exe` for Windows) and extract it to a folder of your choice.

> [!NOTE]
>
> The `ssconverter-cli` binary is not bundled with SpriteStudio Player for Ren'Py. If you wish to use the CLI, please obtain it separately from the SDK repository.

### Basic Usage

Open your terminal (Command Prompt or bash script) and execute the following command. The simplest way is to specify just the input file without the `-o` option.

```bash
# Basic Syntax
ssconverter-cli <path_to_input.sspj>

# Execution Example
ssconverter-cli SpriteStudio_Source/Ringo/Ringo.sspj
```

- Executing the above generates a folder with the same name as the project (e.g., `Ringo/`) in the same directory as the `.sspj` file, and outputs the `.ssab` and image files inside it.
- After conversion, manually move and place the generated folder into your Ren'Py project's `game/` directory (e.g., `game/ss_assets/Ringo/`).
- *If you want to output directly to an arbitrary location, you can use the `-o <output_directory_path>` option.*

### Batch Processing via Directory Specification

By specifying a directory path instead of a file, it will automatically find all `.sspj` projects within that directory and convert them all at once.

```bash
# Batch convert all projects under the specified folder
ssconverter-cli SpriteStudio_Source/
```

This is very convenient when you want to convert and update animation data for multiple characters or scenes in one go.

---

## Method 4: Web-based Converter (`ssconverter-web`)

If you want to try conversion quickly in your browser without installing any tools, you can use **`ssconverter-web`**, which is included in the sister project SpriteStudio Player for Web.

- It uses WebAssembly to process files locally within the browser, meaning your files are never uploaded to an external server.
- Drop the folder that holds your `.sspj` onto it (or pick it with **Browse...**), then press **⚡ Convert &amp; Download**. The result is **downloaded as a `.zip` file** holding one folder named after the `.sspj`.
- Extract that folder into `game/ss_assets/`, so the `.ssab` sits at `game/ss_assets/Ringo/Ringo.ssab` with its images beside it.

It is hosted on the SpriteStudio Player for Web site at [`https://cri-middleware.github.io/SSPlayerForWeb/ssconverter/`](<https://cri-middleware.github.io/SSPlayerForWeb/ssconverter/>). Dropping a folder needs a **Chromium-based browser (Chrome / Edge)**; in other browsers, pick it with **Browse...**.

For details, see [Preparing assets](<https://cri-middleware.github.io/SSPlayerForWeb/usage/assets>) in the SpriteStudio Player for Web documentation.

---

## Release Builds and Archives (`.rpa`)

Because `.ssab` files and textures (PNG / WebP) are loaded via Ren'Py's loader, **they can be successfully loaded even if included in an `.rpa` archive**. Textures go through Ren'Py's standard image pipeline (`Image`), so any format Ren'Py supports — PNG or WebP — works just like every other image in your project. When archiving `game/` for distribution builds (e.g., via `build.classify`), you may simply leave them to be archived. They will also work properly if left as loose files.
