Draft:Wiki/Artificial intelligence in video games

Procedural content generation:
Procedural content generation (PCG) is an AI technique to autonomously create ingame content through algorithms with minimal input from designers. PCG is typically used to dynamically generate game features such as levels, NPC dialogue, and sounds. Developers input specific paramters to guide the algorithms into making content for them. PCG offers numerous advantages from both a developmental and player experience standpoint. Game studios are able to spend less money on artists and save time on production. Players are given a fresh, highly replayable experience as the game generates new content each time they play. PCG allows game content to adapt in real time to the player's actions.

Procedurally generated levels:
Generative algorithms (a rudimentary form of AI) have been used for level creation for decades. The iconic 1980 dungeon crawler computer game Rogue is a foundational example. Players are tasked with descending through the increasingly difficult levels of a dungeon to retrieve the Amulet of Yendor. The dungeon levels are algorithmically generated at the start of each game. The save file is deleted every time the player dies. The algorithmic dungeon generation creates unique gameplay that would not otherwise be there as the goal of retrieving the amulet is the same each time.

Opinions on total level generation as seen in games like Rogue can vary. Some developers can be sceptical of the quality of generated content and desire to create a world with a more "human" feel so they will use PCG more sparingly. Consequently, they will only use PCG to generate specific components of an otherwise handcrafted level. A notable example of this is Ubisoft's 2017 tactical shooter Tom Clancy's Ghost Recon Wildlands. Developer's used a pathfinding algorithm trained with a data set of real maps to create road networks that would weave through handcrafted villages within the game world. This is an intelligent use of PCG as the AI would have a large amount of real world data to work with and roads are straightforward to create. However, the AI would likely miss nuances and subtleties if it was tasked with creating a village where people live.

As AI has become more advanced, developer goals are shifting to create massive repositories of levels from data sets. In 2023, researchers from New York University and the University of the Witwatersrand trained a large language model to generate levels in the style of the 1981 puzzle game Sokoban. They found that the model excelled at generating levels with specifically requested characteristics such as difficulty level or layout. However, current models such as the one used in the study require large datasets of levels to be effective. They concluded that, while promising, the high data cost of large language models currently outweigh the benefits for this application. Continued advancements in the field will likely lead to more mainstream use in the future.

Procedurally generated music and sound:
The musical score of a video game is an important expression of the emotional tone of a scene to the player. Sound effects such as the noise of a weapon hitting an enemy help indicate the effect of the player's actions. Generating these in real time creates an engaging expereience for the player because the game is more responsive to their input. An example is the 2013 adventure game Proteus where an algorithm dynamically adapts the music based on the angle the player is viewing the ingame landscape from.

Recent breakthroughs in AI have resulted in the creation of advanced tools that are capable of creating music and sound based on evolving factors with minimal developer input. One such example is the MetaComposure music generator. MetaComposure is an evolutionary algorithm designed to generate original music compositions during real time gameplay to match the current mood of the environment. The algorithm is able to to assess the current mood of the game state through "mood tagging". Research indicates that that there is a significant positive statistical correlation regarding player rated game engagement and the dynamically generated musical compositions when they accurately match their current emotions.