Resurrected Entertainment

Archive for the 'Retro' category

Getting Dirty with DOS DOOM

July 15, 2007

The story behind the source code release goes something like this: In December of 1997, id Software released the source code for Doom to much fan fare and adulation. After only a few short weeks, web sites starting popping up and modified (or modded) versions started appear on bulletin board systems. Before the source code was even released, their were already tools available for modifying the existing graphics and levels, or for creating your own levels, on the Internet. These tools operated on the storage format for the game’s resources, which included maps, graphics, sound effects, etc. These resource files were called .WAD or .IWAD files. WAD does not stand for anything in particular, but you could choose to think of it like a wad of gum after eating a burrito. It contains all sort of unrelated bits in it, like green pepper and cheese, but together they form a chewy and cohesive whole. Yummy.

Modification to the actual game engine allows for much greater control over how the game operates. Despite this new found ability, many programmers or modders chose to leave the original code base intact, in order to give their users the freedom to play the older levels designed by the master’s at id Software. I believe this should be an important creed for any aspiring Doom hacker to follow, as it will allow your audience to experience the many thousands of levels available for immediate download. Just in case your levels fail to impress your core audience, such as Mother.

This project is intended to document what you need in order to build the DOSDoom (another port of Doom) source code on your machine. We chose to use DOSDoom, instead of the original code base, because the original requires a fair amount of modification to get it building with the available development tools and environments on an MS-DOS compatible machine. This brings me to my next point, you’re going to need a compatible DOS operating system installed somewhere in your house, if you want to compile this project; Windows 95 actually works quite well too as they are basically one and the same in many respects. As a trusty member of the classic gaming community, I trust this shouldn’t be a problem for those of you who are still reading.

DOSDoom brings a nice set of options to your exisiting Doom game. Features like mouse support, the “look” feature, CD audio, alpha blending, custom resolutions, and a whole lot more! Trust me, when you’re finished setting it up, you’ll think it’s almost like a new game.

Ok, first things first, you’re going to need the source code. It also helps to have a pre-built copy of DOSDoom on hand for comparison, and a chance to try it out just for fun. Personally, I love this version of Doom and will typically opt to play it over the original; unless we’re talking about the Playstation port, then we could be persuaded switch platforms for a while, or the Mac OS X port I wrote about a while ago. Of course, before either version will work, you need an original version of Doom. Please respect copyright laws and get yourself a legal copy; it’s not that expensive when you consider what you’re getting in return. Now would be a good time to unzip the pre-built copy of DOSDoom into your Doom game directory.

For those of you who weren’t born with a debugger in your bonnet, there’s a few pieces you need to have in place before you start unpacking the source code for DOSDoom. First, you need to understand the process by which program code gets transformed into something you can actually use. However, we’re not going to write yet another treatise on “How To Program In Such And Such A Language,” although for your reference, the core programming technologies used in this project are called C and Assembly Language. Learning to become a programmer is an iteresting but terribly long ordeal. I don’t recommend it unless you’re planning on making it a serious hobby or even a profession. Choose to play the game instead, you’ll probably be happier.

Since you’re still reading this article, I think it’s fair to assume that you’re mildly interested in the topics presented thus far, so let’s get a few terms under our belt before we begin. There is one general phase which must take place before you can use the source code provided and that phase is called compilation. A compiler is a tool used for translating source code which has been written in a high-level language, such as the C programming language, into a lower-level language more suitable for native execution within the hardware environment you are using. From a software development perspective, writing a good compiler is one of the most difficult and rewarding experiences a programmer could choose to undertake. However, simply using a compiler is usually no more difficult than learning any other moderately complex tool. Yes, there are usually a plethora of options and fancy doodads available for any aspiring geek, but many of them are rarely used and can be ignored most of the time. The compiler used for this project is part of a free development environment called DJGPP. DJGPP was primarily constructed by a man named DJ Delorie with plenty of help from the open source community. It contains numerous utilities, including a DOS port of the GNU GCC Compiler Collection.

