19
\$\begingroup\$

I've been really struggling lately with the difference between dynamically, randomly, and procedurally generated maps/levels, I previously thought they were the same but now I have no clue.

I've seen similar posts with people answering that dynamic generation is content that is "constantly changing", but I have no idea how that works with a map/level in a game. Is the map/level constantly changing, what does that even mean? Are some of these terms used interchangeably?

\$\endgroup\$
2

2 Answers 2

36
\$\begingroup\$

Disclaimer: If true random exists in our reality, and what is the nature of free will are topics beyond this answer. The random I speak about in this answer is pseudo-random (when I say "random" take "pseudo-random" as implied). Also, for the purposes of this answer parameter vectors are also considered seeds.


I found an often quoted in literature "taxonomy of procedural content generation" in the paper "Procedural Content Generation in Games" by Shaker et al. published in 2016. I want to mention they use the terms deterministic and stochastic. However this answer remains my own take on it.


About generation of content (referring in this content to maps, levels and other parts of the design of video games), we can say it can either be:

  • Authored (designed) content: This is content generated by the authors of the game.

    Authored content could use procedural generation tools which provides a result which is later refined by the author. This is known as offline procedural content generation.

    Authored content might be bundled with the game, or be downloadable content.

  • Procedural content: This is content generated by algorithms designed or selected by the authors of the game (there is a procedure that generates the content) during game play, also known as online procedural content generation.

    The tools include pseudo-random number generators, generative grammars, noise functions, cellular automata, fractals, artificial neural networks and so on.

    Procedural content generation can take different approaches:

    • Constructive content generation: The algorithm produces content that is added directly to the output.
    • Generate-and-test content generation: The algorithm has a loop where they produce content until it satisfies some fitness function. If it produces unsatisfactory content, it loops, until it produces satisfactory content.
    • Search-based content generation: The algorithm searches a latent space of possible content that can be generated, using an heuristic, util it finds content that satisfies a fitness function. This is can be considered an special case of generate-and-test content generation.

    The mentioned fitness functions could take the actions of the player into account.

  • User-generated content: This is content provided by the players of the game. This can also be classified as online and offline except this time we are talking about networking. The user-generated content confined to the game or the machine of the player is offline, and if it is shared over the network it is online. And then we can distinguish if the player receives user-generated content as part of normal gameplay, or they must request it.


Also the content could be:

  • Static: It cannot change once generated.
  • Dynamic: It can change during game play.

Authored content is often static. However it can be dynamic if it allows players to modify it (by building or destroying) or there is a automatic system that governs how it changes (either constantly or at specific events).

For example, a game map could have predefined positions for trees. But these trees could be dynamic in that the player can cut them, and there is a system that will make new ones grow.

An example of "constantly changing" dynamic content could be if the trees spread (new trees spawn and grow near where other trees exist). See also city builders where the simulation would constantly build, change or destroy buildings.

Similarly, procedural content could be either static or dynamic. For example, a game could be fully procedural (and random, see below), but offer the player no means to modify the environment, and thus making it static.

User generated content is usually dynamic, because it is content that the players input during game play. The exception would require modifications to the contents of the game while the game is not running (e.g. mods).


Furthermore, the content generation could be:

  • Predetermined※: It is always the same for everybody everywhere.
  • Random (a.k.a pseudo-random or stochastic): It can be different every time. Using pseudo-random number generators, noise functions and similar tools.

※: What I call here Predetermined is often called Deterministic, however "predetermined" seems to be a better term because pseudo-random is deterministic (given the same input it produces the same output).

See On the nature of pseudo-random below.

Authored content is predetermined. Adding a system that makes it different every time would make it procedural content. However, procedural content could be predetermined (e.g. the designers hard-coded the seeds for content generation, so it is always the game).

User-generated content could also be either random or predetermined. However, predetermined user-generated content is more common (e.g. the user creates a custom scenario using an editor, and thus every time that custom scenario is the same).

Note that a common motivation to use procedural content generation is to make random content (which, again, is content that is different every time). Otherwise we would probably author the content. However, another motivation for procedural generation is to make a world much bigger that we could reasonably author (which might result is not very interesting worlds).


I also want to mention that procedural generation could happen ahead of time (i.e. the game generates the world before game play) or just in time (i.e. the game generates the world when needed, a.k.a. on demand content generation). Note that on demand content generation does not imply it random nor dynamic.

However, on demand content generation offers an additional opportunity to make the content generation dynamic (the algorithm could skew what content it generates according to the situation of the player, for example as a means of dynamic difficulty).

In regard to dynamic content, we can also talk about content being persistent or not persistent. Saying that the content is persistent, means that the game will store/remember the changes that happened during game play. Otherwise the changes are lost when the content is unloaded… Which could mean to return to the authored state, or to generate it again (implying on demand content generation). Furthermore, the case of on demand content generation could result in something different being generated (which might be the intention of the designers or not). Notice that persistence is not an issue if the game does not allow you to go back.

We will call content generation that takes the actions of the player into account as adaptive (and thus dynamic), otherwise we would say it is generic.

We could also classify the content generation based on whether or not the content generated is necessary to complete the game, or otherwise it is optional.


On the nature of pseudo-random

