PCF309.feat3.opener

This article was published in the November 2015 issue of Maximum PC. For more trusted reviews and feature stories, subscribe here.

How games have learned from art, music, and math—and how the world might learn from games

And on the third day, God made the world. And He saw that it was quite crummy. And He then looked at the other worlds that He’d made, and thought, “They suck a bit, too, infallible as I am.”

So He pondered for silent indefinites, as the void drifted tetchily on, waiting for time, space, gravity, bicycles, and all the other concomitants of virtue and vice. Eventually, He got a bit frustrated. “Balls to it all,” He thought, blasphemously. “handcrafting a universe is for losers. I’ll procedurally generate an infinity of them and just choose the best one.” And lo, that was the morning of the third day, and He saw that it was good. So He went and watched fractal zooms on Youtube for the rest of the week.

As a child, I remember being fascinated by Mandelbrot. I didn’t at that time know what the word meant, except that in the corner of our IT room at school was a single, fast Macintosh SE that the IT teacher treasured and guarded. The only thing he seemed to run on it was a Mandelbrot simulation, which we used to sit and watch over our lunch break. It would take ages to draw each screen as it zoomed in on each part of the structure, which would always reveal more structure and even more complexity. eventually, sometimes, it would repeat.

A Mandelbrot drawing is a representation of a mathematical set—the set of complex numbers that do not tend to infinity; which is to say, equations involving imaginary numbers; which is to say, numbers that
involve the square root of -1. Which is to say… that I didn’t take math past high school and this is really difficult to understand. So I promise there won’t be any more equations in this article. Really.

More interestingly for our purposes is that, whatever else Mandelbrot is, it’s an equation that throws up astounding complexity and beauty without the user having to create anything themselves. Look closely and you can see it features spirals, valleys, seahorses, tentacles, antennae, double-hooks, islands. The mind’s eye sees cityscapes, ships, people holding hands, trees, and organic structures that have never existed. And all this is created from an equation?

Well, only with a computer. Fractal art, like Mandelbrot, mostly exists as an outgrowth of using iterative methods to solve polynomial equations, and that really requires a computer. Looking at generative pieces, it’s hard not to agree that they’re art—but the artist has at most set the parameters for their creation, not handcrafted the piece, or in this case, handsolved the math.

Similarly, "generative music" can be constructed without direct user input. One could also argue that Bach’s fugues were generative, given that they were based on a strict underlying mathematical process out of the control of the creator. There’s even generative writing, which has grown from the "cut-up" techniques of writers such as William Burroughs or Georges Perec, and France’s mechanical-writing oulipo school.

That’s the heart of procedural generation. It’s grown out of math, through art and music, and it’s taking over gaming. Where will it stop?

Few procedurally generated games have had the success of Minecraft, recently bought by Microsoft for $2.5 billion.

“People have always been fascinated with creating unpredictable things by following rules,” explains Michael Cook, an academic who specializes in procedural game design. “Even children’s games where you pass along bits of folded paper and each write part of a story. It’s all about being delighted at something strange coming from nowhere in particular.

“We’ve dreamed of machines that make things for a very long time: Ada Lovelace wondered about machines that could write music long before Alan Turing was even born. I think there’s just something magical about the idea of something coming from nothing, and I still feel that magic each time I work on a new generator!”

A Rogue’s Heart

Cook’s main project, Angelina, is a special case, which we’ll talk about later. But he’s right about our love of the emergent outgrowth of rule structures. “There’s nothing better at following rules than a computer, so it didn’t take long for programmers to give computers recipes for generating complex, beautiful things. Computers let us transform theoretical patterns and ideas into amazing machines with moving parts that could be poked and examined and executed again and again.”

The most standard usage of procedural techniques in modern gaming is in roguelikes and indie games, such as Minecraft, Dwarf Fortress, and NetHack. It’s an area that Nicholas Vining’s Gaslamp Games specializes in, and he’s adamant that it’s essential for certain genres.

“For the games we make,” says Vining, “you have to have procedural generation. Both Clockwork Empires (a steampunk colony builder with a Lovecraftian twist) and Dungeons of Dredmor rely on having a lot of replayability, and a good way to get replayability into a game is to have it change every time. You really want to have random geography and random levels and random stuff being thrown at you.”

