# Adding a game

Each game lives in its own folder under `games/`. The folder name becomes the URL slug.

```
games/
  my-visual-novel/
    index.html        # required: Ren'Py web export entry point
    game.wasm
    game.data
    game.js
    cover.jpg         # optional: shown on the library tile (jpg/png/webp/gif)
    meta.json         # optional: overrides for title/description/author
```

## Building a Ren'Py web export

1. Open the **Ren'Py launcher**.
2. Pick your project, click **Build Distributions**.
3. Tick the **Web** checkbox and build.
4. Open the generated `<project>-web.zip` and unzip its **contents** (not the
   wrapping folder) into `games/<your-slug>/` so that `index.html` sits at
   `games/<your-slug>/index.html`.

> Need to enable the Web target? In the launcher: *Preferences → Web build*,
> then download the web support files Ren'Py prompts for.

## Optional `meta.json`

```json
{
  "title": "My Visual Novel",
  "description": "A short tagline shown on the library tile.",
  "author": "Your Name",
  "cover": "cover.jpg"
}
```

If `meta.json` is missing, the slug is title-cased for display and the first
`cover.{webp,png,jpg,jpeg,gif}` found in the folder is used as the cover.

## Rebuild the manifest

After adding or removing a game, regenerate `games.json`:

```sh
npm run build
```

Cloudflare Pages will run this automatically on deploy (build command:
`npm run build`, output directory: `.`).

## Notes on browser compatibility

- Ren'Py's web build is an Emscripten/WebAssembly bundle and needs cross-origin
  isolation (`COOP`/`COEP`). The repo's [`_headers`](../_headers) file sets
  these for every path.
- iOS Safari supports the experience but cannot enter true fullscreen on an
  arbitrary element. The player UI uses `100dvh` and the `apple-mobile-web-app`
  meta tags so it still feels immersive when the page is launched from the home
  screen.
- Save data is stored by the game itself via IndexedDB / localStorage; it is
  scoped to the deployed origin, so saves persist across sessions on the same
  device and browser.