Assembly Language, on the other hand, is much less abstract and tends to be a lot closer to a machine’s level of understanding. This source code does not need to be rigorously compiled and students of computer science will often write simple assemblers for course projects. Instead, Assembly is translated into machine language almost directly. Depending on the software used, “almost” can vary from assembler to assembler. DOSDoom’s source code contains only a couple of assembly language modules and can safely be ignored unless you’re planning on making low-level modifications to the game’s rendering engine. For this project, we’ll be using GCC’s assembler called GAS for all of our assembly needs. There is one item we wanted to mention when using GAS assembly code: it does not follow Intel’s coding conventions for instruction mnemonics, it uses the AT&T style instead. For a great book on coding for the Linux platform (which typically uses GCC as the default compiler/assembler toolkit), pick up a copy of Professional Assembly Language by Richard Blum (ISBN: 0-7645-7901-0).

Now that we’re all a little familiar with the basic process, here is the complete list of packages needed in order to compile DOSDoom:

Now what are these extra packages all about anyway, eh? They’re all required too, except for RHIDE which is a nifty Integrated Development Environment (IDE) very much like Borland’s early C/C++ IDE, and the DJ File Packer which is used to shrink the size of the resulting executable into something more manageable. The DPMI server is required by every 32-bit protected-mode application (in this case it’s DOSDoom) for DOS and gets launched automatically by the client application – just make sure it’s available via the PATH environment variable or in the applications home directory. The item listed only as Make is a set of tools used to easily build applications by managing their dependencies; although the syntax used to create Make files is anything but intuitive. Last, but certainly not least is the Allegro Game Library originally written by Shawn Hargreaves. Allegro is used to fill some of the gaps left by id Software when they released the source code for Doom. It’s a great library and can save you loads of time when you’re trying to write an application. All of these tools or libraries are relatively complex and deserve your attention if you want to make any useful contributions to this code base.

All but the last package, CSDPMI, must be unzipped into the same directory; CSDPMI goes into the Doom game directory instead. To help illustrate where everything goes, here’s a look at our build directory:

contrib
allegro
bin
doc
gnu
include
info
lib
man
manifest
projects
share
tmp

Once the packages have been decompressed, modify the DJGPP.BAT file to suit your own directory organization. For example, my batch file looks like this:

@echo off
set PATH=c:\source\dosdoom\djgpp\bin;%PATH%
set DJGPP=c:\source\dosdoom\djgpp\djgpp.env

Execute the batch file whenever you open a new console window (when using Windows 95), or after you’ve booted into DOS. Now, open the file under the Allegro directory and find a file named makefile. Remove the bit of text “-Werror” from the file using your favourite text editor. This is a compiler option which will halt the compilation process when a compiler warning is encountered; normally, it’s not a bad idea, but for the sake of simplicity we’ll remove it for now. The next step is to build the Allegro library by typing the command make.

Depending on the speed of your machine, the compilation process may take a while and you’ll see several messages displayed on screen. If you downloaded everything from this web site, you should experience no errors (provided you removed the compiler option mentioned above); although a few compiler warnings will make their appearance now and then. Once the Allegro library has been built, you should now enter your DOSDoom source code directory and type make again. This will build your DOSDoom executable file. You’ll need to copy this file (/obj/dosdoom.exe) into your Doom game folder (where the main executable file doom.exe is found) . Run the file dosdoom.exe and enjoy!

Remember: When making modifications to DOSDoom, please acknowledge all of the contributors who have made DOSDoom into what it is today. Without the tireless efforts from these people, you would have a lot of work on your plate before you even got started implementing your own vision of what you want Doom to be.

Exult v1.2 API Documentation

July 10, 2007

Since I couldn’t find any on their site, I’ve churned through the Exult engine using Doxygen to produce a usable set of API documentation. It’s a good reference to get a handle on their overall architecture in case you felt like diving a little more deeply.

Introducing CircleMUD

July 7, 2007

During the early 1990s, the Internet was fairly new to most people. At the University I attended for a time, we were using a PC-DOS based environment which had Novell’s Netware stitched on top of it. At the time, I had a small number of Usenet news groups I liked to read every morning, and I stumbled across a post by an individual in alt.rec.gaming or the like. This was before the days of spam and prolific pornography, so when a person posted a message with a subject line like “Check out this cool site!” You had no reservations whatsoever about following the link.

The link he provided wasn’t a URL which could be viewed in a web browser, but looked something like this:

telnet://chaosrealm.darkmatter.org:4000/

