Video Game A.I.
Games have evolved over the years, not just in terms of the graphics and design of the environment and characters, which has also seen major improvements, but “gameplay” has evolved such that it’s no longer about simple task and objectives, we now have complex scenarios, intricate missions and elaborate storylines with multiple plots and twists. But the fundamental tool that is driving more immersive and complex gameplay is Artificial Intelligence.
AI in videogames can be traced back to the computerized game of Nim created in 1951 and published in 1952. Notwithstanding being advanced technology in the year it was built, 20 years before Pong, the game took the form of a moderately small box and was able to constantly win games even when facing highly skilled players of the game.
But this is not to say that every video game has an advanced AI embedded in it ready to take down gamers. This is not the case as developers would be very hesitant to create such AI because there is no fun in a game you can not win. This is key and should always be at the back of our minds. Game creators build these AI as a means to enhance the game and add enjoyment and complexity to the gameplay. Usually, video game AIs are broken down into two types but might not both be present in a game. These can be generally known as Director AI and the NPC or Non-Playable Characters.
Director AI: Unlike what most would imagine when we talk about games and AI, here the Director AI is in charge of the in-game development and user progression. Its job is usually to monitor and react to the player’s in-game actions. It has what we might call a big brother overview of the entire stage but does not share this information with the NPC AI. sometimes its job can be something as simple as prepping the next stage and number of enemies to keeping track of your progress in-game other times it might be responsible for creating obstacles that the player has to overcome to clear a given stage.
NPC Then we have the Non-playable characters which most gamers are familiar with. Usually, these are the enemy, the competition or the objective of the game. They act independent of the Director Ai and follow a set of rules created by the developer based on the player’s actions, the environment/stage or both. This is usually not just a single set of instructions that the AI follows but a multilayered approach. One must first determine is the AI is required in a scene, what it’s doing in the background, how it responds to the players varying actions and its objective as related to the gameplay or player. Take for example an AI NPC that randomly moves around on a farm, it has no relationship with the player except to note its existence. It might or might not have a series of actions to perform depending on if the player interacts with it.
Decision tree: This brings us nicely to what is known as the “Decision tree”. In a simple game, both the Director and NPC have a tree-like structure that governs what they do when they do it and how it’s done. There are a series of actions that need to take place for a given action to be achieved. But if we left it just like this, the game would be rather boring and we would be able to predict what we need to do to achieve and exact outcome. Granted, most games do function on this principle and the fun id in finding out the exact sequence of actions needed to achieve the desired goals but AI technologies have made the process far more enjoyable.
Pathfinding and infinite states. Herein comes a few concepts that are known as pathfinding and infinite states. The first called pathfinding is the function of the AI to get from point A to point B in a simple way and it’s used in video games all the time. Whereas, infinite state refers to when an NPC can be in different states yet freely move between them based on what is needed. To have this done smoothly we would need a better way to make decisions and that where neural networks come into play.
Neural Networks: This basically starts off with a certain number of input nodes, which then feed into one or more hidden layers, eventually providing an output. Its whole aim is to allow the game NPC and Director AI to learn without having to have explicit instructions. This makes for more fluid gameplay and larger number of possibilities.
So what next?
If you add up all the above you will start to see a familiar picture. From simple decision making to complex actions and interactions. We are building Video game AIs that respond in similar ways humans would, which would be capable of complex states all with the end goal of being able to have a more fulfilling gaming experience.
1. Simpson, Chris. Behavior Trees for AI: How They Work. 2014
2. Luzgin, Roman. Video Games as a Perfect Playground for Artificial Intelligence. 2018
3. Nick Statt. (2019). HOW ARTIFICIAL INTELLIGENCE WILL REVOLUTIONIZE THE WAY VIDEO GAMES ARE DEVELOPED AND PLAYED. Available: https://www.theverge.com/2019/3/6/18222203/video-game-ai-future-procedural-generation-deep-learning. Last accessed 28/10/2019.
4. Laura E Shummon Maass. (2019). Artificial Intelligence in Video Games. Available: https://towardsdatascience.com/artificial-intelligence-in-video-games-3e2566d59c22. Last accessed 28/10/2019.