Playing Wacky Wheels (DosBOX via WebAssembly) with Friends: A Guide to Multiplayer Mode

Everything started as a joke between old friends: Do you remember 28 years ago, when we used to play Wacky Wheels in a split screen in your old PC?

Playing Wacky Wheels with friends can be an incredibly fun and exciting experience. Wacky Wheels is a classic DOS game that has been ported to modern systems through the help of DOSBox.

While the game can be enjoyed alone, it reaches its full potential when shared with friends. A while ago, we used to play the game in the same keyboard and with split screen (no internet for us back then), but the fun was guaranteed. This guide will explain how to set up a multiplayer game of Wacky Wheels with friends in a modern environment.

Playing old DOS games comes with a series of challenges, like ensuring all parties have the same binary distribution, configuration of emulator and networking capabilities. In the case of Wacky Wheels, IPX is not supported for the multiplayer mode and the alternatives are connectivity through modem or serial connection.

To solve most of the problems above, I’ll be using the most common resource in today’s computer, a web browser. This solution implies compiling our binaries to be executed via Web Assembly and let the browser distribute the software and enable communications with other players.

Executing your DOS binaries in the browser

Getting DOSBox running in the browser

Compiling DOSBox for being executed in the browser is a well solved problem. In fact, there are plenty of web pages that already allow you to play your favourite games, including Wacky Wheels.

We are going to compile to Web Assembly our own version of DOSBox with network capabilities and package our favourite game with a custom DOSBox configuration.

Luckly we have a DOSBox port to emscripten a toolchain to compile to Web Assembly: https://github.com/dreamlayers/em-dosbox. So before starting ensure you have emscripten installed, follow these instructions.

Once we have all the tooling installed, it’s time to compile our own Web Assembly version of DOSBox, follow the steps:

  • Clone the repository
git clone https://github.com/dreamlayers/em-dosbox.git
cd em-dosbox
  • Configure and build em-dosbox to use SDL2 and SDL-NET
./autogen.sh
emconfigure ./configure CPPFLAGS="-s USE_SDL=2 -s USE_SDL_NET=2" LDFLAGS="-s USE_SDL_NET=2"
make -j

And that’s it, after executing that command you should find the file src/dosbox.html that you can serve from a http server and will execute DOSBox.

Executing the game

That’s cool, but we want to play Wacky Wheels. Fortunately em-dosbox allows you to package binaries and execute them directly.

Get a legal copy of the software that you want to emulate, Wacky Wheels even have a shareware version. Place it in your src directory, under the folder ww.

And execute the following command from the src folder:

cd src

./packager.py ww ww WW.EXE

We will asking the packager to create a new file, ww.html, include all the files in the directory ww and once DOSBox is loaded, to execute the WW.EXE file, our game!

Wacky Wheels networking

As mentioned before, the networking capabilities for this game are limited. We will be using the serial connection, concretelly a null modem.

If we were playing as we did back in 1994, we would have two computers connected to each other by a serial cable. Now we don’t have that cable, but TCP/IP connections and in top of that, we are in the world of Web Assembly, so our connections are not real sockets (as we would have with native DOSBox), but WebSockets.

Here is a diagram of the networking jumps and transformations:

And here are the components:

  • A tcp relay server that will act as a null modem, forwarding the information from one socket to another. I built a simple nodejs version of this using ChatGPT and you can downloaded here.
  • A service that translates WebSockets traffic to normal socket traffic. In my case I used the Websockify project also built in nodejs.

Both services can be run in the same machine, the only restriction is that the Websockify service needs to have a public interface so browsers can connect to it.

Once you have a public machine, launch first your tcp relay server:

git clone https://github.com/arcturus/pair-relayer.git
cd pair-relayer
npm install
node pair-relayer.js

Once that service running (by default in port 3000 unless specified), it’s time to launch the Websockify service and forward any incoming web sockets to connnections to the previous service:

git clone https://github.com/novnc/websockify.git
cd websockify/websockify
npm install
./websockify.js <PUBLIC_HOSTNAME>:<WS_PORT> <TCP_RELAY_HOST>:<TCP_RELAY_PORT>

Finally we need to tell our DosBOX instance that can use a nullmodem. In your Wacky Wheels directory where binaries are distributed place a file called dosbox.conf with the following content:

[serial]
serial1=nullmodem server:<PUBLIC_HOSTNAME> port:<WS_PORT> rxdelay:1000`

Repackage your game and enjoy the game in the browser.

Leave a Reply

Your email address will not be published. Required fields are marked *