Disclaimer: This article is designed to demonstrate the versatility of the Microsoft Azure mobile application in relation to hosting and managing a multi-user dungeon (MUD) on the go. It is an incredibly impractical way to launch a game. Don’t do this if you want to maintain your sanity.
Despite the limited number of resources serving a MUD typically requires, a common theme I’ve seen associated with them for years is the cost and complexity of hosting. Now, don’t get me wrong, historically is has been easier to find web hosting than to find an affordable, trustworthy virtual private server to run a MUD on, but things are different now. We have everything from full-service platforms like Amazon Web Services, Google Cloud Platform, and Microsoft Azure Cloud, to more generalized providers like Digital Ocean, all of which have laughably affordable price points.
So, to provide a demonstration of just how quick and easy it is to spin up a production MUD server, I decided to take advantage of the surprisingly awesome Microsoft Azure mobile app (Android, iOS) and do so using only my phone.
Before we can provision anything on Microsoft Azure, we first need to create a Resource Group. If this is your first foray into the Azure platform, a Resource Group is a mechanism that allows you to group resources (see what I did there?) that are required to run an application. This allows you to easily manage infrastructure for multiple projects without any confusing overlap. To accomplish this, run the following command:
az group create -l westus -n <resource group name>.
Once we’ve created the Resource Group for our game, we can then spin up a virtual server to actually run the game on:
az vm create -n <virtual machine name> -g <resource group name> --image UbuntuLTS --generate-ssh-keys.
While this is a one-line command, it is important to note that there are a few different services that are launched in the background here:
Now that we have a virtual server to work with, it’s time to get it ready to run a game. The codebase we will be running is a classic, albeit nearly 30-year-old one: DikuMUD.
Created in 1990 by Sebastian Hammer, Tom Madsen, Katja Nyboe, Michael Seifert, and Hans Henrik Stærfeldt at the department of computer science at the University of Copenhagen in Copenhagen, Denmark, DikuMUD is one of the most influential MUD codebases ever written. Having spawned hundreds of forks and even inspiring MMORPGs like EverQuest, DikuMUD felt like the perfect game for this little demonstration.
With our virtual machine created, the first thing we want to do is prepare it to run DikuMUD. To do this, first copy the public IP address from the Resources tab, and then log into it from the Cloud Shell tab:
ssh <public ip address>.
Next, we need to install a few dependencies. Thankfully, DikuMUD is relatively self-contained, requiring only the
sudo apt install make gcc unzip.
After installing our dependencies, we can now actually download and compile our game. The DikuMUD codebase is the earliest release, and can be found within the MUD Coder’s Guild DikuMUD family tree on GitHub:
If you are relatively new to the Linux command line,
wget is a command that can be used to download a file via HTTP, which in this case is a zipped version of our DikuMUD release. Once that file is downloaded, extracting the zip file is as simple as running the
unzip command on it:
With the DikuMUD source code downloaded and unzipped, you should be able to navigate to the
dikumud-genealogy-dikumud-alfa directory and see all of the DikuMUD project files:
As with compiling any Linux package from source, DikuMUD can be built by running the
make command. Because DikuMUD was written nearly 30 years ago in a now-outdated version of C, you will see a significant amount of compiler warnings. While these should be cleaned up eventually, they won’t prevent us from successfully compiling and running the game server.
make process has finished, you should see a new executable in the directory called
To start the DikuMUD server, simply call
./dmserver from within the project directory, and you will see the game server start loading files and listen on port
One thing to note is that, while this command does spin up the DikuMUD server, it ties it directly to the current login shell, so when you log out, the server goes down. To compensate for this, we can prevent DikuMUD server from shutting down on logout using the
nohup command, which tells any command it prefixes to ignore the hangup signal that is called by the logout command:
nohup ./dmserver &.
So, that’s it! Right?
While DikuMUD has been successfully compiled and started on our virtual machine, port
4000 is closed by default, so nobody is able to access it just yet. Thankfully, opening up a port to a virtual machine is another simple one-line command that can be executed from the Cloud Shell tab in our mobile app:
az vm open-port -g <resource group name> -n <virtual machine name> --port 4000 --priority 100.
With our port open, and our server running, we can now connect to our game! To do so, we first need a MUD client, and to keep things consistent, let’s stick with the smartphone theme. If you are an Android user, Blowtorch is a popular solution, while iOS users get the beautifully designed and built MUDRammer.
Using the public IP address for our virtual machine, and the port
4000 that we opened, our mobile client should connect directly to the server, and present us with the classic DikuMUD login screen:
While this is just an impractical proof of concept, the relative simplicity of launching your own MUD from your phone is evidence that getting started with text-based game development is easier than ever before. That said, if you’re just getting started with text-based game development, or development in general, we’d love to have you join our Slack community! We are a passionate bunch, and love to help each other learn new (and old) technology.
The MUD Coders Guild is a community for people with a passion for creating text-based games. Join us on Slack!