Thursday, August 09, 2007

Generative History and Ecologies of Sentient Beings

These days, games are getting larger and larger. Some games have many square miles of terrain and city. Sometimes, this is generated by hand, sometimes, it is largely generated algorithmically.

The problem with these large settings is that they ultimately end up feeling very empty. If there are people in them, they say the same boring non-things that the people in other places say. Also, if generated algorithmically, there's nothing particularly entrancing about the topography of the area, either.

Creating vast amounts of content has become one of the major challenges in modern game design, and most teams try to restrict themselves to well-known kinds of content - graphics, sound, levels, quests. These are expensive, but tools exist to help you create them effectively.

I think that, before too long, we'll have tools for creating other kinds of content, and one of the kinds of content I want to see more of is generative history/ecologies of sentient beings.

Whenever you see ecologies implemented in a game, it means that deer eat grass and wolves eat deer and adventurers eat wolves. It's simply a method for providing content which makes sense and adapts slightly. The adaptation quickly makes wolves either extinct or ubiquitous, but at least it's adaptation.

There are two problems with this approach. First, ecologies are really long-term things, whereas adventures are really short-term things. No adventure should feature the main character exterminating every wolf in the forest. Unless this is a MMOG, that's just insane.

Second, animals aren't very interesting. The difference between encounter wolves in forest A and bears in forest B is pretty minimal, and there's really not much punch to simply changing the number of critters you encounter. Also, unless artificially forced, there's no real balance: a low-level character can easily be attacked by a thirty-strong pack of wolves if your simulation is a bit more realistic.

What's more exciting are sentient beings and the fruits of their labor. These are also a bit more balanced, because the larger a group of sentient beings is, the less likely they are to simply kill off travelers.

The funny thing is that, on the most basic level, sentient beings are just as easy to simulate as flora and fauna. Sentient beings pop up wherever there are resources, just like animals and plants. They are also resources to other sentient beings, just like animals and plants.

Easy example: all people require food.

There is a gold deposit. The gold deposit has value, but miners require food.

There is a verdant valley nearby. People settle there because there is food. They are farmers.

Now miners show up at the gold deposit, and begin to send gold to the farmers in exchange for food.

This is much the same as "Grass grows where it is wet, deer eat grass, wolves eat deer". Except you're building groups of people.

Obviously, you'll want stronger rules that allow for economies, tech, trading, nations, conquest, and so forth. But the AI can be pretty simplistic. You can also have just one race, or multiple sentient races, or whatever.

Walking around in this world might not be any more entertaining, though. It would be busier, but is the difference between a fishing village and a mining town of much interest to the player?

Well, you can certainly add some easy things: the resources a place has to offer is based on what they do and who they trade with. But that's kind of shallow and ultimately uninteresting.

It's better to introduce history.

See, what makes things interesting isn't what's there now, but what used to be there. People aren't simply married. They are married because... they fell in love on a cruise? Their parents arranged it to unite their houses? There was an accidental pregnancy? It's the history of their marriage that makes it more interesting.

Similarly, a city bears its history on every street. This building used to be an opera house, but it went out of business back when this district got hit by that typhoon... this corner is the one where all the coffee shops are, because everyone walks by on their way to and from work...

History generally follows a few basic rules. An aspect can be introduced, grow stronger, or grow weaker. As an aspect changes, it causes at least one other change.

For example, a fishing village is introduced to the gold miners. The gold miners want food, and give gold for food. Gold gets stronger. Because gold gets stronger, something happens.

Maybe food gets stronger: people get into the industry because there is money in it. Maybe food gets weaker: the river is overtaxed and there aren't enough fish. Maybe a new facet is involved: textiles or banking.

This can be random, because any result can be explained with only minimal effort and nobody is going to be looking very closely. But it provides a lot of hooks.

For example, when you talk to someone, they'll be involved in one of the facets, and they'll know the history of the facet. "Well, my family's always been in the textiles industry, but the market is falling off because the gold mines are dwindling... so I'm thinking about being a fisherman. Or maybe going on an adventure."

Cities would grow organically. The docks are all fisherman's docks, but then the city grows and they are replaced largely with commercial freighter docks. You can still see the history of the city, in the layout and remaining fishermen's boats... a layout that is completely different from a city that has commercial docks without having a major fishing industry first. How fast the industry grew will also change the way the docks expanded: more rapid growth means more aggressive, larger, often slipshod construction.

With the right algorithms, this could theoretically automatically build the entire level for you. But in practice, it would still be human built... however, the humans would be able to say, "Okay, this area is mainly a commercial docks area, but there are a lot of old fishermen still around, and the commercial docks are really just kind of tossed up..."

You can keep expanding, of course: international politics, technological development, factions...

It's also easy to do with individuals rather than cities, or scale in the reverse and do it with nations or even planets. The philosophy is the same: you evolve an ecology of sentient beings and have them remember how their ecology/economy has changed over time. NPC 30322 will have something interesting to say, and city 192 will have a unique and sensical situation. You can even fill in-world books with ACTUAL STUFF instead of empty pages.

I don't suggest this is the best way to do things. However, I think it might be a good way to "flesh out" your world. You might say that city 192 is being invaded by Martians and has no standing army. The ecological simulation fills out the rest.

2 comments:

brackish meadows said...

I have to wonder if this'll make good stories the way you want to do it. What I mean to say is, while it'd be awesome to generate cities and people on the fly, I mostly want it for to produce gameplay, not so much for realism.

So what i mean is, rather than design a town from the bottom up, resources first, then groups of people, then trading and politics and such, and go on like that until the player gets there - the town I want to engineer is one that creates situations in which the hero gets to do hero stuff, of the thief gets to do thief stuff, or whatever the game's about. So what I'm getting at is that you should start with conflicts and macguffins and dark pacts, or whatever, and work in reverse, and put in whatever characters the story needs, and put in whatever resources and history that that requires as the player asks for it.

Of course, there come a lot of problems whenever you start making stuff up as you go along, but so long as you keep ahold of whatever story you've told the player so far, you should be able to keep it consistent, or retcon, or whatever else.

Craig Perko said...

Creating a world top-down rather than bottom-up is possible, but has some irritating limitations. I was presuming a combination of the two.

I should whip up something and see how well it works on a computer. Works well on paper, but...