Introduction to Procedural Content Generation
Tags: gamedev, games, pcg
Published: 2022-05-24 16:49:16

## Introduction

Several games from the industry make use of Procedural Content Generation (PCG) to generate levels (e.g., Moonlighter), maps (e.g., Minecraft), weapons (e.g., Borderlands franchise), among other types of content. And such a feature interests so much the public that it is highlighted in advertisements for these games. But what is PCG? According to Togelius et al. [1], Procedural Content Generation "is the algorithmic creation of game content with limited or indirect user input." Thus, the creative process of PCG methods can be entirely performed by computers or associated with human designers or gamers [2].

The use of PCG brings several advantages to game developers since it can:
 - decrease the need for human game designers to create content;
 - increase the productivity of these designers;
 - increase the creativity through design suggestions;
 - provide the control of game features (e.g., difficulty balancing);
 - act as a game feature to provide content variety.

The definition of Togelius et al. is good; however, to better understand how PCG methods work, we also need to understand their classifications. Thus, following, I describe the taxonomy of PCG defined by Togelius, Shaker, and Nelson [2]. In addition, a former advisor and I renamed the title of each class to better refer to each one of them [3].


## Taxonomy

#### Content Requirement

Content requirement refers to necessary and optional game content. Content is necessary when it is required to finalize the game, e.g., a key to open a locked door that gives access to a boss room. In contrast, players can ignore the optional content without penalization, e.g., any common coin in a level. Thus, when generating necessary content may require tests to ensure feasibility.

#### Outcome Randomness

Outcome Randomness regards the generated content if it presents or not randomness. Thus, a PCG technique is considered deterministic when it generates the same content for the same parameters. On the other hand, it is stochastic when, given the same parameters, it always generates different content. Although it is not common, it is possible to create deterministic PCG algorithms.

#### Generation Time

Generation Time refers to the moment of the game content generation. The content can be generated before the gameplay, i.e., offline, or during the gameplay, while the player is playing the game, i.e., online. Offline content is the most common in the industry. In contrast, online content generation is mostly applied in Infinite Runner games.

#### Generation Control

Generation Control defines the method regarding its degrees of control provided. Such control is provided basically through parameters that can be composed of a single random seed (a single dimension of control) or by a set of parameters (two or more dimensions of control). For instance, a PCG method can receive the number of locked doors, the number of keys to open these doors, and a list of enemies that may spawn in the level's rooms.

#### Generation Method

The generation method can be carried out in different ways. The most common in the industry is the constructive method; this method generates the content at once in a single execution without checking feasibility. In contrast, generate-and-test methods perform tests to validate the content feasibility, quality, or both. Besides, there are also Machine Learning and Reinforcement Learning-based PCG approaches.

#### Generality

Generality regards the target audience for which the content is generated. Thus, if a PCG method creates content for all players, its generation is generic. On the other hand, when a technique learns the gamers' tastes and uses them to generate targeted content, the approach is performing adaptive generation. For example, Left 4 Dead (Valve Corporation, 2008) adjusts the difficulty of enemies based on the emotional intensity [2]. However, adaptation is not trivial to implement in a game, mainly if multiple contents are involved.

#### Content Authorship

Regarding content authorship, we call a PCG method an automatic generation if the content is generated only by a computer (the user sets only the algorithm's inputs). On the other hand, we classify a tool as mixed authorship when it presents support to human game designers by providing suggestions based on the designer changings. Unfortunately, I do not know if mixed-initiative tools are available in the industry. But there is a very interesting tool being developed by the gamer research group of Malmö University [4]. It is called Evolutionary Dungeon Designer.


## Conclusion

That is it! I hope you learned a bit more of PCG with this post. If you are interested in developing PCG algorithms, check my post: [What do you need to learn to develop robust PCG techniques?](https://dev.to/brenomfviana/what-do-you-need-to-learn-to-develop-robust-pcg-techniques-46gb)


## References

[1] What is procedural content generation? Mario on the borderline (https://doi.org/10.1145/2000919.2000922).
[2] Procedural Content Generation in Games, Introduction, (http://pcgbook.com/wp-content/uploads/chapter01.pdf).
[3] Procedural Dungeon Generation: A Survey (https://doi.org/10.5753/jis.2021.999).
[4] Evolutionary Dungeon Designer (https://games.mau.se/research/eddy/).