Implementing a simple goblin name generator
In the previous section, we explained that the primary purpose of PCG is to provide variety while removing from the developer the burden of scripting such variety by hand. So, imagine that we are developing an old-school RPG, and we want the players to be able to interact with the NPC characters of a goblin encampment.
In the encampment, there are hundreds of goblins, and we really want to avoid coming up with the name and the occupation of every one of them. Not only because it's boring and time-consuming, but if we're going to have random encounters with goblins in the game world, we need to have the ability to create new goblins on the fly.
Fortunately, we have a more fun (for us) solution: to write an algorithm generating a huge number of random goblin characters.
Generating goblin names
In order to generate something, we need to find some kind of generative rule. To find such a rule, the best thing is to look at...