Sponsored By

MIGS 2007: Flagship's Thompson On Finding Agility In The Random

At the 2007 Montreal Games Summit, Flagship Studios director of technology Tyler Thompson discussed how using data-driven algorithms instead of "hard-coding" can offer developers more flexibility and control, with lessons from his experience with the _D

November 30, 2007

9 Min Read

Author: by Mathew Kumar, Leigh Alexander

Polishing and balancing a modern game requires quick iteration while dealing with a mountain of data, and this is especially true for role-playing games. At the 2007 Montreal Games Summit, Flagship Studios director of technology Tyler Thompson discussed how using data-driven algorithms instead of "hard-coding" can help, empowering developers with more flexibility and control. Over 10 years ago, Thompson worked with Blizzard North on random level generation, skills, combat, pathing and monster AI in Diablo, and was the project lead for Diablo 2: Lord of Destruction. Using Flagship's Hellgate: London as a case-in-point, Thompson's talk covered the design and programming challenges of using random levels, items, and monsters. "All RPGs are a little random," Thompson began, explaining, "You can’t imagine a bunch of guys getting together to play D&D without using dice." As almost every RPG uses some basics, such as random damage ranges on items/spells/skills, or random selection of item drops, it's worth asking -- why do players like it? "First, it kind of fits into a gambling mentality," said Thompson. "Random combat is similar to craps or roulette, where you take your chance and see what happens. Randomness can create excitement -- a weak character could randomly manage to beat a much stronger character, and vice versa." The downside? Said Thompson, "Too much randomness can be frustrating - if even the lowliest zombie could kill a level 50 character with a critical hit, that’s not fun." Random item drops, he explained, are more like a slot machine – wherein every, say, 3 or 4 seconds, the player has a chance to get lucky. "This is a very important part of slot machines. I remember reading that somewhere, maybe Denmark, the government discussed for something like 10 hours if the gap between pulls should be three and a half seconds or six seconds," continued Thompson. "Now, the drive in a slot machine is for ‘the big win’ -- but a lot of things we do include the 'almost win,'" Thompson said. "If you see on a slot machine that the big win is 7777, and you get three sevens and half of a seven, you still get excited and it drives you to continue.” He described how in Hellgate: London, players can find “legendary” items which contain multiple random (and good) attributes. Getting one could be a big win if it suits the player's character well, or an “almost win” -- it doesn’t, but the player still got a legendary item. He went on to argue that randomness gives a unique experience: “You can tell stories to your friends, because they won’t have experienced things in exactly the same way, and if your items are random and unique, you will take a greater pride in them." Another reason is replayability, not only allowing but encouraging the player to play the game over and over again, to gain a different perspective and experience each time. Game Grammar Asked Thompson, "If there are all these reasons why randomness is good, why don’t we see it everywhere?" For one thing, he continued, randomness removes an element of control from the designers. "You’re not scripting the whole level – the whole experience," he explained. "It requires a different strategy for game development, and therefore people think that it is too hard – but it certainly isn’t easy." Thompson's next topic -- pulled from a hat -- was game grammar. Meaning what? "A set of symbols that are governed by a set of rules," explained Thompson. "And you can apply those rules, one at a time, in any order, for any number of iterations." He described how developers can use a “grammar” to make a level. Starting with a template – for example, an entrance room, a hallway, and an end room, the next step is to invent some rules. For example, one could extend the hallway, or replace the end room with a treasure room, or change the hallway into a crossroads. Simply applying the rules one at a time, in any order, for any number of iterations, creates a level. Moreover, continued Thompson, "There are a couple of things you can do to make the algorithm and the method better." One way is to use sets of rules to perform different tasks: One set creates the ‘flow,' one set adds required rooms, and another set replaces generic rooms with specific rooms. Advised Thompson, "Make it all data-driven so that artists can create templates, rules and replacements. This is how we did it in Hellgate.” Random Items Random items can come in a random selection, with random quality and random properties, Thompson explained, as he moved to the next topic plucked from his hat. “There is a direct way of doing it, which you’ve probably seen in most games," he explained. "A list of possible items for each monster to drop. So if you’ve killed a wolf he can drop a paw, a tooth, some meat and so on. But there’s a lot of hard-coded data there." On the other hand, Thompson explained the indirect way: "Make a list of all of the items in the game, assign a level to each item, and match up item levels with monster levels.” Finally, there's Thompson's "hybrid way": "Each monster specifies a treasure set, and each treasure set includes a weighted list with one of several things: a specific item, a type of item - populated at runtime from the list of all items - and another treasure set. Said Thompson, "This is kind of the way we select the items in general.” Next, Thompson discussed creating items with Random properties. "First, invent some properties," he said. "For example, 'kindled' -- which gives extra fire damage for weapons -- and specify rules for the property. Required item levels, item types, random weight, and so on.” There are quality levels to random items in Hellgate: London, as Thompson explained. "Normal," or a generic item with inherent properties; "enhanced," an item with two extra properties; "rare" items, which have three extra properties; "legendary," which can have up to five extra properties, and "unique", which can have any of several pre-made properties. Said Thompson, "We did a similar thing in Diablo and we found it very effective.” Random Level Generation “When I talked about grammar I talked about making levels, but what does it really mean to make random levels? How do you actually do it?" Thompson asked, moving on to the next topic plucked fittingly at random from his hat. Said Thompson, "Well, it really does have a lot of advantages for you. You can adjust the level size with, essentially, little more than a spreadsheet change. That’s not a luxury we’re used to in the video game industry, where you expect to have to go to an artist and a designer and ask them to do a lot of work." He continued, "Similarly, adding new level content is pretty quick! If your artists and designers just keep adding new puzzle pieces to construct the levels, the levels get bigger and more interesting as you go. And when it comes to scheduling your project, as long as your team keeps producing new puzzle pieces, that’s all they really need to do." It does, however, make some things harder -- for example, lighting and culling. Explained Thompson, "Indoors is easy, as you can just create portals between the rooms, but outdoors is very hard, as you don’t even know what can be seen from where when you construct the level at runtime." "Random level generation does require your artists to buy into it," he added. "Constructing the levels is completely different – as if they’re making Lego pieces of a level, not the levels themselves. And the lighting and culling aspects can make it extra challenging for them.” The Picker Thompson set the audience a task: given a list of items with random weights, write some code to randomly select an item. He demonstrated: "The slow way is to add up the total weight of the items, roll a dice with that many sides, step through the items in the array and subtract from the die roll to find which item you selected." But there’s a faster way, Thompson continued: Turn it into a search. "Store the required die rolls as you add items to the list. And this is easy to do -- as programmers, writing searches is one of our favorite things to do. And when you make it easy, programmers will use it." Random Monsters Picking out the hat's last topic, Thompson moved on to discuss random monsters. "The monsters we use in Hellgate and Diablo are random in a lot of ways. They’re random in placement, selection, and in their properties.” As to monster placement, Thompson said, "It’s a challenging thing to you, as you’re saying you’re not going to place your monsters in cupboards or do other interesting things with them – you’re saying that you trust randomness to create enough interesting situations for the players, which we think they do." He continued, "If you know where they can stand, you know where they can spawn, but don’t simply sprinkle them. Have settings for density, clustering of similar monsters, and a maximum number.Allow specific monsters to be placed when necessary, because designers will want some of that control.” When it comes to selecting monsters, Thompson advised, “Create some meaning between groups of monsters and the levels that they go in." As an example, he continued, "We put the imps and the imp shaman in the same level as the zombies, as the imp shaman works as a good boss, the imps work as a good middle-level enemy and the zombie a good low-level enemy. You should have the flexibility o decide which levels monsters appear in." How Does This Affect Development? This approach, said Thompson, is "more programmer-centric – it increases code complexity in favor of decreasing the total data and increasing data flexibility. There’s less hard-coded level design data; it allows for some really big and sweeping changes.” He described the changes on the first patch of Hellgate – chancing the levels from a mix all the way through the game into a deeper progression from maintenance rooms in act one, to sewers in act two and so on -- a change that took once person two days simply by changing some spreadsheets. He noted that QA is much harder, though: "Testing matrices can get very large, and when few things are deterministic, many bugs are hard to repeat," he said. "There are some strategies for dealing, such as using a random level ‘seed’ so you can reload a random level using the seed again." But there are some more positives -- for one, as Thompson pointed out, adjusting scope gets easier. "It is easy to keep adding more content until you run out of time," he said. Concluded Thompson, "If you use these techniques, you are going to find that much of your development is going to go much easier and faster, and allow you to adapt and change your title more quickly."

Read more about:

2007
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like