Monday, 14 January 2008

The Death of the Level Designer: Procedural Content Generation in Games - Part Two

(You probably want to start with part one of this article).

4. Instancing of in-game entities

Most games hide the enemies faces. This is a natural consequence of the fact that humans naturally look at faces to distinguish individuals, and designing or video capturing a new face for each potential enemy in a game can be a long and exhausting process. Consider a game engine that is automatically capable of generating a large number of faces based on a set number of parameters. This possibility is used to great effect in various MMORPGs such as Eve Online, where it is important to distinguish players from each other. Procedural content generation would be the next logical step - where each enemies face is randomly assembled by picking a random value from the allowed range. You'd end up with good looking and ugly individuals - mostly ugly if the random face selector in Oblivion is indicative of the results.

But this is not just limited to individual faces. The Massive program used by Weta in Lord of the Rings does the same for whole orcs, elves and other races. Again, individuals are selected from a base design template that is then varied from one to the next. When will we see this technology in-game? Well if Project Offset is anything to go by, soon. The first sneak peek video released showed a large number of instanced goblinoids of various shapes and sizes getting shot by a crossbow and turned to ice within real time in the game engine (The fact this video is now no longer available on their site does not bode well for this feature).

Any why stop at goblins? Borderlands has instanced guns - apparently close to 500,000 different types of them, as well as other equipment types. By combining instanced guns and enemies, you ensure a virtually unique stream of opponents for the player to encounter. This can also be used to cut down on the total art assets required for the game. If you have different in-game statistics for small, medium and large individuals, you can increase the number of potential encounter types - much like World of Warcraft does with it's cookie cutter but with different paint mobs.

5. User mediated content

You can go one step further than SpeedTree, and instance all the game vegetation, so you'll never run into the same tree twice. This particular example is useful for two reasons: firstly, it's often used in first year comp sci courses to demonstrate fractals and procedural techniques, but also because Stanford are now offering a user guided procedural content generation system called Dryad to assist people in exploring the possibilities of virtual worlds. Dryad allows you not just to create trees, but it serves as a template for all possible trees, and guides you towards 'high-quality' trees within that space, based on other user choices.

This mechanic is very similar in concept to that used in Spore. Rather than directly exploring the procedural content options by using random selections, both Dryad and Spore provide the same procedural frameworks of a PCG to allow user generated content to be rapidly created without deep technical know how. The face composite selection mentioned earlier that MMORPGs use is a similar mechanic. These rely on the user's perception of beauty or interest to guide procedural selections.

