Randomness in games

Game designers and developers use randomness in game AI to make the game and characters more realistic and varied by not making the same decision or taking the same action again and again.

Let's take an example of a typical soccer game. One of the rules of a soccer game is to award a direct free kick if one player commits a foul while trying to possess the ball from the opposing team. Now, instead of giving a foul and a free kick all the time whenever that foul happens, the game developer can apply a probability so that the game rewards with a direct freekick only 98 percent of all the fouls. As a result, most of the time, the player gets a direct freekick; but when that remaining two percent happens, it can provide emotional ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.