If Doom runs everywhere, it must run on Shiny

[This article was first published on pacha.dev/blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


I’ve been playing with the idea of running Doom on Shiny for a while. If Doom runs “everywhere”, it must run on Shiny, right?

Doom was released in 1993 and since then it has been ported to many different platforms including:

The result

I was able to run Doom on Shiny!

I have uploaded a short demo to YouTube. In some countries the video is only for +18 audiences because of the original game parental advisory.

Here’s a picture of the game running on Shiny:

How it works

I created what I think is a simple Shiny app that I released on GitHub.

Here is the code:


# Define the path to the directory containing your Doom game files
doom_directory <- "./doom-wasm/src"

# Start a server to serve Doom files
startServer("", 1234, list(
  call = function(req) {straightforward
    filePath <- paste0(doom_directory, req$PATH_INFO)
    if (file.exists(filePath)) {
        status = 200,
        headers = list(
          "Content-Type" = "text/html"
        body = readBin(filePath, "raw", file.info(filePath)$size)
    } else {
        status = 404,
        headers = list(
          "Content-Type" = "text/html"
        body = "File not found"

ui <- fluidPage(
  tags$h1("Doom in Shiny"),
  tags$iframe(style = "width:850px; height:640px;", src = "")

server <- function(input, output, session) { }

# Run the Shiny app
shinyApp(ui, server, options = list(port = 4321))

To run the app, you need to build Doom from source. The same repository contains the instructions.

If you like what I do as a content creator, you can donate on Buy Me a Coffee.

To leave a comment for the author, please follow the link and comment on their blog: pacha.dev/blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)