When, decades ago, the greatest exponents of science fiction began to write about artificial intelligence, they certainly did not imagine a scenario like the one today.
In fact, for the various Asimovs, Dick and Bradbury, artificial intelligence was a theme mainly linked to machinery capable of evolving and opposing their human creators, introducing themes variously taken up also in cinematographic works such as Blade Runner, Terminator and 2001 Odyssey in the Space.
It is probably from this vision that today's double vision regarding artificial intelligence derives: on the one hand a potential risk, as envisioned in the works that are now part of popular culture whose echo continues to be always present, and on the other, a resource that is now well established in daily life.
The applications of AI systems, in fact, today are particularly numerous and involve innumerable contexts; one in particular, used frequently, is that of the videogame. In videogaming, artificial intelligence embraces a wide spectrum of situations, from bot animations to a real learning path: not surprisingly, significant artificial intelligence applications appear precisely in the context of various games and video games.
One of the first contexts to which it can look is that relating to the behavior of bots and characters not controlled by the player, o NPC from the English acronym for Non-Player Characters, within various video games. If the protagonist "follows" the gamer's commands, any NPC instead needs to behave in a manner predicted in advance by the software. The first solutions in this sense were based on scripts, with animations and behaviors reproduced by a code upon the occurrence of a certain event often linked to the gamer: a perfectly functional but quite limited gimmick, such as to generate often unexpected results at the expense of the experience of game.
It is therefore inevitable that this need should be tried to respond by applying AI algorithms: it is not unusual today to find NPC opponents and allies who hold certain behaviors in relation to each other, to the environment in which they find themselves and above all to the actions of the protagonist, thus showing a different level of interaction, and its evolution, with the gamer and with the game world. In short, a different level of intelligence.

On the other hand, as mentioned, the world of games and video games has always been a privileged field for tests on artificial intelligence: it is difficult to think of a better context to test the simulation of the behavior of a human opponent.
The case of chess is emblematic with Deep Blue, the supercomputer designed by IBM specifically to compete with a human champion of the discipline: in 1996 Garry Kasparov was the first world chess champion to be defeated by a computer, an event that marked one of the many firsts of his career.
Chess continues today to be a field of particular interest for artificial intelligence, reaching the point of simulating human behavior including errors, but not for this they represent the boundary of the latter: in the case of poker, for example, the most advanced AIs can offer challenges that have nothing to envy compared to comparisons with a human player.
Starting from the knowledge of the value of handsin fact, it is possible to challenge each other in conditions of perfect equality with artificial intelligences developed with exactly the same information, guaranteeing a balanced challenge and often indistinguishable from that against a human.

Finally, do not underestimate the fact that there are video games that are born expressly by implementing artificial intelligence algorithms in the gameplay, which thus enters the title as the protagonist: an example for all is Hello Neighbor, a 2017 title developed by Dynamic Pixels.
The player is required to break into the neighbor's house in order to find out what secret he is hiding and the latter, taking on the role of the antagonist, will do everything to prevent it.
To achieve his goal, the protagonist is left with maximum freedom: he can choose to enter through a door, a window, stairs and so on. But the antagonist, thanks to the dedicated AI algorithm, is able to remember the paths chosen by the player and react accordingly: if on one occasion the protagonist has passed through a window, the next time you can be sure that the neighbor will have taken action and placed a trap, a camera and so on in the area, making the gameplay constantly evolve.
Despite the many problematic aspects on the side, the title on is still distinguished precisely by its AI: a certainly significant result.