Until I started paying to go to school, the only experience I had with a public network in the late 1980s was through local Bulletin Board Systems. I could e-mail people on other BBS systems through something called FidoNet. Those systems would use a BBS mailer for the users to create their message (or it could be uploaded using a pre-formatted text file), and then copy it over to the FidoNet servers for transmission using specialized protocols. The mailing address was rather complicated and needed to have a series of names, symbols, and numbers affixed to it if you ever expected it to reach its destination. Due to my own inquisitive nature and two very understanding parents, I was able to set up and experiment with computer communication. As a result, I was somewhat more experienced with networking before entering University than your typical freshman, but I had never used a telnet client before. It was certainly a mystery that needed solving. Little did I know what worlds waited for me on the other side. Nowadays, there is a bare-bones telnet client on virtually every desktop. Under the Xandros operating system, the program is called “telnet.” Likewise for Microsoft Windows and MacOS X.

After a bit of research, I discovered what I needed to access the site, so I started poking at the client program. A friend of mine saw what I was doing and thought it looked interesting, so he pulled up a chair and logged into his own terminal. What we saw was disappointing at first. It was essentially a blank screen with a small title surrounded by credits centered in the middle and a login prompt near the bottom left-hand corner. I knew neither of us had an account, so I thought our little adventure would probably end right then and there with a message like “Invalid login” or “Permission denied.” Instead, we received a prompt asking “Are you sure you want to use this name?” Tentatively, I declined and sat staring at the screen for a few seconds. I was familiar with the concept of a “handle” or nickname from the BBS systems I frequented. I remember not wanting to use the name I had entered, which was probably something unoriginal like my first name. I don’t remember the name I chose and it’s probably for the best. Little did I know, the interesting questions would soon follow.

The server accepted my new name and prompted me for a password. It then asked if I wanted to be “[M]ale, or [F]emale?” During my role-playing sessions, I had never considered being a woman, even though friends of mine tended to flip-flop between the sexes just for fun from time to time. I guess it just wasn’t something I even thought about. My teenage philosophy was black and white: how could I be a fearless knight of the realm with breasts? However, faced with the same opportunity on my computer, I did pause for the briefest of moments. Anonymity is not somethings easily overlooked by most people. Not wanting to appear unmanly in front of a friend, I quickly pressed the ‘M’ key. To this day, I have never played as someone from the opposite side of the gender coin. I eventually realized it didn’t really have an appeal for me. If I was going to invest the time creating a character in this new world, I needed to take it seriously and not go galavanting around the realm trying to fool everyone into thinking this body is real and I know how to use it. Besides, I really don’t think I would be able to do a very good job of it. I would probably end up over-acting and annoy everyone in the game while fooling no one at the same time. And then there’s the whole psychological impact of sustaining an Internet female persona…

Depending on the site you visit, the questions don’t necessarily end after you choose your sex. There can be questions about your race, occupation (warrior, cleric, mage, or dentist), attributes, and a description for your character just to name a few. Before you start hammering away at the the keyboard, it’s important to realize these details will be visible to other people. The site I visited that day was classified as a MUD which stands for Multi-User Dungeon/Dimension. There are many other classifications of multi-user software environments such as MOOs, MUCKs and so on, but I have only been interested in dungeons. A MUD is a world tapered in such a way the user will feel like their transported into an interactive book. All of the details in a MUD are described by words; there are no sounds, graphics, or vibrating joysticks. The illusion is helped along by talented authors and other player characters. Just like actors and actresses, most people who enter a MUD want to remain in character while they’re on-line, so information about their personal lives are usually not revealed. If they want to elaborate on their real life, then they usually initiate a private chat or use special abbreviations to illustrate they are speaking out of character.

The software hosting the MUD is stateful. It knows when you’re logged in and when you’re not. When you’re naughty and when you’re nice. By your command or when you log off, it can record vital details about your character like the equipment you’re carrying, the money you’ve accumulated, and other pertinent details. Anyone familiar with games like Dungeons & Dragons will feel right at home in this universe. In fact, it’s often a fun alternative to playing face-to-face, especially when you’re role-playing amigos live far away. Muds essentially run by themselves, but they can also be directed in real-time by controlling characters often called wizards, gods, or heroes. These characters have permissions to modify the world and initiate quests. Ordinary players can sometimes attain these positions by achieving a very high-level character ranking and then be offered a promotion, or simply participating in its day-to-day operations by becoming more involved. Sometimes it’s just easier to befriend one of the wizards and beg for an opportunity to prove yourself worthy. Just try not to cry if they refuse.

