If you have ever played video games or computer games then you must have encountered with AI (Artificial Intelligence). No matter which game you prefer, whether it is a racing game like Need for Speed, the strategy game like Starcraft, sports game like FIFA or shooting game like Call Of Duty, the element present in these games are controlled by AI. The NPCs (Non-Player Character) in the games such as animals or enemies are AIs, on which we don’t pay much attention to. To understand the Artificial Intelligence For Games, first, we need to understand what Artificial Intelligence actually is.
Artificial Intelligence for Games
As stated in Wikipedia,
“Artificial intelligence (AI, also machine intelligence) is intelligence displayed by machines, in contrast with the natural intelligence (NI) displayed by humans and other animals.
In Computer Science, AI research is defined as the study of “intelligent agents”: any device that perceives its environment and takes actions that maximize its chance of success at some goal.”
It can be sum up in a line as, AI is the way to make a machine think the way human brain thinks to learn, decide and solve a problem.
AlphaGo is one of such computer program that was developed to play board game Go. It was trained by letting it observe and learn the different old Go matches and continuously learns while playing online. It becomes strong and stronger upon being fed more data to it.
In October 2015, it became the first ever computer program to beat a human professional Go player.
AI is not limited to just observe, learn and behave rather it is used by developers to enhance the gaming experience of human players.
In Video games, different algorithms are used to solve a particular problem and make the NPCs in the game behave intelligently. Some of them are Finite State Machine (FSM) algorithm, Monte Carlo Search Tree (MCST) algorithm, A* (A-Star) Search algorithm.
Let us see how these algorithm works and help in a better gaming experience.
Finite State Machine (FSM) Algorithm – Artificial Intelligence for Games
Finite State Machine (FSM) is an algorithm used most widely in games. It was introduced to video games in the 1990s. In this, a designer speculates all the possible situations an AI can encounter in particular and program specific reaction to every action.
In other words, we can say that in FSM, AI will react to the human player’s actions in a particular way because of its predefined program.
We can see examples of this in shooting games where the AI would attack the player when they show up and then retreat when the health level of AI is too low. In a simplified game with FSM AI, the character performs four basic response to the situations which are possible: aid, evade, wander and attack. There are many famous games which use this algorithm for better gaming experience such as Counter-Strike, Call Of Duty, Battlefield and Tomb Raider.
The only drawback of the FSM design is its predictability. After playing for few times, because of pre-programmed behavior, the player might lose the interest.
Monte Carlo Search Tree (MCST) Algorithm – Artificial Intelligence for Games
Monte Carlo Search Tree algorithm is the more advanced algorithm used in video games to enhance the personalized gaming experience. It uses the scheme of using randomized trials to solve a particular problem. The main focus of MCST is on the analysis of the most promising moves, accordingly expanding the search tree based on the random sampling of the search space. This AI algorithm is used in Deep Blue computer program, which was the first computer program to beat a human chess champion in 1997. In every point in the game, Deep Blue would use MCST to consider all the moves it could make, then consider the moves the human player would make in response, then again considering the moves it will make it respond, and so on. You can imagine the sequence of the moves expanding like branches from a stem, reason why it is called “Search Tree”. After repeating the process several times, the AI would calculate the payback and will decide which is the best branch to follow. After making a real move, it will again search for the best branch to follow based on the outcomes that are possible. It calculates the thousands of possible moves and chooses the ones with the best payback.
MCST has been used in many of the recent strategy games. However, there are many possible moves in other games than Chess, MCST starts with choosing some of the possible moves. So, the outcome becomes uncertain for the human player every time. One of the most famous strategy game, Civilization, uses this algorithm to increase the gaming experience of human players. It is a game in which player develops a city in the competition to the AI which is doing the same. It is impossible to predetermine every move for the AI, so rather than taking action based on the current move, MCST AI evaluates some of the possible next moves, calculates the overall payback for every move and opt for whichever is the most valuable. Since in these games the moves are never predetermined, it gives more fresh gaming experience than FSM. One of the most famous strategy game Total War: Rome II uses the MCST AI for a better gaming experience.
A* (A-Star) Search Algorithm – Artificial Intelligence for Games
A* Search algorithm, also known as A-Star Search algorithm, is generally used in pathfinding and graph traversal. It is widely used because of the high rate of performance and accuracy. In sports game like FIFA, this algorithm is used for a better experience of gaming for the human player. This algorithm is used for enabling the pass from one player to another player, to reach a player position. It will help to analyze the proximity of the opposition player and space around them to identify the better passing opportunities. When the human player has the ball, his teammates will understand if you have the chance to make the pass and move accordingly to create the chance for you to pass or to take the shoot. The smarter players and increased activity off the ball give the opportunity to open up the opposition for a better chance in the game. Other sports games like NBL work on the same algorithm.
The future of the Video Games totally depends on the Artificial Intelligence(Artificial Intelligence for Games). With every other day, the technology is developing. In future, the AI will not only focus on making powerful NPCs to defeat human players but to give a better and unique gaming experience to the human players. Virtual Reality (VR) and Augmented Reality (AR) are some examples of the future of gaming. Pokémon Go, one of the most famous games which used AR for amazing gaming experience for its players. It became the first game to combine the video game with the real world. The days are not far away when the combination of VR and AR open world game will give the experience of the real world.