Series Info...NeoArchaeology #6:

Procedural Content Generation

by Noah Gibbs

Four weeks ago, I talked a little about how to write less while building your MUD, and I skimmed the topic of procedural content generation. This week I'll go into a lot more detail about PCG, and how it succeeds and fails.

What PCG Promises

I didn't go into a lot of detail last time when I defined PCG. I'll do a little better here: procedural content generation is using code to make the rooms, portables, descriptions, or other parts of your MUD that might be called 'setting'. Usually PCG draws on a library of phrases, objects and/or scripts, and combines them in various ways to form a setting.

PCG is as grand as randomly generating a whole world, and as humble as using Skotos Active Markup to choose between three or four random strings in an item's description. Its greatest proponents claim you can use PCG to do far less work when modeling your world, and that you can generate vast landscapes trivially. Then, goes their claim, your builders will be free to create only specific bits of custom content.

That promise isn't worth the bits used to send it. But just because that specific statement is false doesn't mean that PCG is useless. Far from it.

There's a less-awful argument that we'll also examine. Saner PCG fans claim that once somebody builds the PCG system, it's faster for you to take their system and plug your own content in than it is for you to build all your content from scratch in the normal way. That turns out to be false, too, but it's a better idea and we'll examine it more carefully. So as we talk about building and effort below, try to take note of what effort is required for the PCG system, and what has to be specific to the individual MUD that uses that system.

What PCG Is

To give your players elbow room, it's important to have a lot of virtual real estate. I don't mean homes and castles, though those help. I just mean that the players need room to run around. Wildernesses and roads, dungeons and swamps, towns and caves. It takes a lot of time for you to build these areas and populate them reasonably.

Procedural content generation helps a bit with this problem, although it doesn't really solve it. Let's say you want to make a lovely huge spawling forest. You've made simple objects for rocks, brooks, waterfalls and trees full of birds. Then you can trivially set up a room with a description like this one:

You're in the deep forest. Dry leaves crunch beneath your feet. A waterfall gushes down a small cliff face to the north. There are some strange blackish-purple rocks among the grasses here. A brook gurgles merrily from northwest to southeast. A holly bush is filled with tiny red birds and high-pitched birdsong nearby.

It's entirely possible to make every sentence correspond to an object or detail. You could easily randomize some set of 'flavor' objects like the ones above for every room in the forest, picking perhaps two to five in any given room.

And now, with the amount of detail you'd usually put into four or five good rooms, you can put together a fifty-room forest. Each room can be unique, and each will have at least one or two interesting objects in it. Then you can add some random spawn points, and have three or four types of animals or monsters wander through.

That's fine. Unfortunately, to maintain really interesting rooms, you need a lot of different flavor objects. That's because if every tenth room says "There are some strange blackish-purple rocks among the grasses here", they start to sound really awkward. Objects that sound really distinctive should be genuinely rare. And if nothing sounds very distinctive in forty-eight of your fifty rooms, your forest will be boring. In essence, PCG can't give you actual new content. All it can do is give you a new way to spread your content thinner. With PCG, you won't wind up having really short descriptions. You aren't repeating whole descriptions. But you are repeating descriptions piecemeal by repeating the sentences that make them up.

There are a number of different symptoms of this "spreading thin" effect. We'll cover several more here.

What PCG Isn't

One of the flaws of random placement is that it's random. Imagine that. I call it a flaw because you'll find that random positioning tends to put inappropriate things together, or put interesting things together without them interacting.

If two of your flavor objects in the forest are a rabbit hole and a wolf's cave, you wouldn't expect them to both be in the same room. That's just asking for trouble. If a human gamemaster was building the room, she'd probably make sure the two were far apart, or she'd explain why both were in the same area. Maybe it's a vicious attack rabbit. Maybe the wolf is allergic. Maybe this end of the rabbit hole keeps the wolf sniffing around while the rabbits all prefer to use the back entrance, far away.

Fans of PCG call random placement a feature. Specifically, what they're hoping for is called "emergent behavior". The idea is that if you put a bunch of stuff together randomly, you'll see new and interesting behavior as the objects interact. The idea of emergent behavior is basically sound in some applications. For instance, you can give a good artist five unrelated tools and he'll quickly show you how two of them, used together, will do things you'd swear could never be done with all five.

Unfortunately, emergent behavior requires an interesting and capable set of rules for combining things. What the example artist does is very difficult. More importantly, it requires the laws of physics to already work. Simply concatenating the sentences "there is a rabbit hole in the ground here" and "there is a cave in the cliff smelling of wolf" obviously won't give any unexpected results. Though a good animal spawning system might wind up leaving a lot of little bits of dead rabbit lying around...

There's a problem with relying on your PCG to do emergent behavior for you. Your PCG system is relying on your MUD to do something interesting with the results it produces. Emergent behavior isn't the result of putting two interesting things in the same room. It's the result of the powerful and complex system that does things with those objects afterwards. PCG fans love this concept. Sadly, though, I've never seen one of them bother to build the necessary system to make the results interesting. So random results just wind up being boring or sounding forced. PCG rooms can seem less boring (but probably just as random) if you build a lot of flavor objects, but then you're doing just as much work as you were without PCG. And you're not significantly better results.

