Play with Randomness

Jul 21, 2012

Today I want to talk about the usefulness of randomness – just some of the various ways that random numbers in our gameplay can improve the game, how it plays, or change and affect how communicate things to the player.

One of the uses of randomness in gameplay is in artificial intelligence: in giving the enemies some reason to do something that’s not strictly deterministic, as opposed to always doing something one way or another based on some condition like the player’s position, occasionally introducing a random number in there.

An easy distinction for this is if we look at the artificial intelligence in the original Pac-Man compared to the artificial intelligence in Ms Pac-Man. See in Pac-Man, the ghosts move in a certain way based on the player’s position on the screen. Players can use this to their advantage in memorizing patterns, specific patterns, for how to win the game, avoiding all the ghosts, getting all the pills. In some of the harder patterns, that are actually pretty tricky to pull off, you can actually eat every ghost with every pellet – by following the same steps that have been done before. They will always produce the same AI movements from the same player movements.

When something has no randomness in it, the player can learn to manipulate it, or can practice it and not have to understand how to juke, how to dodge, and how to adapt on the fly.

One of the key features that changed between Pac-Man and Ms. Pac-Man, that not a lot of people think about, is that in Ms. Pac-Man the artificial intelligence has some randomness to it. Consequently you can’t just memorize a pattern, you have to learn techniques for how to avoid the ghosts and how to adapt to different situations – how to exploit weaknesses in their AI (there’s a technique called “grouping”). This makes the player’s experience one of learning, basically, how to play the game, as opposed to being able to memorize a linear set of steps or instructions based on someone else’s finding what worked.

Randomness obviously is also really useful in visual spectacle. Part of what we love about fireworks, or part of what we love about explosions in games, is the unpredictability of where the debris will fly.

I want to address the usefulness of randomized inaccuracy in weapons in games. The automatic guns, or even pistols, in first person shooters and third-person action games, typically they have some random drift. Each shot you fire will have a little bit of left to right randomization, and a little bit of up and down randomization. Really it’s firing within a cone with some probability distribution. What makes that randomness interesting to the gameplay is actually the same thing that makes a shotgun so common in a first-person shooter.

The shotgun mechanic: the shotgun fires its pellets in a cone. The cone size is almost always exaggerated for a videogame, of course a real shotgun doesn’t spread too terribly much, but in a game they always give it a big cone. So let’s say there’s seven pellets. Each of those pellets only does 1/7 of the damage of the full shot. If you get up close to an enemy, you can guarantee you’re going to hit them with every one of those pellets and do a whole lot of damage. The further you get away from them, the lower the chance is that each pellet is going to hit them, and the less damage on average you’re going to cause the enemy.

With the shotgun from a farther distance, you’re more likely to hit them a little bit, because of the cone, because of the spray, but you’re less likely to do full damage than if you’re up close. That leads to a risk/reward relationship: you have to get up in the enemy’s face, making yourself an easier target, and they may also have spray weapons that makes them more dangerous to you up close… if you want to make that power shot of every pellet into the enemy.

Now, what machineguns and automatic weapons do is they basically extend that shotgun blast – those seven shots – over say a couple of a seconds. Then you have the same effect of covering a cone of area, each one doing a smaller amount of damage. The closer you are the more likely you are to get every bullet into the target. The farther away you are, the more likely you are to hit them, you’ll hit them somewhere in that cone but you’re less likely to hit them every time.

It creates a risk/reward tradeoff.

The automatic gun takes what the shotgun did in an instant and spreads it across over time making it granular. You could stop firing at any point. “How long do you expose yourself to the enemy?” “how long do you stay out from cover?” as well as “how long do you have to keep your sights trained on an enemy while dodging?” all become factors that enhance the player’s options and control in assessing their situations. Randomization plays a role in how various weapons play.

Randomization can also be used as a source of fear. One of the things that makes zombies scary in a game like Resident Evil 4 is that they will unpredictably stagger, then slow down, then speed up… this makes it so that the player can’t assess which zombie is the greatest threat. If all zombies moved at a constant speed, then you could just shoot the closest one, then the closest one, then the closest one. In that case there’s no need to second guess your decisions, just your execution, because you know the optimum algorithm there is to just shoot the closest zombie. The closest one is always the next one that can get to you.