PCF309.feat3.dungeons ofdredmor

Roguelike indie game Dungeons of Dredmor has procedurally generated dungeons as well as items.

But why use procedural generation? Surely we’ve got by perfectly well handcrafting them so far? “People want giant experiences, and value for money,” says Vining. “AAA games deal with this by giving them 100 hours of hand-massaged content—Dragon Age: Inquisition is the most recent example—but that doesn’t scale unless you’re making, you know, Dragon Age. (And then you’ll end up probably having to make money by DLC.) Being indies, we have to cheat. And frankly, hand-massaging 100 hours of content is more laborious than it needs to be.”

Vining is also keen to make the game easy to share and non-repetitive—not just for the end user, but to attract the YouTubers who mostly drive a game’s fame today.

“We’re now making games for players who want to also show themselves playing the game, on YouTube, and doing stuff. I think you’re stuck with that nowadays. I think Minecraft did it to us. So, you have to make a game where YouTuber X playing the game can have a completely different experience than YouTuber Y.

“If you look at the stuff that gets put up on large YouTube Channels, it’s things with a creative element, a procedural element, and also Goat Simulator. Procedural content gives you just enough hooks upon which a good storyteller can hang their own hat. I think that’s something that Minecraft either got, or stumbled upon. There’s a certain level of crudity needed where you can then have a child just stick their imagination on it, and have something wonderful happen, and a lot of the people gunning in the same space have never really figured that one out."

Liminal Proceedings

By contrast, Dr. Tom Betts’s motivations are less about speed or fame, and more about interesting outcomes. He started as an arts student. “I was interested in the idea of creating systems that would make art work for me. I’d always been into computers and games so it made sense to combine those interests. I taught myself to program and I’ve been making generative and proc-gensoftware ever since.” He's created art, performed music, and has been the lead programmer at indie games company Big Robot since 2008.

“Working with proc-gen is always a sort of collaboration between the programmer, the program code, and the player. You can’t dictate the outcome as precisely as you can in traditional production methods, and that makes it more interesting. Also, in terms of art and music, generative/proc-gen work has its own sort of aesthetic that comes from its ability to produce large numbers of variations on a theme, all of which are different, but maintain a shared style.”

Several of Dr. Betts’s games have involved procedural generation. Sir, Are You Being Hunted, for example, uses a procedural system to generate all the terrain, housing, flora, and fauna in its open world. “Procedural generation can aid the creation of all kinds of game worlds, especially in the case of large open-world games or anything with roguelike aspects. It can help smaller teams build larger environments and it can automate or assist many of the processes involved in larger studio production pipelines. We'll undoubtedly see the usage of PCG tools and methods grow as games increase in complexity and production cost.”

PCF309.feat3.speedtree2

SpeedTree can generate believable trees and foliage using mathematical formulae. It’s been used in The Witcher 3, Shadow of Mordor, and Far Cry 4, among many others.

Cook has yet another motivation to use procedural generation: the reintroduction of genuine exploration to games. “Minecraft showed an entire generation of gamers how procedurally generated worlds could inspire a sense of discovery, exploration, and awe. There are similar revolutions around the corner for generated game mechanics, generated stories, and so on. It’s incredibly exciting.” Part of that is there can be no walkthrough to a proc-gen world—at most, some recipes and best practice recommendations.

Cook is also interested in the development of aids to game development, which also come under the heading of procedural generation. “There’s a lot of interest in building software that can help people design games, either by learning how humans design, or using a big database of rules. For example, imagine feeding every Team Fortress 2 level into a machine-learning system, and then using that system to evaluate, comment on, and even adjust levels designed by modders.

“The other big thrust is the automation of new areas of game design, moving out of the same old areas like dungeons and levels, and looking into generating other, harder kinds of content. I’m really excited by this move. There are genres out there that we can’t imagine right now because we’re waiting for new generators to come along and show us the way. Last month, at a conference, I saw systems which can generate metaphors, cocktails, dancers, fables, and jokes. I’d love to see all of these things built into games, games that can generate new kinds of content beyond trees and rocks. I want games to write theme songs for my MMO character. I want games to write myths about my epic journey. I want games to procedurally generate me a best friend I can talk to. I want to see new things coming out of our computers.”