Fun with SLIGE
Get more from this random level generator for DOOM
by Blake Linton Wilfong -- The Wondersmith!

You are being deceived. The screenshot above looks like one of my ordinary cooperative DOOM games, my usual co-op modem DOOM buddy Bryan and I battling five minibarons in a rather nasty wad created by a person moderately competent in wad design. But nothing about it is ordinary. The wad was built by a computer program called SLIGE, written by Dave Chess, and the other Space Marine is a cooperative ZCajun bot, designed by Yoghurt and incorporated into the source port ZDoom by Randy Heit. Most importantly, the level we're playing is not part of a normal SLIGE wad, but one I've created using special tricks to force SLIGE to produce exceptionally challenging multi-level wads stocked with hordes of especially tough monsters. In this article, I'm going to show you just how easy it is to take control of SLIGE and make it generate wads with the features you want.

First, a few basics. If you're not familiar with SLIGE, go visit Dave Chess' SLIGE web site and pick up a copy. Don't panic; it's a tiny program with no complex installation, and it produces very generic wads for the original DOOM or DOOM II. (This means that if you're using a source port, jumping is cheating. No jumping!) Read the docs and try out the program. Amazing, eh?

OK, now that you're a SLIGE user, you've probably noticed that the program outputs interesting little text messages as it produces wads. Here's an example:

SLIGE (build 474) -- by Dave Chess,

Seed: 1431656095
Loading SLIGE.CFG...
....switch quest
.Uplocked gate
...Quest push
....switch quest
.Downlocked gate
.....Globally aligning...

Done: wrote SLIGE.OUT.

This text is very important. For one thing, the "Seed" number shown is actually a starting value for SLIGE's pseudorandom number generator, probably derived from your computer's real time clock. If you start SLIGE with the same parameters twice and it happens to use the same starting seed number the second time that it used the first time (highly unlikely), it will generate the exact same wad. Better still, you can force SLIGE to use a particular seed using the "-seed" parameter. So using SLIGE build 474--the version I'm currently using--you can reproduce the results shown above by typing:

slige -doom2 -seed 1431656095

A good use for this feature is that it lets you help Dave Chess in his efforts to debug SLIGE. Try invoking SLIGE like this:

slige -doom2 > results.txt

SLIGE still runs as usual, but instead of printing messages to the screen, it saves them into the text file results.txt. Now suppose you find a problem with the wad. Since you can look in the results.txt file to find out what seed SLIGE used to build the wad, you can tell Dave exactly what command line to type to force SLIGE to build the erroneous wad. He can "watch" while SLIGE builds the wad and see exactly where it goes wrong. Very helpful! (Be sure to tell him what build of SLIGE you used--hopefully the latest--and any other information and screenshots that might help him spot the problem and correct it.)

The results.txt file also helps you force SLIGE to create wads with specific features you want. Notice the word "Sunrooms" in the sample file above. This is SLIGE's way of telling you that it's creating a level with some attractive sky openings. Let's say you'd like to generate another level containing sunrooms. In your SLIGE directory, create a tiny batch file named sunrooms.bat in a plain text editor like Notepad or DOS Edit:

slige -doom2 > results.txt
find /i "sunrooms" results.txt
if errorlevel 1 goto start

Run it, and you'll see that it runs SLIGE over and over until it happens to produce a wad with sunrooms. On a fast computer, this usually doesn't take very long. How does it work? The first line, :start, is just a label marking the start of the batch file so we can come back here later. You've already seen the second line, slige -doom2 > results.txt; it causes SLIGE to generate a random level and dump its text output into a file called results.txt. The third line, find /i "sunrooms" results.txt, searches the results.txt file for the word "sunrooms"; the /i switch just makes the search case insensitive for our convenience. The last line, if errorlevel 1 goto start, causes your computer to go back to the start of the batch file and try again if the word "sunrooms" was not found in SLIGE's output.

You can use similar batch files to produce wads containing any feature SLIGE lists in its output, such as "extra hugeness", "windows airshaft", "switch quest", etc. But what if you want to create a level with more than one such feature? Easy; just append more searches to your batch file. For example, if you want a wad with sunrooms and extra hugeness, you could use this batch file, sunhuge.bat:

slige -doom2 > results.txt
find /i "sunrooms" results.txt
if errorlevel 1 goto start
find /i "extra hugeness" results.txt
if errorlevel 1 goto start

But be forewarned: the more requirements you specify, the less likely it is that SLIGE will happen to generate a wad meeting all those requirements. The above batch file took perhaps half an hour on my system before generating a map with both desired attributes. Another problem is that SLIGE crashes once in a while, halting with an "illegal operation" dialog box. If you click "Close", the batch file will start running again, but this means that you can't just leave the computer running it all day unattended and assume you'll have a wad waiting for you when you're done. Life's not perfect.

Next, I'll show you how to make SLIGE generate 3-level mini-episodes in which all the maps have the "biggest monsters" attribute. Here's the code for biggest.bat:

slige -doom2 -levels 3 > results.txt
find /i /c "biggest monsters" results.txt | find "3"
if errorlevel 1 goto start

I'll explain the new stuff. The -levels 3 parameter tells SLIGE to build a wad containing three maps, MAP01, MAP02, and MAP03. The third line is the tricky one. Since we want all three maps to include "biggest monsters", we need to check for three occurrences of the phrase "biggest monsters" in SLIGE's output. Instead of just finding "biggest monsters" in the results.txt file, we need to count how many times it appears. find /i /c "biggest monsters" results.txt does just this; the /c parameter tells "find" to count occurrences, not just find one. Now we need a way to search the output of the "find" command for the number "3", which would confirm that we've found a map with 3 occurrences of the phrase "biggest monsters". Sounds like a job for...the "find" command! We "pipe" the output of the first "find" command--a count of the number of occurrences of "biggest monsters"--into a second "find" command that looks for the number "3". The | find "3" does exactly this.

Again, beware. It takes SLIGE a long time to find a 3-level wad of "biggest monsters" maps, longer than the average time between crashes. But it's worth the effort. These mini-episodes are very tough, a real challenge for a single player and ideal for cooperative play. Here's an example of such a wad, the one in which the screenshot at the beginning of this article was taken:

Click here to download BIGGEST.WAD

This wad was generated with SLIGE 474 using a seed of 1039347097. Using SLIGE 474, you could recreate it exactly with the command line slige -doom2 -levels 3 -seed 1039347097. If you don't have anyone to play cooperatively with, I suggest you try biggest.wad using ZDoom's built-in Cajun bot. If you help lead him along a little, you'll find your dull-witted companion somewhat useful throughout most of MAP01 (till you reach the lift), early parts of MAP02 (till he gets lost in all the twists and turns), and, alas, mostly helpless in MAP03, due in part to his hypnotic fascination with the yellow door. The real benefit is that activating the bot (with the "addbot" command) also switches the game to cooperative mode, in which the monsters stay dead even when you die and respawn.

Finally, here are a few warnings. Some combinations of attributes might be mutually exclusive; if so, the batch files you create to find them will run endlessly (until you stop them). If Dave Chess changes the messages SLIGE outputs, your batch files might not work with newer versions of SLIGE. And I am not responsible for any damages caused by SLIGE and/or these batch files; use them at your own risk.

Ok, enjoy!

to the Rants, Raves, and Reviews main page
to The World of the Wondersmith

Rants, Raves, and Reviews
Copyright © 1999-2018 Blake Linton Wilfong
All rights reserved.