Skip to content

Chocolate Doom WebAssembly port with WebSockets support

License

Notifications You must be signed in to change notification settings

cardano-scaling/doom-wasm

 
 

Repository files navigation

Wasm Doom

This is a Chocolate Doom WebAssembly port with WebSockets support.

Build

Using nix a result symlink including all targets except the WAD file can be built:

nix build .#doom-wasm

Developing

Start a nix shell or use nix-direnv to get the required dependencies.

nix develop

For the first build use:

./scripts/build.sh

Which will build in the source tree src/. From there you can also use make to incrementally build targets.

Running

Copy the shareware version of doom1.wad to ./src (make sure it has the name doom1.wad)

Then:

curl https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad -o src/doom1.wad
simple-http-server -i src

Then open your browser and point it to http://0.0.0.0:8000/

Doom should start (local mode, no network). Check doom-workers if you want to run multiplayer locally.

Inspect src/index.html for startup details.

Check our live multiplayer demo and blog post.

stdout procotol

To show important messages coming from the game while it's running we send the following formatted stdout messages, which can be parsed in the web page running the wasm:

doom: 1, failed to connect to websockets server
doom: 2, connected to %s
doom: 3, we're out of client addresses
doom: 4, ws error(eventType=%d, userData=%d)
doom: 5, ws close(eventType=%d, wasClean=%d, code=%d, reason=%s, userData=%d)
doom: 6, failed to send ws packet, reconnecting
doom: 7, failed to connect to %s
doom: 8, uid is %d
doom: 9, disconnected from server
doom: 10, game started
doom: 11, entering fullscreen
doom: 12, client '%s' timed out and disconnected

License

Chocolate Doom and this port are distributed under the GNU GPL. See the COPYING file for more information.

About

Chocolate Doom WebAssembly port with WebSockets support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 91.0%
  • Shell 7.5%
  • CMake 0.5%
  • Makefile 0.4%
  • M4 0.2%
  • Python 0.2%
  • Other 0.2%