First of all, random generation does not mean uniformly random. We can manipulate the randomness distribution towards generating content that we deem interesting, or even decide leave some aspects fully deterministic.


Note that by random content generation depends on seed values that generator takes as input. Given the same seed values, the result would also be the same. Thus, to have an unpredictable results we need seed values that are unknown beforehand and hard to control. Common sources for such values include the current time, CPU performance counters, and microphone noise… Which also have in common that they are always changing. However, if the seed values are controlled (by design or by manipulation) the content generation becomes predictible. This means that pseudo-random is repeatable/reproducible (which is a good thing for testing).

The designers could offer control over the seed values to the player explicitly (there is an UI where they input the seed) or implicitly (where the game derives the seeds from actions that the player performs, but the player is not told these action seed the content generation).

We can also collect fingerprinting data (e.g. user id, network id, hardware id, and so on), and hash it (we can also use HMAC or key derivation functions) to produce a seed value. In this case the content generation will be quasi-unique for the player (baring collisions). This allows us to provide content generation that is always the same for the same player, but different depending on the player.


Be aware that common random number generators and noise functions will eventually loop (avoiding this would make the cost of generating steadily increase, which is not desirable)※. As mitigation we can re-seed the generator, and depending on the generator this could be noticeable by the user.

※: This might not be a problem for small games. Be aware that games that generate huge worlds might also need to deal problems caused by floating point errors and overflows. And, of course, other optimizations relevant to huge worlds beyond this question.

Furthermore, random number generators are sequential, and thus the order in which the generated numbers are used will affect the outcome. This have some notable consequences:

  • Different versions of a software that use the generated numbers in different ways will yield different outputs from the same seeds.
  • If there are actions that the user can do that use random numbers, then the actions of the user change the generation going forth.
  • This opens a common vector to manipulate the generation by the players: exhaust the generated numbers (by repeating an action that use them) until the generator is in a desirable state.

On the other hand generation based on noise functions would not be vulnerable to this kind of manipulation because unlike pseudo-random number generators, noise functions are not sequential.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Deterministic means it's always the same given the same input. If you ask the user for a sequence of 10 arbitrary characters and deterministically generate based on that, the characters and therefore result may be different every time, but the same characters would always produce the same result. But the line is a bit blurry, given that the above is just (pseudo-)random generation with a user-specified seed. \$\endgroup\$
    – NotThatGuy
    Commented Oct 10, 2022 at 8:39
  • 1
    \$\begingroup\$ "Thus random here does not mean uniformly random" \$\endgroup\$
    – Caleth
    Commented Oct 10, 2022 at 10:32
  • 2
    \$\begingroup\$ I believe your section on randomness vs determinism needs some clarification: there's a lot of games (Minecraft and Transport Fever 2 come to mind) which have deterministic random map generation. It is pseudo-random, but given the same inputs will generate (nearly? not familiar enough with Minecraft) the same contents. \$\endgroup\$
    – jaskij
    Commented Oct 10, 2022 at 12:03
  • 1
    \$\begingroup\$ For minecraft for a given version of the game, and a given seed, will generate the same world. The engine relies on this in multiple places to generate smooth transitions between generation chunks, as its all algorithmically derived from pseudorandom mathematical functions. \$\endgroup\$ Commented Oct 10, 2022 at 14:07
  • 2
    \$\begingroup\$ I think it's worth mentioning that in addition to being pre-determined or random, generated content can also be contingent. That is, an algorithm generates content based on information that is not known until runtime (so it's not always the same - not predetermined), but is not random or pseudo-random (statistically unpredictable). Some examples I've seen are games using the name the player chose for their character or save file, or their history of gameplay decisions as input to the generator. That makes the content distinct for each playthough, but in a predictable way. \$\endgroup\$
    – DMGregory
    Commented Oct 10, 2022 at 22:25
2
\$\begingroup\$

They all mean the same thing, more or less. Dynamic is a little spiffier, but not by much.

An easy way to say the player gets different maps on replays is saying maps are random. Of course, any decent random map generation has rules plus randomness; such as the old dungeons with 5-8 rooms placed randomly (with no overlaps and so on). You might describe that as a procedure with randomness as part of it -- "procedural" for short. Obviously, a better procedure will give better maps. As players got more sophisticated, and saw more simple, boring random levels (it's a field with 3-4 short walls that can be anywhere!), they started to figure this stuff out. Saying "procedurally generated levels" was a better marketing term.

In programming, dynamic means the procedure remembers and responds to history. In the case of game levels, the history is previous levels (or really, anything -- like how often the player died). Maybe the chance of a merchant appearing is 5% + 10% per level without a merchant. Maybe the new level type (forest, swamp, plains ... ) depends on the previous level types. You might have random bosses, but each has a boss-chain -- if you roll "mummy boss" the player gets the next type of mummy they haven't killed yet.

That last one feels dynamic in the common sense -- what's been killed stays dead; your actions changed the world. The others are dynamic in the programming sense. Which is the real meaning? Who can say? And how dynamic counts as dynamic? What about not getting a special level if the previous one was? What about only giving scrolls of spells they can learn? Every random level generation system probably has something that technically counts as dynamic. Put another way, "dynamic" means "created using an in-game process, with some dice-rolling, and also not just based on the level # -- also looking at some things that happened previously".

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .