# Bundled games

GhostLink's games table loads its online catalogue from a third-party CDN. The
games in this folder ship with the site instead, so the table still works when
that catalogue is slow, blocked or offline; the online list is appended after
them when it loads.

`catalog.js` is generated by `scripts/build-game-catalog.py` from the list of
games in that script. The covers in `covers/` are generated there too.

## Layout

```
games/
  catalog.js            generated catalogue read by ghostlink.html
  covers/<slug>.svg     generated square cover art
  2048/                 multi-file game: index.html plus its own assets
  arcade/<slug>.html    single-file game: everything inlined in the page
```

A multi-file entry opens `games/<slug>/index.html`, so relative scripts, images
and audio all resolve. A single-file entry opens `games/arcade/<slug>.html`, and
its Download button saves that page; multi-file entries point at their folder
because their assets have to be copied together.

## Adding a game

1. Check the licence. Only bundle games that allow redistribution (this folder
   only contains MIT, GPL-3.0 and Unlicense games) and keep the licence file in
   the game's folder.
2. Copy its files to `games/<slug>/` (or a single HTML file to
   `games/arcade/<slug>.html`).
3. Add the game to `GAMES` in `scripts/build-game-catalog.py` with its name,
   genre, cover monogram, accent colour, licence and source URL.
4. Run `python3 scripts/build-game-catalog.py` and add the game to the credits
   table below.

## Credits

| Game | Author | Licence | Source |
| --- | --- | --- | --- |
| 2048 | Gabriele Cirulli | MIT | <https://github.com/gabrielecirulli/2048> |
| Hextris | Hextris contributors | GPL-3.0 | <https://github.com/Hextris/hextris> |
| Astray | wwwtyro | Unlicense | <https://github.com/wwwtyro/Astray> |
| Tetris | Jake Gordon | MIT | <https://github.com/jakesgordon/javascript-tetris> |
| Pong | Jake Gordon | MIT | <https://github.com/jakesgordon/javascript-pong> |
| Racer | Jake Gordon | MIT | <https://github.com/jakesgordon/javascript-racer> |
| Clumsy Bird | Ellison Leao | GPL-3.0 | <https://github.com/ellisonleao/clumsy-bird> |
| Asteroids, Snake, Pac-Man, Space Invaders, Sokoban, Minesweeper, Breakout, Frogger, Simon, Flappy, Bullet Hell, Vaporwave Escape, Retro Racer, Memory | 90s-games | MIT | <https://github.com/prateek121/90s-games> |

Every game folder keeps the upstream licence file (`LICENSE`, `LICENSE.md` or
`LICENSE.txt`); the single-file arcade games share `arcade/LICENSE.txt`.

## Local changes

Small edits were made so each game works from a subfolder and makes no ad
requests:

- **Astray** loads its textures with relative paths instead of site-root paths.
- **Hextris** no longer includes the upstream Google AdSense tag.
- **Pong** and **Racer** drop links to the upstream tutorial/version pages that
  were not bundled.

Everything else is the upstream code. Games were fetched on 2026-11-11.

## Notes

- Bundled games share the site origin, so their high scores live in this site's
  `localStorage`, not a separate sandbox.
- The game frame is not sandboxed; that is what lets the games' scripts and
  relative asset paths work. Keep that in mind before adding third-party code
  that is not licensed for redistribution.