Wizards are usually programmers who typically interact with the MUD on a technical level. They usually have a character which is used to logon to the server in order to test the deployment of a new feature. It’s inadvisable to anger these people because they can eject you from the MUDvery easily. Their characters on the MUD are not ordinary players; they usually cannot be killed and they often make themselves invisible to ordinary mortals. This is a kind of power one can abuse. Do what you like on your own server, but I can guarantee no one will want to visit your realm if you abuse your abilities as a Wizard.

Back in the heyday’s of MUDding, there were literally thousands of these servers up and running on the Internet. And as a player, you had your pick of the litter. Low and behold, though, the majority of those servers were rehashes of existing worlds. There were a few bright stars amoung them, but it was a challenge to find a truly original MUD with a decent up-time. If you’re going to spend the time to create and manage a MUD, then I suggest you think of an original theme first and then come up with an interesting environment. It could be used as an interesting spot where you and your friends and family can hang out instead of the typical chat room.

Interaction on the MUD is accomplished via text commands you feed to the server hosting the game. These commands and transferred over the Internet via the telnet protocol and then the response is sent back to your client in a timely manner. So, what commands are available for you to use? It depends on the server software, but they are very similar to the commands used by many classic adventure games. At some point in their history, games like Leisure Suit Larry and King’s Quest all sported a command interface where you typed what you wanted the character to do. For example, commands like “take bottle” or “look at painting” were commonplace. MUD commands were pretty much the same, except they could usually handle more complex sentences and contained a larger set of available commands. There is also the multi-player aspect to consider. A MUD needs a much more extensive set of commands used for communication like “shout,” “talk,” “whisper,” or “emote.” These all have different effects based on your permissions and proximity to other players. For example, some MUDs do not allow just anyone to shout a message, since it will usually be heard by everyone currently logged into the MUD. Players in the past have used this feature to be very naughty.

Due to its popularity, you would expect there to be a lot of MUD software available on the Internet and you would be right in thinking so. From this point onward, we’ll be studying an implementation called CircleMUD. CircleMUD was created by a man named Jeremy Elson in 1993 and is a worthy extension to the DikuMUD codebase which was written by Katja Nyboe, Tom Madsen, Hans Henrik Staerfeldt, Michael Seifert and Sebastian Hammer in 1990. It is stable, well programmed and documented and certainly one of the more popular servers available today.

Before we delve too deeply and greedily, I think it’s worth talking about the software license. You can use the software free of charge, but you must comply with the license agreement, which basically has three requirements. First, you can’t make any money off of CircleMUD. That also includes soliciting funds or accepting donations. Second, you must give the authors credit for their hard work. And lastly, you must comply with DikuMUD license. All of these details can be found in the documents accompanying the distribution.

VMWare for Games?

June 29, 2007

VMWare LogoJust for kicks, I decided to try and install FreeDOS into the free version of VMWare server yesterday. The installation went very nicely and before long I was mucking around in the console. I decided to try and play a game in this environment. Having used FreeDOS before, I knew it would work with the operating system, but I was unsure how playable it would be under VMWare.

The first game I tried was Blake Stone: Aliens of Gold and it ran quite well. I was encouraged so I decided to try a more complex game. I chose DOSDoom because I love the game and it seemed like the next logical step. It also ran well. To try out your own game, just run an ISO generation tool on the installed directory, and attach the ISO to your VMWare guest. If you’re running Xandros, use the ‘mkisofs’ command:

$ mkisofs -o /tmp/doom/cd.iso /tmp/doom/DOOM/

Assuming your installation directory is located under ‘/tmp/doom/DOOM’, this command will quickly generate an ISO file. To make it easier on yourself, I would just throw all of your favourite games into one ISO, burn the CD, archive it (you can edit it later if you want to add more games), and use that whenever you feel an itch to play.

This technology is a fabulously free alternative to building your own RetroBox, but maybe not as much fun to put together.