#+title: doom-game.el - DOOM on Emacs

#+html: <a href="https://www.gnu.org/software/emacs/"><img alt="GNU Emacs" src="https://github.com/minad/doom-on-emacs/blob/screenshots/emacs.svg?raw=true"/></a>
#+html: <a href="https://elpa.nongnu.org/nongnu/doom-game.html"><img alt="NonGNU ELPA" src="https://elpa.nongnu.org/nongnu/doom-game.svg"/></a>
#+html: <a href="https://elpa.nongnu.org/nongnu-devel/doom-game.html"><img alt="NonGNU-devel ELPA" src="https://elpa.nongnu.org/nongnu-devel/doom-game.svg"/></a>

This is [[https://github.com/id-Software/DOOM][DOOM]] running inside Emacs via a native module. The port is based on
[[https://github.com/ozkl/doomgeneric][doomgeneric]] such that only a handful of functions like =DG_DrawFrame= need to be
[[file:doomgeneric_emacs.c][implemented in C]] with some [[file:doom-game.el][Elisp code as glue]]. It uses the native Canvas API
which is part of the Emacs 32 source tree, and also available for download as
[[https://github.com/minad/emacs-canvas-patch][patch]] for Emacs 31. See further links and resources related to Canvas below.

#+html: <img src="https://github.com/minad/doom-on-emacs/blob/screenshots/screenshot.jpg?raw=true"/>

* Running DOOM

** Prerequisites

In order to run DOOM, you need an Emacs 32 with Canvas support. On Emacs 31
first apply the [[https://github.com/minad/emacs-canvas-patch][Canvas patch]] to the Emacs source and recompile Emacs.

Furthermore DOOM data files are needed. These files have the extension =*.wad=. On
Debian you can for example install the packages [[https://packages.debian.org/stable/doom-wad-shareware][doom-wad-shareware]] (original
=doom1.wad=) or [[https://packages.debian.org/stable/freedoom][freedoom]] (=freedoom1.wad=). On other distributions install the
equivalent packages or download the files from the Debian website and extract
the respective WAD files.

The WAD files need to be placed in the current directory where Emacs is started
or in the directory =/usr/share/games/doom/=. Furthermore a custom path to the wad
file can be specified via the customization option =doom-args=.

** Installing as package

Install via =M-x package-install RET doom-game RET= from [[https://elpa.nongnu.org/nongnu/doom-game.html][ELPA]]. After the
installation, invoke =M-x doom=. Compilation output and error messages will appear
in the =*doom-log*= buffer.

** Running from source

Clone this repository and execute the command =make=. This will download the DOOM
source, compile the native Emacs module, and then start DOOM in =emacs -Q=. Error
messages will appear in the =*doom-log*= buffer.

* Canvas links

- [[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=80281][bug#80281]]
- [[https://github.com/minad/doom-on-emacs][doom-on-emacs]]
- [[https://github.com/minad/emacs-canvas-patch][emacs-canvas-patch]]
- [[https://github.com/minad/emacs-shader-demo][emacs-shader-demo]]
- [[https://tusharhero.codeberg.page/emacs-pale-canvas-and-stuff-demos.html][Pale and other demos]]