This process is extremely powerful. Google uses the ESP Game to label images for search using this kind of distributed intelligence. The concept of "Games with A Purpose" is the ongoing academic project based on the ideas of Louis Van Ahn, who noticed that games can be a great motivating force for otherwise repetitive and uninteresting activities. The concept of user generated content when combined with PCG allows the created content to be tuned by intelligent feedback, compensating for the main weakness of PCG in that human intelligence is only indirectly in control of what is produced. The players in effect become the censors of what are appropriate and inappropriate choices (The issue of censorship and procedurally generated content vis-a-vis a procedural hot coffee is another great topic - one I've briefly touched on before).

6. Dynamic systems

S.T.A.L.K.E.R.: Shadow of Chernobyl provides the best modern example of the variety that a dynamic AI system can provide in a static game environment. It's A-life system procedurally creates enemies in previously vacated areas, and ensures that no two encounters, even after a reload of a saved game, will ever proceed in quite the same fashion. Oblivion promised a similar revolution with it's Radiant AI system, but the majority of the dynamism was scaled back to prevent a rapid depopulation of Cyrodiil - a problem that suited the atmosphere of S.T.A.L.K.E.R. more than a fantasy world.

To call dynamic AI a procedural content generation system may feel slightly revisionist - but the elements of unpredictability through a range of possible options fit the scope of what procedural content generation delivers. More importantly, it imparts the same benefits and problems. A dynamic AI system allows the developer to cut down on time required to develop step by step AI scripting and allows them to focus more on the high level goals. But at the same time the system must be robust enough to cope with the game-space and handle the same contingencies that plague PCG based systems. A S.T.A.L.K.E.R. developer's diary highlights the issues they experienced tuning the A life system.

Other dynamic systems in game, such as weather and music are also being explored. Brian Eno is producing procedurally generated in-game music for Spore, and other games have used dynamic changes in music based on the player circumstances to great effect. Dynamic weather and a day/night cycle are starting to feature in games, such as Crysis, which again perturb the possible in-game states by providing a significant unpredictability to any encounter.

Facade is an experimental game which provides another dynamic system which is procedurally controlled - that of conversation. The individual snippets of conversation are not procedurally generated, but the ordering and topic transitions are controlled; and human language is flexible and context dependent enough that listeners will often fill in additional meaning to randomly adjacent phrases, particularly when cued by previous attitudes. Facade occurs within a limited space, and an emotionally charged scene, to try to emphasize these cues, and has yet to see a wider adoption of the same processes.

Speech synthesis and natural language generation are nearing levels of sophistication to be used in computer games. Note that natural language comprehension is more difficult - the best that can be delivered at the moment are heavily context dependent deciphering, or as contextual cues. But a game is a controlled enough a domain where both of these techniques may be useful.

7. Procedural puzzles and plot-generation

Many game plots are little more than dependency graphs, which a sequence of actions must be performed in a particular order. At the simplest level, procedural content generation can be used to change the door codes and other individual puzzle elements to prevent a user from getting the information off of a game FAQ website or other source of information. And as Raph Koster points out in a article delicately titled "You Are All Cheaters", the use of these out of game information repositories are game-breaking in that they stop the game being played in the way it was intended. Similarly, puzzles can be extended by making multiple parts of the dependency graph randomly placed (e.g. moving the key that opens the door to a random accessible location).

But procedural generation can do more than just make puzzles harder to solve. It can potentially give an infinite number of ways of solving a puzzle. This is an important point. In one way, failure within a game can be construed as consuming a certain amount of game content (A point I'll discuss in more detail in another article). Procedural generation of content ensures that there is an infinite amount of content to be consumed. In most games, "if at first you don't succeed, you fail", as GlaDoS puts it succinctly. But games like Rogue, which have the harshest penalty for failure - restarting the game - the fact that no two games play the same way makes the real cost for failure virtually zero. If you die in Rogue, you don't have to repeat the identical game elements in the way that you would if you fell off of a platform near the end of a level in Mario, or just before a check point in Halo.

This is even more important for games that have a fixed narrative. Narrative is consumed in a game much the same way as content. Having different multiple endings is a way of extending the narrative so that it is worthwhile playing at least twice. But why have multiple endings? Why not have multiple beginnings? Why not make every single plot point significantly different from game to game? Procedural generation of plots is a way of extending the life-time of a game significantly beyond that of a single play through. [Edit: It sounds like this complexity of plot branching features in Mass Effect, but in a non-procedural manner].

By making plots dynamic, choices will take on real significance. Suddenly no individual (except the player) is indispensable. Conversation trees will take on real meaning, where it is truly possible to offend or impress anyone. The threat of death will hang over any NPC - and the necessity of resetting the game in certain non-failure states will hopefully be lessened (although the negative reviews of Fire Emblem suggest otherwise. Maybe it is a natural human need to not want to lose anything of value you have invested time in). The dynamic AI director in Left4Dead suggests that pacing, another important game element, is amenable to procedural techniques.

In part three, I'll look at what ways I suspect PCG will be used in the future.


Andrew Doull said...

My apologies if this looks like turning into a 'cool shit I want to link to article'.

Kamineko said...

Nonsense! This is very enjoyable. I thoroughly insist you link to more cool shit.

llq said...

I agree with many points. But in some areas, I feel we need to be more aggressive. Just my opinion. Love ya. alissa milano Christian Louboutin Shoes Mother Of Bride