Currently, and sometimes even if we do not realize it, Artificial Intelligence (AI) is present in many areas of everyday life. One example known to all has to do with facial recognition systems, which we find in most smartphones and which process the images taken by the front camera of our devices (sometimes in conjunction with more sensors) to extract information and patterns from our faces and, consequently, unlock access to the device.
Other examples include autonomous driving, which tries to process the information gathered by the car’s cameras and different sensors, such as LIDAR sensors or radars, to steer the car towards its destination taking into account traffic conditions; or virtual assistants, which make use of voice recognition systems to be able to attend to our requests.
However, there is one field in which AI has already been applied quite successfully: video games, due in part to their nature. For example, as we will see below, in the field of reinforcement learning, video games are an area that allows a reward function to be established directly based on the game’s objective. In addition, image processing and procedural content generation techniques can also be applied.
Reinforcement learning in video games
One of the first AIs was Deep Blue, developed by IBM, which competed against the world chess champion Garri Kasparov, beating him and thus marking a milestone in the evolution of this type of systems. Although we can understand Deep Blue as an AI, since we are dealing with a machine that “imitates” human capabilities, we have to travel to 2015 to find another of the most famous, in this case, trained with more modern techniques of machine learning and of which we have already spoken in this blog, which is AlphaGo. Developed by the company DeepMind, it managed to beat the world champion of the traditional game Go, demonstrating a great power to discover new moves and to put one of the masters of this game against the ropes.
Thus, video games are a good ground for testing reinforcement learning, a branch of Artificial Intelligence that consists of training an agent to try to maximize a reward function and, in this way, improve in the performance of its assigned task, which in this case would be to win the game.
Through the technique of exploitation and exploration, which consists of finding a balance between taking actions already known and previously evaluated or exploring new alternatives; as well as with different Deep Reinforcement Learning algorithms, the agent is able to learn based on the experience gathered over a large number of exposures to the environment and the result of the actions carried out on it.
Other cases of similar AIs are OpenAI Five, capable of defeating one of the best players of the video game Dota2, and Agent57, again trained by DeepMind and capable of playing a wide variety of video games of the Atari console, sometimes significantly surpassing the average performance obtained by humans. As a curiosity, in one of the games, Montezuma’s Revenge, the AI obtained results clearly inferior to those of a human, due to the particularities of the levels of this particular game. However, it eventually managed to outperform it in subsequent evolutions.
Online Gambling and the Power of AI
Artificial Intelligence (AI) has significantly impacted the online gambling industry, enhancing user experiences and safety measures. AI algorithms analyze player behavior to offer personalized game recommendations, making the experience more engaging. Additionally, AI helps in identifying potential issues related to responsible gambling and addiction, providing early interventions when needed. It also plays a pivotal role in fraud detection, ensuring fair and secure online gambling. With AI’s integration, the online gambling sector continues to evolve, delivering a safer and more enjoyable gaming environment for all players.
Image processing techniques for video games
Other more “traditional” Machine Learning applications are currently used not only to win a video game, but also to improve the players’ experience and even democratize to some extent the access to limited hardware for users. In this sense, companies such as NVIDIA, a leader in the development of hardware and, in this case, Graphics Processing Units (GPU), use Artificial Intelligence techniques to offer some improvements when playing video games, such as Super Sampling techniques.
This type of image processing techniques start from images rendered by the GPU at a resolution lower than the target resolution and, through the application of machine learning, generate the final frame by inferring from a previously trained model what the target frame should look like. In this way, the GPU is relieved of processing load, since it is computationally lighter to make the inference than to make all the necessary calculations to render the frame, and the final performance and, therefore, the rate of frames capable of being generated by the GPU is increased.
NVIDIA introduced in 2019 its first version of what they called “Deep Learning Super Sampling” or DLSS. This technology consists, in essence, of training a model called auto-encoder. This type of algorithm is made up of two neural networks: the first corresponds to the encoding stage (encoder) and the second to the decoding stage (decoder).
The first network is trained with unlabeled data to achieve an encoding of the input signal, but under certain restrictions that do not allow it to learn the input function directly. These restrictions mainly concern the size of the representation. This means that the dimension of the data once it passes through the encoder is smaller than the original input. On the other hand, the decoder tries to recover the original signal, but after being passed through the encoder.
In this way, both parts of the network make up a tandem in which both blocks manage to obviate the noise at the input and generate an output as faithful as possible to the input. Thus, what is proposed for this DLSS technique is as follows:
- First stage: a first neural network is available that takes as input the current frame and the motion vectors of the game to make a smoothing of the edges and an anti-aliasing.
- Second stage: an image scaling is done from a lower resolution image to reach the final target image.
Intelligence of NPC (Non-Player Characters)
Usually, in a large number of video games, the human faces an Artificial Intelligence converted into what is known as “non-player character” or NPC (Non-Player Character). For example, it is common to play games against the game’s own intelligence in soccer video games. Here, one of the teams is managed by the human, while the other team is artificially controlled by the machine itself. In this case, other more traditional algorithms are used, such as decision trees, a logical representation model of decision making.
With this, the behavior of the NPCs is defined and it is their way of interacting against the instructions provided by the human. Decision trees for use in video games can be replaced by more complex models, but more robust and with a more natural and similar operation to human behavior, such as those allowed by Reinforcement Learning.
At IIC, we regularly use variations of these models. One example is the Random Forest algorithm which, taking these trees as base estimators and based on the principle of aggregation by vote, proposes the training of a set of decision trees. Once trained, the result is taken as the most repeated option by the trees in the case of classification problems and the mean value of the results calculated in the case of regression problems.
Along with the above, the Random Forest algorithm incorporates some techniques to avoid the overfitting problems so common in the world of machine learning. For example, each tree is trained with a subset of the total variables so that not all trees learn based on the same characteristics. At IIC, we frequently use this type of algorithms for the development of predictive models delivered to our clients.
Procedural generation for video games
Finally, there is a field of application of Artificial Intelligence in the area of procedural generation for video games. This process consists of developing a system capable of generating different parts of the game automatically and randomly, such as levels, vegetation, characters, textures or the music itself.
The procedural generation of content is based on establishing a series of rules or procedures that should limit and force the algorithm to behave in a controlled manner, since, in case of providing too much flexibility or freedom, it could lead to impossible or meaningless generations and products. Thus, similar to the operation of the decision trees discussed above, branching and pruning algorithms must be established to control the solutions offered by the algorithm.
Deep Learning models are also used for this procedural generation. Thus, models such as GANs (Generative Adversarial Networks), described in 2014 by Ian Goodfellow, are used, for example, in the generation of new terrains. These models consist of two parts:
- The generator is in charge of producing new “false” images from the data with which it was trained.
- The discriminator tries to discover whether the image generated by the generator is real or false.
Both parties compete in a game-like scenario, so that the generator specializes in creating new images, which must be so good that the discriminator is not able to detect them as false. In this way, a great realism of the new artificially produced and automated objects is achieved. This also opens up a very large world in the production of video games, since it allows to increase the possibilities and entertainment of the games without the need for them to be specifically programmed.
Although the field of procedural generation has been explored for years, one of the most recent video games based primarily on this paradigm is No Man’s Sky, whose content is largely procedurally generated. This game consists of exploring the universe and discovering new planets, galaxies, animals… It is precisely in this part where procedural generation is used: each of the planets, as well as the music, the name of the galaxies, the number of moons or the ships are generated with this technique.
Throughout this article we have seen several uses of Artificial Intelligence in the world of video games. At IIC, we believe that these are a good testing ground, but we also apply the techniques described for training models in other fields such as health, energy or the legal sector, to name a few. Did you know all these uses of Artificial Intelligence in the video game industry?
Table of Contents