https://github.com/user-attachments/assets/f7fd0b61-ae9d-443c-b0ed-82120da5fe03
{rdoom} is a playable version of
Doom for R. This
package includes the demo game, but it should also work with the game
.wad file for DoomI, DoomII and related games.
This is a technical demonstration for the rendering speed and interactivity of tigerfb.
{tigerfb} is a cross-platform framebuffer for R which enables
realtime, interactive graphical displays in R with mouse & keyboard
input.
It uses:
doomgeneric as the game
engine. A fork of the original Doom source code.{tigerfb} as the
framebuffer for R{nara} for fast native
raster image support{audio} for playing
sound effectsThis code should run on macos, linux and windows platforms (but has only been extensively tested on macos).
Suggested way to run this on all platforms:
install.packages(c('nara')) # Backend render surface
install.packages(c('audio')) # Sound support
pak::pkg_install('coolbutuseless/tigerfb') # Framebuffer
pak::pkg_install('coolbutuseless/rdoom') # This doom engine
# Run with the demo WAD file
rdoom::doom()
The mouse control is a bit awkward. This doom engine is expecting that
the mouse movement delta between frames is always available. However the
framebuffer library being used by {tigerfb} only supports reading the
mouse cursor position on the screen. This means that when the mouse hits
the edge of the screen, the movement input will fail.
Fix: the best interim fix I implemented is that mouse movement in the bottom fraction of the screen does not act as input to the game. This means you can re-centre the mouse by moving it low-down on the screen.
Most cheat codes won’t work directly because of the way keyboard
handling is coordinated between the doom engine and the frame buffer
provided by {tigerfb}
To enter a cheat code, such as iddqd, you need to do the following:
F9 to temporarily disable control via the keyboardi, d, d, q, d
F10 to re-enable the keyboard controlsFor sound effects, {rdoom} exploits the fact that the {audio}
package can play sound asynchronously.
The downside of the {audio} package is that it only does basic
additive sound mixing, so when multiple sounds play at the same time,
the combined magnitude exceeds the limit of the audio device and
clipping makes it all sound awful.
To workaround this, all audio samples have been scaled to a lower volume, and there is a minimum 0.1 second window between sound triggers.
This means that sound may be softer than expected, and when many sounds are triggered to play simultaneously some of them will just go missing.