Friday, July 27, 2007

Procedural Content Generation for a Star Trek MMORPG +

I've read a number of objections to procedural generation of content in Star Trek Online. They seem to come down to the following (which I'm ordering in terms of how hard they are to answer):

1. Over billions of instances, there's no way an individual object can be unique in every instance.

2. "Procedurally generating" objects is really just a fancy name for random generation.

3. Procedural generation (i.e., random generation) of unique and high-quality story-based content over billions (heck, even mere thousands) of instances is just not practical -- there are only so many variations possible on mission text. Randomly changing one word from an existing mission script doesn't make the new mission interesting.

4. Human-crafted content will always be superior to machine-generated content. So there's no point in designing and implementing code to crank out millions of pieces of junk -- just hire smart and talented people to handcraft a few really good assets.

5. Why would we want billions of worlds to explore, anyway?

First of all, we need to agree on terminology. "Procedural generation" does not mean "generating the parameters that define an object." It's not about randomizing values to, say, Eyes_009 and Hands_012 and so on. What's being "procedurally generated" aren't the input values, but rather the appearance and active behaviors of objects whose forms and actions are specified by the input parameters (whatever they may be).

So in the case of Spore, you the player will get to pick the hands and eyes and mouth and so on of your creature, including where they go on the creature's torso -- no procedural generation there. What gets procedurally generated are the movements and dynamic behaviors of the creature whose pieces you put together. The "procedures" -- the code -- is where the knowledge of movement and behavior is embedded. And it's this code that takes the small set of values that describe a creature's physical components and from them generates on the fly the run-time features determined by those values.

What this means is that although all creatures may perform the same types of movements at a conceptually high level -- mating, for example, or swimming, or calling to similar creatures -- each specific creature (as defined by their input form parameters) will have a unique version of that movement. Every different set of body values will produce a different set of movements. They won't be all that different; there's only so far you can extend bipedal locomotion, for example. But to be able to create a software system that's capable of taking a few input values and generating visually plausible movement for creatures with two short legs, or four long legs, or six widely-spaced legs... that's nothing short of astonishing.

And that's the beauty of procedural generation: you don't have to write unique code for every unique object. Instead, you put a lot of effort into writing code that's "smart" enough to know what to do with a wide range of input parameters. And then you turn your code loose on whatever input parameters your users come up with and watch what happens.

In essence, the art of procedural generation is to move the complexity of dynamic object behavior from the data to the code. Once that's working, the size of the input data becomes amazingly small. And that's a major benefit when, as I mentioned earlier, you're dealing with a lot of objects to be stored or communicated.

The price of this, of course, is that your code gets a lot bigger and a lot more complex, since that's where you've shifted the rules for how objects behave. But at least that's a static problem, not a run-time problem.

So, all that said, let me now try to address the specific objections raised.

1. True, individual objects can't be unique over that many instances. However, if any individual object has enough different input parameters to a procedural behavior generation function, it only takes a few values before combinatorial effects kick in to allow a very large range of different forms and behaviors.

