The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

CircleMUD Data in XML Format for Your Text Adventure Game

Mon 19 March 2012    Al Sweigart

Long before World of Warcraft, people played text-based MMORPGs called MUDs (Multi-User Dungeon). These were basically multiplayer text adventure games where people could wander through a virtual world fighting monsters and exploring. They had several RPG elements to them.

CircleMUD was a popular piece of server software for running a MUD, and it came with a sizeable virtual world (which the admin could modify/append to customize their fantasy world.) It would be pretty handy to use parts of this data if you were creating your own virtual world for a text adventure game, but the format of CircleMUD's data files is kind of obtuse and not amenable to manipulation.

So I wrote a few scripts to convert these files into a single XML file which is 4MB when unzipped. You can parse this file and modify it to suit your needs. It contains 1979 rooms across 30 different areas (called zones in the file), with 46 shops and 569 different "mobs" (mobile objects, which are the monsters and NPCs). There are 678 different types of objects, including 116 weapons and 154 types of armor.

The scripts and original CircleMUD data (along with descriptions of the data formats) are included in the zip:

Download CircleMUD XML Data (1.3 MB zipped)

Use Python's XML parsing libraries rather than trying to write your own code to parse it. Dive into Python has a chapter on XML parsing and Effbot's ElementTree module can parse XML. The zip file also comes with a small script that loads the data as a giant Python dict.

Here's an example of what this textual data looks like:

<mob vnum="907" alignment="-1000" type="S" level="26" thac0="0" ac="-2" 

maxhp="12d8+590" barehanddmg="4d6+10" gold="0" xp="160000" 

loadposition="standing" defaultposition="standing" sex="male">
  <alias name="minos" />
  <alias name="king" />
  <alias name="minotaur" />
  <shortdesc>King Minos the Minotaur</shortdesc>
  <longdesc>King Minos the Minotaur is ready and waiting to gore you to death.</longdesc>
  <detaileddesc>He smells something awful.</detaileddesc>
  <action sentinel="true" aggressive="true" memory="true" helper="true" 

nocharm="true" nosummon="true" nobash="true" />
  <affection detectinvis="true" senselife="true" sanctuary="true" infravision="true" 

notrack="true" />
</mob>

If you'd like to play a MUD for yourself, there are still many that are run on the Internet. The website mudconnect.com lists over a thousand of them. Just search for "CircleMUD" to find a server that runs the CircleMUD software.

Enjoy!


Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.

Email | Mastodon | Twitter | Twitch | YouTube | GitHub | Blog | Patreon | LinkedIn | Personal Site