When it comes to replaying a game, no player wants to play the same level again exactly as it was the first time they played it. When you know what to expect, the game becomes too predictable. That’s why it’s important to add randomness to your game.
Looking for a reason to make your game more random? Look no further than the player. Randomness not only adds replay value, but gives players the variable of chance to contend with. When chance comes into play, gamers feel that a certain bit of the game comes down to luck. Now too much randomness can make a game seem unfair, but add the right amount, and it makes the player feel the triumph of getting just the right powerup or upgrade that keeps them playing for a little while longer.
Here are a couple ways to make your game more random:
- Random enemy spawn points. Don’t always have the enemies on the same part of the screen. Use random() to change up their _x or _y values when they are spawned.
- Random power-ups. Make the power-ups spawn at random points on the screen, but also make them spawn at random times. Don’t make it so predictable that a player can come to rely on knowing when a power-up will appear.
- Random variables. This one covers a wide range of categories, but generally any variable that determines a value can be randomized. For example, you can give a player a random speed of 5-10 in a racing game or randomize the attack damage of a character in a fighting game. As long as you don’t set the range to large, it will make the game seem more realistic.
Want to know how to add the random() code to your game? Check out my Code Bits article on random().