But as soon as they start to stagger their speeds, stumbling and slowing down and speeding up, then you have a whole mob to contend with where any given one of them could be the first one to get to you. You’re constantly second guessing whether you’re making the right choices of which ones to shoot, as you’re retreating while firing. In this way, unpredictability can be a source of fear, and an important element in how zombies work.

That was something I experimented with back in one of my early InteractionArtist prototypes: Dark Place, in which I tried to recreate some of the ways that zombie game dynamics work, using just dots in a simple Flash game to show the importance of line of sight, and shotgun spread, and enemy staggering.

Randomizing the amount of health that an enemy has, or conversely, slightly randomizing the amount of damage done per shot is also an element in that horror. If you know exactly how much damage it takes and how to apply that damage to defeat a zombie, say in old Resident Evil, you can just tag them in the head a fixed number of times and know that will kill the zombie. It takes a lot of the fear out of it, because you can become a master of that scenario. There’s no uncertainty as a zombie approaches you that “I can kill him in time because I know what I’m doing, I’ll shoot him in the head a certain number of times and he’ll drop.

But if there’s some randomization, either in the inaccuracy of the weapon so there’s a chance you’ll miss, or in the amount of damage applied, or in the amount of damage necessary for that target to be defeated, then there’s a constant uncertainty of maybe it will reach me in time, before I have a chance to stop it.

Randomness in loot drops works a lot like a Skinner Box. It maintains an elevated sense of anticipation. A Skinner Box, in case you haven’t seen these in previous entries when I’ve linked to it, is this idea from B. F. Skinner, a psychologist who had trained pigeons and rats in psychological experiments. What he found was that when you gave an animal a consistent reward for each action – if you have a lever, and food drops in every time you touch the lever, or every three pushes of the lever food comes out for the animal, then they’ll only get as much food as they need. But if there’s a randomization, if how many times you have to push the switch to get food to come out is inconsistent, they will sort of develop an addiction to it. They’ll keep pumping away at it because each time they push, that could be the time that they get their food pellet.

Randomization of loot drops plays a little bit of a similar role. Every time you’re defeating an enemy there’s a chance you’re going to get something. Within some range it could be something really exciting. It’s not like you’ve got this grueling task of, “go defeat 100 enemies, come back and I’ll give you a reward,” it’s like “go defeat enemies until something really great is given to you,” and any one of those enemies could be the one. It’s another place in which randomization plays a role in keeping the player playing.

In playing Kid Icarus Uprising on Nintendo 3DS, every time you play a multiplayer match (or I guess much of the time, maybe not every time) there is a random award given to someone who is playing. Up front at the beginning of the match you find out what the reward is. If you stay until the end of the match, there’s a chance you’ll receive it. It doesn’t matter if you did great during the round or if you did poorly during the round. You might wind up with this great weapon or this great power-up to use in later matches and in single player. This motivates people to stick around through the match, because there’s a chance they’ll get it, without having to give them something constantly, without making it a known quantity that they can just hang out and always get.

It also adds to a sense of, you know, so I’m on a lunch break, maybe if I fit in a quick multiplayer round I’ll come away with another item or power-up. It’s the randomized loot drop system but at a whole different meta level: something playing the game might win you something.

Randomization in assigning start and respawn locations, in a deathmatch map, helps prevent the gameplay from getting monotonous, from players sort of running the same gambit over and over. It maintains fairness in an otherwise asymmetric map. Because, you could build a map which is completely symmetrical, in which every player starts in extremely equal footing, just by mirroring the architecture, but if you want a more dynamic space, where each area has its own benefits and disadvantages, and different weapons work with different levels of effectiveness depending on where you are in the map, then randomizing that spawn position adds to both the unpredictability of where the opponent is coming from, and also randomizes who gets the upper hand at any given time during the match in terms of where they started.

