Quantcast
Channel: YouChew
Viewing all articles
Browse latest Browse all 151

Game Design 101: Random Generation

$
0
0
Random generation has seen a rise in prominence in recent years. Many games are implementing it in both small and large ways; Minecraft randomly generated an entire map to explore, Skyrim has a system to take generic quests and randomly chooses a dungeon to set them in, and other games, like Dungeon Crawl Stone Soup, Faster Than Light, and Rogue Legacy, are all roguelikes that revolve around randomly generated maps, events, upgrades, and content. It shows up elsewhere in smaller, subtler, more unseen ways – a flickering torch sprite in a dungeon may change the chances of an encounter with every frame.

However, despite the usefulness of random number generation, it is important, once again, to know when to use it and when not to use it. An over-reliance on RNG can hurt a game in a number of ways, and though it is rarely ever enough to cause the game to become bad outright, it can cause a player to spend less time playing it than it would have seen otherwise. Like most pieces of game design, it is a fine balancing act that needs to be used carefully and tested rigorously.

Terraria is a good example of both RNG done well and also RNG done poorly.

Terraria could be described as a side-scrolling version of Minecraft, and it also implements elements of a Metroid- or Castlevania-style game, emphasizing exploration and finding equipment and item upgrades more than Minecraft's slower-paced micromanagement. The world is randomly generated, as are the items found inside chests and other things. Unlike Minecraft, the random generation is more controlled: maps can be small, medium or large in size, and all biomes in the game will be generated in a map, no matter what size. There will always be a jungle and underground jungle, there will always be snowfields and ice caves, there will always be patches of Corruption or Crimson that you need to purify. And there will always be a dungeon.

This sort of controlled, yet still random, generation, is a perfect fit for Terraria's exploration-heavy gameplay, as it always means that you will be able to get every material you might want or need, as well as always having chests in every biome so the chances of finding special items are always there. You will never need to make a new map just to find ice caverns, since there will always be some. And since the biomes, even on a small map, are still fairly large, the possibility of chests not containing an item you might want is low as well. And even if, say, a dungeon chest doesn't contain the Muramasa, it is entirely possible just to create another quick map, go to the new dungeon and look through it instead, since it will always be there.

Posted Image
With dungeons that are normally this big, you're more likely to find at least one of every dungeon drop than not!

Where the game drops the ball is when a player fulfills the conditions to enable a map's Hardmode. In Hardmode, new ores can be found and used to craft weapons and armor that are stronger than the endgame equipment in non-Hardmode, but the majority of useful items must be made using other items that are randomly obtained from killed enemies. Many of these items are uncommon or rarely dropped, which means that a player may have to grind specific enemies over and over until they obtain the item.

This is where the luck aspect of RNG really comes into play, and that luck is the reason Terraria somewhat falls flat at this point. Map generation is always semi-controlled, and finding items is fairly forgiving; it's unlikely to have a map that doesn't contain even one Enchanted Boomerang. With drops from enemies, it becomes a matter of pure chance; a player might obtain a Beam Sword after killing ten or fifteen skeletons, or they might spend hours and hours in the underground caves, smashing skeleton after skeleton, and still won't have gotten one. This is already bad, but it can become much worse since the enemies themselves are randomly generated. Sharks are a random spawn in the ocean biome, and have a rare, 1% drop used to craft a water accessory, for example.

Posted Image
You'd better be ready to take a nice, long dip in the drink if you really want that diving helmet.

The ironic thing about this is that while a player's equipment strength becomes tied to random enemy drops during Hardmode, both the normal and Hardmode bosses provide a nice example of a compromise. All three Hardmode bosses, for example, have a guaranteed drop: souls of some type (Fright, Might and Sight), Hallowed ingots to craft mid-to-endgame equipment, and healing potions. The random generation comes in when it comes to the amount of each. The Twins, for example, drop anywhere from 20 to 40 Souls of Sight, 5 to 15 healing potions, and 15 to 30 ingots.

This means that collecting enough souls or ingots to craft everything you might want simply becomes a matter of preparation for the boss battle and getting more skilled at dodging their attacks and patterns. Since you'll be able to collect enough items to upgrade a little bit with each battle, it also becomes easier to fight the bosses the more you fight them. 15 Hallowed ingots is enough to create a Hallowed sword, spear, or bow, and still have some leftovers, meaning a single boss fight provides enough to make any of the three weapons. There is still randomness involved, you may need to fight the bosses more than a couple times to be able to get enough souls or ingots to craft everything you want, but there's never a point where you won't get at least some items from the boss, which means you'll always make some progress.

Other games do benefit more from a completely randomized setup of RNG, though, which is important to note. Dungeon Crawl, for example, randomizes the layout of all its dungeon floors with each new game, randomizes the loot, the shops, so on and so forth, and the reason this works well is because most games are going to be very short. It's a roguelike, and it's very easy to end up dying before even getting to the fifth or tenth floor, even moreso if you run into one of the miniboss-style enemies roaming around, like the infamous Sigmund.

Crawl's sense of progression is tied to the RNG, like Terraria's Hardmode progression, but Crawl's is a bit more subtle. With Crawl, anytime a character dies, your game immediately ends and you have to start from scratch, but only the character starts from scratch. Any new experiences, information, items, or enemies the player encountered with the previous character, the player themselves remembers, helping them to learn the ins and outs of the game and grow more accustomed to what it has going on and what it can do.

Posted Image
Crawl also limits the enemies that can follow you up or down stairs, so getting in over your head isn't quite as potentially game-ending.

Let's say that you're on floor six, a demon pops up in a corridor, and you try to fight it, only to find out that you barely do any damage, and it just teleports you to the Abyss after a few attempts, leading to your character's death. Your character dies and the game ends, but you yourself have learned to avoid demons until you're a much higher level, a lesson you'd never have learned had the RNG not decided to spawn a demon. This sort of RNG only works because the game was so short, you only reached floor six. If that sort of RNG was used in Terraria, then the game would be much more frustrating. Randomly running into a demon on the surface and dying, possibly losing money or all your items in the process, would discourage players from exploring for fear of running into an overpowered demon again.

With all this said, here are some things to keep in mind when it comes to implementing random generation in a videogame:
  • What is your game going to be built around? If you want to create a multiplayer game focused around players competing against each other, what kind of RNG will work best with your plans, if at all?
  • When you've found an area of a game where you want to implement RNG, will it work better under a set of parameters, or under a more freeform system? What are the benefits and faults of each option?
  • If the game you're developing is going to use random generation to create terrain, how will you design the terrain to keep things fresh for players? Little details are often lost in the usage of RNG due to its nature, especially in certain genres, so how will you work around or past the limitations it brings?

Viewing all articles
Browse latest Browse all 151

Trending Articles