Procedural Generation Vs Hard Coded – Week 9-10

This week we were told to read an article talking about procedural generation in games and discuss what procedural generation is and its applications.

So first what is “Procedural Generation”?

“In video games, it is used to automatically create large amounts of content in a game. Depending on the implementation, advantages of procedural generation can include smaller file sizes, larger amounts of content, and randomness for less predictable gameplay.

Essentially this means that instead of the developer having the map out every single level and landscape, the game will develop what is needed somewhat randomly after the game is run. Now this process isn’t completely random. It does have a procedure. Hence the name “Procedural”. These procedures will define how content fits together in the game world. For example. Enemy spawns in Diablo 3. If these were completely random a lvl 3 player could encounter a lvl 20 enemy in the generated dungeons. This of course would unbalance the game.

Its Applications

Lets keep talking about Diablo 3 to keep things simple. In D3, procedural generation would be used to design and place the dungeons the player can enter. After entering it would then design the enemy spawns and loot drops from said enemies. It would also be used to designate the players daily bounties after you finish the game. If something has a somewhat randomness to it, it is generally procedural generated. Other games and examples would include

  • Minecraft – The terrain and village placement
  • Borderlands Series – Weapon Drops
  • Diablo, Enter The Gungeon, City of Brass – Map and loot is generated

I’m sure you can think of many more.

Methods of Generation

I would put the methods into two categories

First we have the good ol’ “Complete Randomness”. Now this doesn’t sound too bad. Every play through will be super different. You can get awesome loot and its fun and chaotic. Sounds fun on paper. But if a game is completely randomly generated we will definitely see some issues. Lets imagine a simple dungeon crawler. You walk into a new room and the game generates the room.

  • How big is the room?
  • How many enemies?
  • Any treasure? Traps?

These are just some things the game has to think about. The problem with random generation is that we could get a giant room with a single weak goblin or a tiny room that crams 10 boss lvl enemies into it. The goblin could drop the best weapon in the game and the bosses could drop nothing at all. This is the problems with random generation. Its too chaotic and unpredictable. The player will become frustrated as one level is too easy and the next impossible.

The next and more balanced method is called Guided Generation. This would mean the game still applies some form of randomness within limits. Good examples of this would be Diablo 3 as said before. Back to talking about our player entering the room. Now the room will:

  • Place a random amount of enemies within maybe 2 to 3 lvls of the player
  • Compare room size to those enemies or vice versa
  • Reward the player with loot depending on the enemies killed

This is a much more balanced system for the player and will make the game a lot more stable and fun.

Seeds and Set Pieces

Some games use what we call seeds and set pieces to help balance out the game. First lets talk about Seeds

Seeds are a code we can place in that tells the Random Number Generator what sequence it should place everything in. Look at Minecraft. One of the biggest parts of making a new world in the “world seed”. Some players will of course just enter random words or numbers but this seed actually tells the game to put everything in a certain place. Now I am probably explaining this awfully but this means that if 2 people enter the same seed in the world generator then they will both be spawned in identical worlds. This is a way for players to replay an experience they really enjoyed.

Minecraft New World Menu – See Seed Center Right

Now of course certain things will still be randomly generated. Things like enemy spawns etc but all the minerals, villages and more will be placed in the same spot every time.

Now lets talk about set pieces. Set pieces are content that are pre-generated by the developer or game. Back to Diablo 3, the game is heavily played in procedural generated dungeons etc but what about the narrative boss fights. These boss fights are set pieces. Set pieces are essential for narrative plot points and story elements. We don’t want to be fighting the final boss of the game early or be fighting a chicken in his place.

Final Boss – Diablo 3

Overall Procedural Generation is an amazing process and tool for game development. It gives a game immense replay ability and can save developers a lot of work. I know a lot of the games I’ve enjoyed over my life use this method.

Thanks Again

-T.S

Leave a comment