Skip to content

Adaption of the original DOOM ported to run in a WASM environment

License

Notifications You must be signed in to change notification settings

VanIseghemThomas/wasmDOOM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasmDOOM

Adaption of the original DOOM ported to run in a WASM environment. This project is for educational purposes and learned me the basics of taking an existing project, that in particular includes graphics rendering, and porting it to WASM. image

Building

Dependencies (not relevant when using Docker)

  • make
  • emscriptem
  • SDL2

The easy way is to go to intallers and run:

install_deps_<target-platform>.sh

Or you can do the manual way below:

Emscriptem

From the official docs:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh

SDL 2 (MacOS)

brew install SDL2
brew install SDL2_image
brew install SDL2_ttf

Compile

Using Docker

The build script will take care of everything.

./build.sh

Locally

To build the project simply run:

cd src && make

Then you can host a simple web server to serve the page. I always use a simple python module for this:

Serving

cd public
python3 http.server (optional: -p <some-custom-port>)

Now DOOM should be available on localhost

To play doom you will need to upload a so called "where all data" .wad file. I got mine from here and is tested working. You can just put it in the root of the repository, or somewhere you like.

Limitations:

Note: this does not mean I wont look into resolving this in the future. I will do my absolute best to get as close as possible to a native gaming experience.

  • No support for audio
  • No controller support (only tested on mobile)
  • Persistent save between reloads
  • Project build only tested and developed on MacOS

Credits / sources

I can't take credit for al the work here. This repository is based on the work done by sdl2-doom which is modified to work with the SDL2 library also known as the Simple DirectMedia Layer. This library makes it easy to interact with video, audio, input hardware and has excellent support for WASM.

As for understanding how to compile to WASM, the following resources were a big help:

The first one is a really good reference on how to get started and how arguments/file access are handled. The second one being an excelent reference on how to interact with SDL2 and drawing to the canvas.

About

Adaption of the original DOOM ported to run in a WASM environment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published