This post was written by guest author Matthew Ericksen
When it comes to video games, there are two fundamental coding styles each with their pros and cons. The style that is most often used in video games is to hard code every element of a video game. This makes a very stable gaming environment that can be modified and perfected so that, come release time, the game has very detailed content that has been painstakingly created for the player by teams of creators. This is a tried and true method of video game creation that gives the creators complete control over every aspect of the game. The only problem with this method is that it takes a great deal of man power to create every aspect of a video game by hand.
Procedural generation, the other style of game creation, has the advantage of not needing such a large team of developers. Procedural generation is a coding style that is the near opposite of hard coding, it uses a set of instructions to create an object. An example where this would be particularly useful in a video game is a forest: A modeler could go and make a variety of tree models and then have a level designer meticulously place these and eventually a forest would be created, on the other hand, the modeler could make a variety of tree branches and trunks then a programmer could go in and code roughly how these branches should be placed on a tree and roughly how far apart the trees should be and then when the program is run an infinitely large forest could be created. Obviously this is very advantageous as the effort-to-content ratio is much higher and therefore less time and effort is spent creating any of the in game content. Unfortunately some of the detail is lost, but overall this can be an extremely useful tool.
Procedural generation originated in 1958 when Benoit Mandelbrot, a young mathematician, was doing research on several unrelated topics including galaxy clusters, the stock market, and the river level of the Nile, etc. What he realized when he was doing this was that these “unrelated” topics actually did have something in common, they all had to do with statically irregularities and could be mathematically recreated. In 1975 Mandlebrot used the word “fractal” to describe this concept: a fractal is a seemingly basic shape, a triangle for instance, that when repeated following some pattern creates a very intricate pattern.Using patterns and mathematics to create an image laid down the basis for what would become procedural generation.
Procedural generation was first introduced into video games roughly 20 years ago by a group of people known as the demoscene. Gaining prominence during the 16/13-bit era of gaming, demoscene used procedural generation to create intros that showed off their programming competency, they would attach these intros to games that they cracked and they soon came to be known as “cracktros”. This technology quickly made its way into video games: due to limited hardware space it was necessary to make a way to create lots of content as space efficiently as possible. After a while, though, procedural generation faded out of practice because the amount of data that could be stored for video games improved so much it wasn’t necessary any longer. At this time procedural generation took a back seat until about 1998 when it was used by Diablo to randomly create the dungeons that were used by the player, this made it so that each play-through would be a unique experience. Although the argument can be made that Elder Scrolls II: Daggerfall was the first to reintroduce it, coming out 2 years earlier, I feel that Diablo is a better example due to its much greater popularity.
With the rise of Diablo there was a renewed interest in procedural generation. Procedural generation was used a great deal in Diablo. Not only was it used to create random maps but it also was used to randomly spawn enemies, items, enemy’s drops, and items that were received from treasure chests. The idea of using procedural generation to randomly drop items was passed on to many other games because of its ability to make each game have a slightly different feel to it. In one play-through the player may find a very expensive or powerful item after they defeat the boss and on the second time through the game they find that the item is not there but they had found a different rare item earlier, this not only makes each play-through different but also makes it so that each individual person has a slightly different game than their friends.
Video game developer Gearbox takes this a step further with their game Borderlands, not only are the items randomly dropped by enemies and chests, but the randomly dropped items are randomly generated. Different power levels, ammo clip sizes, status effects, outer appearance, and weapon types are all combined together to create a game with nearly 18 million different weapons. Even if each of those weapons took 1 second to model and program it would still take roughly 200 days of non-stop work to make all of them, not to mention how much space would be required to hold all of the information.
Left 4 Dead and Left 4 Dead 2 are good examples of other ways that procedural generation can be used to create in game content. In the Left 4 Dead series, procedural generation is used to give the game explicit control over the environment that is being played through. This is all made possible by an artificial intelligence created by Valve Software called the Director, Director constantly analyzes the flow of the game and maintains control over all of the elements in it so that things like ammo and health are only given out when it is needed. The Director software also can control the frequency and ferocity of enemies so that the game is always at the skill level of the player. All of this is taken to the extreme in Maxis’ evolution adventure Spore, where the player is given an entire Galaxy to visit with an entire galaxy’s worth of planets, the amount of time it would take to create the landscape, size, resources, native species, and types of suns would take a near infinite amount of time. Spore is a good example of a game that uses procedural generation for a lot of the game, everything in the game can be procedurally generated including the music, the AI difficulty, the environment, and the variety of creatures not to mention the animations that everything used to move around (11). This high level of procedural generation is a very possible step into the future of gaming.
Procedural generation is a good step towards what can conceivably be called the future of gaming. With Left 4 Dead, the AI can control the difficulty of the enemies and even possibly open up different routes for the players to take. This can obviously be expanded to make it so that things like difficulty levels no longer exist, procedurally controlled AI’s can be used to make it so that every game matches the strength of the gamer and so no game is too hard and or unapproachable for a player. With Spore there was the complete control of content using procedural generation, so you are never playing an exactly identical game to the one that you played previously. Games like Spore and Borderlands make it so that there is a near if not infinite amount of content available to the player. The argument however, against procedural generation is that if the computer is controlling and creating every aspect of the game (procedural generation can be used even to create story lines), then the games might not be very interesting. This is true, for computers are many things but one thing they are not is creative, but that is the beauty of procedural generation, it can be used to create some of the game leaving the important aspects to the creator.
Take for example, the leap of faith from Assassin’s Creed, an algorithm can be made to randomly throw these areas all over the city, but what if the creator wants to add a particular chase scene that ends with the player navigating to a leap of faith that lands them in the exact middle of the plaza? All of these events could technically be procedurally generated but the amount of work that would take far outweighs the effort it would take to just do it by hand.
One opportunity for procedurally generated content in video games is cities, it is very possible that it has never actually been done. The odd thing about this is that cities can and have been procedurally generated, it happens all the time for city planning, just not in games. There are various other things that have not been utilized in games that very well could employ procedurally generated content, and this is what I see for the future of video games, a wonderful blend of procedurally generated content and “handmade” content. This would help combat the rising cost of video games because it would decrease the need for gigantic teams of artists and modelers. By allowing the computer to do all the heavy creation of non-essential content and leave the creation of all the important ares to the actual level designers. This could conceivably allow a huge boost in game quality because no time is wasted making anything not essential to the game, therefore all of the production time could be used to create all of the important elements theoretically increasing their quality.