Monday, 15 March 2010

The problem with randomness in computer games

As a fairly avid Flash game player, sometimes I come to think that the random() function is one of the great curses the programming languages has thrown on the gaming world.

See, Flash games are very often not done by professionals. So, among the many games you'll play, you'll come across a lot of games with clunky controls, bad design decisions, stupid gameplay and so on and on. Honestly, I think bad graphics and bad music are entirely forgivable, because the amount of HORRIBLE designing and development I've seen compensates for all the bad art out there. And many of my gripes seem to converge towards one thing: many designers don't understand how randomness works.

I should say: I'm talking as a PLAYER, not as an actual game developer. Even though I am a professional programmer and a student of Computer Science, the only time I've come to write a full-fledged computer game was for a college assignment. I often have ideas for games, but with the time, the skill and the tools I have, they're basically impossible to make. However, I understand the basic concepts reasonably well, and that's enough to see that some people should take a few lessons before they go out making games.

Get this: randomness is dangerous. In fact, it's so dangerous that pseudo-randomness is STILL dangerous enough (remember that computers are incapable of generating truly random numbers -- it at best APPROXIMATES such thing). Sometimes, games rely entirely on it in order to make things happen. However, depending on the nature of the game, this can make almost unplayable. For example, if a game drops power-ups that play a very important role on the player's performance, randomness can ruin things: one match can be extremely easy, since the player gets many useful power-ups, while the next one becomes damn near impossible, since they just never come. Or, for example, if the arrival of enemies is exaggeratedly randomised, they can make the game inexpicably hard, or even lead the player into situations where death is unavoidable. I've once played a game called Balance Balls 2, a game where the player must keep a red ball balanced on a moving platform, while other balls (some with power up/downs) fall onto it. The player can tilt the platform left that right, to get rid of the enemy balls, but the strength is limited, so once one of the sides become too heavy, the platform inevitably falls. Can you see the problem there? Yes: there are times when an absurd number of balls fall EXACTLY on the same spot, leading into an unavoidable death.

So what's the matter with that? Simple: it removes the challenge. A game like that becomes a simple matter of trial and error, of waiting for THE right opportunity to succeed. The player realises it's not his ability that determines the outcome of the game, but pure chance. So, why bother trying?

On the other hand, I'm not saying that randomness SHOULD NOT be used. Randomness is usually desired, or even necessary, to make the game work. But it seems many developers work with the idea that if the game is not COMPLETELY random and chance-based, it becomes "too easy", because predictability spoils the game.

Besides, does predictability spoil the game? Not necessarily. Again, it all depends on the nature of the game. For example, if the game uses dice, or a similar artefact to decide certain outcomes, then the dice NEED to be as random as possible, to avoid giving someone an unfair advantage. But in solo games, or in games of skill, the player NEEDS to have some sort of solid ground. Randomness doesn't need to be extinguished: it needs to be CONTROLLED. The challenge is in determining how controlled it must be, but there needs to be rules for how much the game can vary. When the game catches the player by surprise, it must be a reasonable surprise. It WON'T KILL the game if you downplay randomness a little bit; in fact, chances are that it will improve it.