# OpenTyrian web port – complete source code / Quellcode

This folder contains everything needed to rebuild the Tyrian version that runs on this site
(`/play/opentyrian/opentyrian.js`, `opentyrian.wasm`, `opentyrian-data.data`).

| File | What it is |
|---|---|
| `opentyrian-v2.1.20260913-source.tar.gz` | Unmodified upstream source, tag `v2.1.20260913` of https://github.com/opentyrian/opentyrian (SHA-256 `dbcd96383d4fa571137242c36bd7eca054cf5a08a9bf2eec15ef230d6e60680d`) |
| `opentyrian-web.patch` | All our changes for the web version: `src/web.c`/`web.h` (page interface, vsync frame pacing, touch steering), changes in `video.c`, `keyboard.c`, `nortsong.c`, `joystick.c`, `mainint.c`, … (all behind `#ifdef __EMSCRIPTEN__`) and the build script `web/build.sh` |
| `COPYING.txt` | GNU General Public License v2 |
| `TYRIAN-FREEWARE-LICENSE.txt` | Freeware terms of the Tyrian 2.1 game data |

## Licenses

- OpenTyrian and our patch: GNU GPL v2 or later. This folder is the corresponding source of the web build.
- Game data (not in this folder, packed into `opentyrian-data.data`, unchanged): Tyrian 2.1 freeware,
  © 1995 Eclipse Software / Epic MegaGames, released as freeware by Jason Emery in 2004;
  original download https://camanis.net/tyrian/tyrian21.zip (SHA-256 `7790d09a2a3addcd33c66ef063d5900eb81cc9c342f4807eb8356364dd1d9277`).
- SDL2 (zlib license), Emscripten runtime (MIT).

## Rebuild

Requirements: Emscripten **4.0.10**, a POSIX shell (Linux/macOS or Git Bash on Windows), Python 3, unzip.

```sh
tar xzf opentyrian-v2.1.20260913-source.tar.gz
cd opentyrian-2.1.20260913
patch -p1 < ../opentyrian-web.patch          # or: git apply ../opentyrian-web.patch
sh web/build.sh out                          # -> out/opentyrian.js, out/opentyrian.wasm

# game data package (only the files the engine uses, lower-case names)
curl -LO https://camanis.net/tyrian/tyrian21.zip && unzip -q tyrian21.zip
mkdir -p pkg/data && cd tyrian21
cp cubetxt?.dat demo.? estsc.shp levels?.dat music.mus newsh*.shp palette.dat shapes*.dat tshp2.pcx \
   tyrend.anm tyrian.cdt tyrian.hdt tyrian.pic tyrian.shp tyrian.snd tyrian?.lvl tyrianc.shp voices.snd voicesc.snd ../pkg/data/
cd ../pkg
python3 "$EMSDK/upstream/emscripten/tools/file_packager.py" ../out/opentyrian-data.data \
  --preload data@/data --js-output=../out/opentyrian-data.js --use-preload-cache --no-node
```

The page `index.html` one level up is the web shell (renderer, touch controls, settings, saves).

---

## Deutsch

Dieser Ordner enthält den vollständigen Quellcode der hier laufenden Tyrian-Version: das unveränderte
OpenTyrian-Archiv (Tag v2.1.20260913), unseren Patch `opentyrian-web.patch` mit allen Änderungen und dem
Build-Skript sowie die Lizenztexte. Neu bauen: Archiv entpacken, Patch anwenden, `web/build.sh` mit
Emscripten 4.0.10 ausführen, danach das Datenpaket aus den Tyrian-2.1-Freeware-Daten wie oben erzeugen.
OpenTyrian und der Patch stehen unter der GNU GPL v2 oder später; die Spieldaten sind Freeware
(© 1995 Eclipse Software / Epic MegaGames, 2004 von Jason Emery freigegeben) und werden unverändert und kostenlos angeboten.
