Random encounters can be traced back to Dungeons & Dragons tabletop games in the 1970s, when random encounters were decided with a dice roll by the game master. Since then, random encounters have been used in a wide variety of video games (especially role playing games). Popularized by games such as Dragon Quest and Final Fantasy, random encounters are designed to increase the challenge of the game, improve players' characters, and sometimes even gain rarer items and equipment.
Most random encounters are programmed to only occur in places such as forests, caves, or swamp areas, i.e. the areas where it is easier for monsters to "hide." In open areas such as plains, random encounters are much more likely to occur. These type of battles also most commonly occur between objectives, such as in the overworld map or in a dungeon. While a large majority of random encounters are negative in the sense that they trigger enemies, some games have positive random encounters (e.g. friendly characters who will possibly sell the player items).
Possibility of a Random Encounter
There are a few methods to deciding a random encounter. The first is an algorithm where X is given a number between 0 and 99. If the number is less than another preset number, then a random encounter occurs. This method is typically criticized because it has a larger possibility of repeated random encounters. Another method is assigning X a number between 64 and 255 and then subtracting another preset number from X until it is less than or equal to zero (at which point, the random encounter occurs). This helps to prevent a constant flood of random encounters.
Random encounters are much less popular in modern role playing games. They are seen as lazy game design, needlessly disruptive, and in many places makes the game very (arguably unfairly) difficult, or just cause the game to be irritating to play. Randomly triggered encounters also trigger load times in games that use optical disc media such as CDs and DVDs, due to the game having to load the enemies on the spot for each individual encounter. In addition, many random encounters in earlier role playing games are easily tripped up by using a trick (such as opening the pause menu, saving, etc), and random encounters can be largely avoided.
Some games are infamous for their terrible usage of random encounters. The original Mother on the Nintendo Entertainment System is the hardest in the Mother franchise due to its excessive usage of random encounters. In fact, the game is so difficult that Starmen.net, Mother series superfans, released an easytype patch designed to lessen random encounters and boost EXP and money gained from each battle. Drakkhen on the Super Nintendo Entertainment System is particularly notable in its usage of random encounters. While standing still, random encounters are still possible, and as random encounters occur enemies got exceedingly difficult.
Since the decline in popularity, role playing games have employed a variety of other methods other than a random encounter. Many role playing games, instead of having and infinite number of random encounters, opted to have a set number of random encounters that occurs in each area. Games such as Chrono Trigger have enemies that are visible, instead of invisible, and thus can be avoided if the player so chooses.
The Pokémon franchise of role playing games has a unique method of dealing with random encounters. While random encounters are also random in that which Pokémon encountered is also random, there are repelling items that allow the player to move around unheeded for a short time. The inverse is also true, with many games containing an item to boost random encounters. This serves to help players when seeking for a rare item drop or players trying to boost experience.
A few lesser known independent games have a unique approach to random encounters. Breath of Death VII: The Beginning has a preset amount of random encounters per area (whereas the overworld will have hundreds of random encounters, a small cave may only have a dozen). Once this number is depleted, there are no more random encounters in that area. This is the same in its sequel, Cthulhu Saves the World. In Bonded Realities, another independent role-playing game, there is actually an ability which allows players to turn off random encounters.
Action RPG's recommended method of dealing with enemies, such as Secret of Mana, is battling them on-field rather having transitions from the overworld to the battle screen.