# Freedoom on /play/freedoom

## Engine

**doomgeneric** — a portable fork of Chocolate Doom (itself derived from id Software's GPL release of the
DOOM source) where the platform layer is reduced to a handful of functions.

- Upstream: https://github.com/ozkl/doomgeneric
- Commit: `e257a09527062bfb986b6e5e0780839b6cbd5b71` (2026-10-11)
- Licence: GNU GPL v2 — see `COPYING-GPL2.txt` (copied from the upstream `LICENSE`)
- Compiler: Emscripten 6.0.13 (`emsdk install latest`, 2026-10-21)

Files: `doom.js` (Emscripten glue plus our platform JS), `doom.wasm` (the engine).

## Game data

**Freedoom: Phase 1** — free, original replacement content for DOOM, made by the Freedoom project.

- Upstream: https://freedoom.github.io — release `v0.13.0`,
  https://github.com/freedoom/freedoom/releases/download/v0.13.0/freedoom-0.13.0.zip
  (zip SHA-256 `3f9b264f3e3ce503b4fb7f6bdcb1f419d93c7b546f4df3e874dd878db9688f59`, matches the signed CHECKSUM file)
- Licence: BSD 3-clause — see `FREEDOOM-COPYING.txt` (the release's `COPYING.txt`)
- `freedoom1.wad.gz` is the release's `freedoom1.wad` (SHA-256
  `7323bcc168c5a45ff10749b339960e98314740a734c30d4b9f3337001f9e703d`), gzip -9, unpacked in the browser with
  `DecompressionStream`. Not otherwise modified.

## What was written for this site

Everything is in `src/`:

- `doomgeneric_web.c` — the platform layer: frames go to JS, keys come in through a queue, the clock is a JS
  clock that stops while paused, and a sound module hands raw DMX sound lumps to JS. No music.
- `web.js` — the JS half (`--pre-js`): converts the XRGB framebuffer into a 320×200 canvas, maps keyboard
  events to DOOM keys, decodes and plays sound effects through Web Audio with per-channel volume and stereo
  panning, and drives `doomgeneric_Tick` from `requestAnimationFrame` only when a new 35 Hz tic is due.
  Exposes start / pause / resume / destroy to the page.
- `shim/SDL_mixer.h` — empty header; `i_sound.c` includes SDL_mixer under `FEATURE_SOUND`, nothing here uses SDL.
- `build.sh` — the exact build.

One engine change: `d_main.c` skips the screen-melt wipe (it runs in a blocking loop that the browser can't
paint during). `build.sh` applies it with `sed`.

## Rebuild

```sh
git clone https://github.com/ozkl/doomgeneric && git -C doomgeneric checkout e257a09527062bfb986b6e5e0780839b6cbd5b71
# with emcc on PATH (emsdk)
sh public/games/freedoom/src/build.sh doomgeneric out
cp out/doom.js out/doom.wasm public/games/freedoom/
```