More importantly, a world doesn't just consist of one type of object. It's reasonable to expect that planets in a procedurally generated galaxy might have the following variable values at a bare minimum (I'm really just scratching the surface here):

  • distance from the star they orbit
  • eccentricity of their orbit
  • size
  • age
  • composition
  • rotation speed
  • core type (molten metal vs. cold metal -- determines planetary magnetic field)
  • atmosphere type
  • atmosphere densityv
  • mean surface temperature

  • surface temperature variation

  • plant life: hardiness, number of forms, growth style for each form, color(s) for each part of each form, etc.

  • animal life: hardiness, number of forms, physical parameters for each form, etc.

  • intelligent life: attitudes, outlooks, technology levels, government types, architectural styles, etc., etc.

Once you have those variables (and probably many more), and each one of those variables can itself vary in multiple ways, the combination of all of those things is likely to be reasonably different for many planets within a billion worlds. A billion is definitely a lot! But combinatorials generate pretty big numbers awfully quickly. So sure, in a billion worlds I'd expect the procedurally generated forms of some of them to look roughly similar. But with the kinds and amounts of variation possible in world-definition, I'd also expect the odds of running into apparently duplicate worlds to be fairly low. (Note, however, that you might actually want some apparent similarity based on world-building constraints. A planet near a sun should probably be very hot and lifeless; a planet far away from a sun should probably be either a gas giant or a frozen rock and lifeless either way; and so on. So I'd expect many of these worlds to resemble each other somewhat. I'd actually be more confused to see a nice human-habitable world placed just a few million miles away from an enormous ball of fusing hydrogen just for the sake of achieving an even distribution of different planet types.) 2. (Addressed above.) 3. I agree with you that this would be a problem, but it's not really a problem with "procedural generation" as I've defined it above -- it's a problem of random content generation. Going off the subject of procedural generation for a moment (because this is actually a pretty interesting subject), my gut feeling is that randomly generating a sufficiently large number of acceptably different missions is not an intractable problem. Assuming for the moment that someone wanted to do this (and someday, some developer of a huge MMORPG world might), the key would seem to be to predefine as many significantly different types of missions as possible. From there, you'd then devise as many variations on each mission type as possible, and give each variation as many possible values as you could think of. That would give you your maximum solution space. From there you'd probably want to condition the specific mission that's randomly generated according to certain features: the character's class and/or level, for example, or local environmental features. Obviously there would still be a lot of issues to figure out with a system like this, starting with (but emphatically not ending with) how each individual mission might fit into a larger picture. Big-picture missions might actually be worth hand-crafting; there's nothing that says a developer can't use multiple methods to create content. At any rate, I agree with you that this would be tough. But impossible? I'm not quite ready to go there yet.... 4. Well, here's the biggie: Can machines ever have and express anything even remotely like the aesthetic sense that humans have? In short, can machines create true art? That's really more of a philosophical question than anything else, so I don't think we're going to be answering it here -- not even if I could keep typing for another 50,000 words without being smacked with a wet newspaper for abusing everyone's patience. "Bad Flatfingers! Bad!" :) So I'll just say two things about this. First, to the top-level philosophical question, I cannot recommend a better study of this question than Douglas Hofstadter's Pulitzer Prize winning book, Gödel, Escher, Bach: An Eternal Golden Braid. I believe I'm safe in saying that there has never been a more erudite, funny, deep, smart, and beautiful book on the subject of "can machines ever think as well as the typical human does?" For anyone even remotely interested in this subject, GEB remains absolutely required reading. Second, to the practical question of generating content for MMORPG worlds, I would hazard a guess that as of today we are more capable of this than you suggest. But I would also say that we still have a very long way to go before machine-generated gameworld content matches the level of quality that human-generated content is capable of achieving. If that's true, then perhaps what we should be considering today is neither full human-generation nor complete machine-generation, but a balance of the two. Bring on a few CompSci doctoral candidates who haven't realized that they aren't supposed to be capable of discovering ways to allow machines to generate limited forms of rich, fun content. And pair them up with experienced world designers who can take the random-generation tools and use them to produce many, many more good objects than would be possible through pure handcrafting. The bottom line question is whether players of a MMORPG care more about quality or quantity. Of course they all want both... but which do they really want? A procedural content generation system whose semi-randomly generated inputs are hand-tweaked is, I think, the most effective way to meet reasonable requirements of both quality and quantity on a budget and a tight schedule. 5. Finally, why do this? Why bother procedurally generating billions of places at all? This is a gameplay design question whose answer, I believe, depends on who you think these MMORPG things ought to be designed to attract. If the aim is to provide a very directed gameplay experience, if it's to exercise a high level of control over what the players do and how they do it in order to insure that it delivers competitive, action-oriented fun (as in World of Warcraft), then handcrafting a small number of places is a reasonable design strategy. For better or worse, most MMORPGs are designed to try to satisfy Achievers with concrete objects to acquire, and with very specific and well-defined ways to acquire them. This implies a need for clearly-defined places in which to go to obtain these objects. So making just a few places with highly tailored features is simply efficient game design. But what if the aim is to give players more freedom to (boldly) go where no one has gone before? What if one of the intentions of a MMORPG's designers is to appeal to different kinds of players, including those for whom charting the unknown is as much fun as killing mobs and taking their stuff is for Achievers? Such a MMORPG would need to have a practically infinite number of places and systems to discover in order to insure that no player ever runs out of exploration-oriented content... and you're simply not ever going to get that by handcrafting every bit of content. This is one of those things that's a little hard to explain because most people are accustomed to thinking of their way of seeing the world as the only way that makes sense. Anyone who's an Explorer gamer has already understood what I'm saying and is waaaaaay beyond ready to play in the vast gameworld I've described. Meanwhile, anyone who's not an Explorer is probably shaking their head and thinking, "this guy has no idea what's fun; he has no clue what he's talking about." (Actually, the Achievers and Manipulators/Killers probably stopped reading this novel somewhere around the first line!) Ultimately the only proof some folks will accept that a billion-planet game can be made, and that it would be a lot of fun for a lot of paying customers, will come from someone actually creating such a game. Until that happy day arrives, those who think such a game wouldn't be enough fun for enough gamers and would fail miserably are entitled to their opinion. Fortunately, so are those of us who already know we'd happily play for years in a well-designed universe containing millions of procedurally-generated worlds.

No comments:

Post a Comment