If we look at a game like Super Smash Brothers, there’s randomness in the power-ups that are dropped for players. They periodically drop in these crazy power-ups: baseball bats, laser guns, exploding things, all kinds of Pokemon, land mines, it really runs the full spectrum. Some of them are extremely effective, but what the power-ups do to that game is they help make it more accessible. A less capable player playing against one or more far more capable players will periodically and unpredictably get the upper hand in terms of power. That enables them to still have these moments and memories they can feel good about during the match, where they temporarily had the upper hand on someone else even though really, if it was a level playing field, they would just get stomped all the time by certain players. So randomness can also help us with accessibility.

Since I study pinball, randomness is also close to my heart in what we call a Galton box. It looks like a pachinko board, and when you drop balls down it from the top, you get a binomial distribution of balls at the bottom. Effectively what happens is, in a very pure pachinko board type situation, how often the ball will fall left or right when it hits the pin is roughly random. It’s roughly as likely to fall left as it is to fall right. This adds to our sense of anticipation in an old game like bagatelle where you’re shooting balls up the table, and for a couple of seconds you’re watching the ball roll back down and knock off into the targets. Or you can think of this in pachinko, where as it falls down the board you’re eager to see where it goes, and you keep thinking and guessing where it’s going to go, and you’re constantly reassessing your guess because it goes a different direction that you thought. It makes us pay attention to it in a way that, if it was highly predictable, we wouldn’t have that same constant updating of expectations as we watch and as we keep hoping it will go the direction for us. In this way, randomization can help sustain our anticipation.

I wrote a paper for Dr. Michael Nitsche’s class about Dr. Doak’s placement in Facility for GoldenEye 007 on Nintendo 64. In James Bond’s world, there’s a mission where he’s supposed to try to find a double agent in the enemy base. Most levels have consistent placement for every objective: there’s a certain place to go to hit a switch or to destroy a thing or to find an object. But in this case Dr. Doak is at one of a number of locations spread throughout the level where he might be found. Every time the player plays it, even if he has practiced that level, even if she is an expert at the game, you still have to go into search mode to figure out where he is and to adapt your play to keep enough health so in case you can’t find him where you think he is, you still have a chance to look for him elsewhere in the level. They do the same thing with finding the flight recorder black box, which flies from the helicopter in Statue level.

Left 4 Dead does a similar thing with weapon placements. There are a number of places where weapons may show up in the level, but whether or not the weapons are there is semi-randomized to prevent the players from counting on getting certain weapons at certain points. It adds to that stress and strain of being in a world of unpredictable, post-apocalyptic zombie attacks, where you can’t really count on resources. It helps you feel relieved when you find them. And so randomness can be used to force the player to explore, rather than learning through memorization.

We also see this in Minecraft, where the worlds are randomized. As a consequence to this you can’t just rely on a strategy guide or a web search or a forum discussion, to find out where to go next. You’re always on the edge of discovery. You’re always having to look for yourself and find out for yourself, playing your own experience based on a world there that no one else could have told you about in advance. That’s something that only randomness gives us. Otherwise in a lot of MMOs or single-player games with very precisely defined and static spaces, every time you play you’re playing the same thing someone else has played, and you can find the things they found if you follow their instructions. So randomness can also help the player a sense of exploration or a sense of adventure.

Randomization is also a way to create unique experiences. In Minecraft in addition to the fact that you have to explore on your own, there is always a chance in that game that you will see something that no one else has ever seen before and be able to share it with them first. Or you may see a landmass that is structured in a very inspiring way, leading you to build something on it. That’s just something that, without the randomization, you’d all be competing with finding the same locations and building on the same places.

Randomization can serve all kinds of useful purposes in your games: to create risk/reward relationships, or to maintain certain feelings of adventure, or exploration, or uncertainty, or simply forcing the player to play the game in a way that they have to be able to adapt. Play with randomness in different ways. Pay attention to how it’s being used in the games that you enjoy, and think about whether it’s got a place in the game that you’re currently working on.



Learn and practice team game development with Gamkedo Club.
Membership worldwide. Professional support. Proven process.




Subscribe by e-mail to receive weekly updates with Gamkedo.Community interviews and YouTube training videos for game developers!



Leave a comment

Comments Form
  • Your email will not be used for any purpose other than to update you in replies to your comments. Your website address will be shown as a link from your name with your comment. Your profile photo is auto-magically provided by Gravatar.

All contents Copyright ©2017 Chris DeLeon.

Site production by Ryan Burrell.