That's really the theme here: PCG has a lot of good properties, but it will never save you effort.


What if you go through and make sure that a wolf den will never be placed next to a rabbit hole? What if you make sure that things are spaced out so that conflicting features won't be near each other?

Boredom. Plus you'll have to make even more flavor objects.

If you restrict the combinations of objects (like saying a wolf den can't happen next to a rabbit hole), you reduce the number of combinations of objects. You have fewer combinations covering the same area, so you have to add more flavor objects to bring the number of non-repeat choices back up. If you don't, then you have fewer choices in the same area. That means more repetition, which means even more boredom.

So more intelligent PCG, such as avoiding contradictions, will make more work for you, not less, unless it can also solve those contradictions. Making PCG solve those contradictions is specific to your setting, so that's more setting-specific work. Even if your PCG system is fully built, it can't help you with that. Also remember that a lot of intelligent PCG involves things like keeping rabbit holes away from wolf dens, and that's also specific to your setting. Your PCG system could allow things like identifying predator and prey models, so that the spawn points could be intelligently rearranged. But have you ever tried to get builders to follow rules like that? It's not easy... And it's a lot more work to tag all of those things.

As you can see, PCG isn't really a way of saving you writing. If you want your PCG-based setting to be as interesting as a fully hand-coded setting then you'll have to do at least as much work, and often more. Plus you'll have to rearrange every time you upgrade or discover a bug in your setting-specific PCG.

We'll talk extensively about the problems of upgrading your PCG system in a later column. For now, just remember that changing your PCG code can change a lot of existing objects suddenly and without warning. Say you make your PCG code always separate rabbit holes from wolf dens. A logged-out character was standing in a room with both a rabbit hole and a wolf den. When he logs back in, he can't be. The room has to change. Now imagine you changed where your PCG system put dangerous animals. A player logging in after several weeks' absence might not be thrilled to be in the middle of a den of dragons suddenly and without warning...

All of the problems of spreading out your content point to the same thing. Whether you do PCG or not, you simply need to build enough content. PCG will save you manual repetition, but it won't save you the need to write interesting objects and scenarios. But it can repeat them, lightly modified, across an entire continent...

Getting Started Again

So if those are all the limitations, and all the debunked myths, what does PCG do right? Let's think about how most fresh-built MUDs are originally deployed.

When a MUD first opens to the public, it's usually small. A few hundred rooms or less. There are usually a small number of unique portable items (including things like weapons), a small number of monsters... The MUD doesn't have much variety overall, but the rooms are individually pretty good. The MUD has a small amount of interesting stuff, but it's concentrated into a small number of rooms so it catches the eye nicely.

PCG can be used to turn that model of deployment on its head. Instead of taking your tiny bit of content and making it small, you can take your tiny bit of content and make it big! Instead of putting your twelve different types of monsters and putting them into fifteen different lairs, put them into a hundred or a thousand different lairs. Instead of taking your three types of blunt weapon and putting one in the shop and two in a few specific places in the world, put one in thirty shops and put the other two in two hundred lairs. If your content is boring, there's not much you can do to change that. Making it big won't make it any less boring. But it'll make it big.

If your content is small, though, rather than boring, then PCG can fix it for you. Your world will be repetitive, but it'll be big.

What does that buy you? Well, some players just like bigness. Even if you have a tiny pathetic little world generator that makes boring worlds, this is still a new field. A few players will play anyway. It's not like solitaire does anything new when you play again, and people play that anyway. Right?

The other thing it buys you is elbow room. Some players like bigness for a different reason. They like to imagine their characters living really epic lives, going out and slaying vast numbers of monsters, ranging across leagues and years rather than feet and days. Even if your descriptions are boring and repetitive and your towns are from a cookie-cutter mold, a few players will slog through it simply because it's big. It's a huge world where they can imagine anything they want. By freeing their characters geographically and providing very little actual content, you're allowing them to imagine anything they want on top of your world.

And by the time you have enough content to drive them off, to keep them from imagining their own little world on top of yours, you'll also have enough content to interest the more common players. Those ordinary players would would never come to your new, tiny, boring world when you first built it. By adding content you'll chase off the bitterly-complaining pioneers, but you'll trade them for a stable player base who'll appreciate your efforts in the long run.

And maybe you can keep a few of those big, boring, sparsely-described areas. It'll let the pioneers stay. It's not like it takes that much effort, right? And even the MTV generation likes to know that somewhere in the background, there are still trails to blaze and vast wild expanses to explore...

What Now?

Now that we've used the broad strokes to show the outlines of PCG, I'll be back in four weeks to fill in some little nitpicky details. In the mean time, in two weeks we'll talk about some MUDs that have activities and even advancement paths other than whacking monsters over and over until they die. Pretty novel, hey?

[ <— #5: Real Innovation ]

Recent Discussions on NeoArchaeology: