AMT Lab @ CMU

View Original

How AI Is Used in Video Games: The Sims 4 and Red Dead Redemption 2

Written by Jai Ta

introduction

Artificial intelligence (AI) has been fundamental since the 1950s in game design and development, but a subset of AI called generative artificial intelligence (GenAI) is now deployed in nearly all video games to create clever, responsive, or adaptive behaviors. Typical AI is commonly used to generate behavior in non-playable characters (NPCs) or new environments while GenAI adds more new use cases for game mechanics in the earlier phases of game development.

GenAI is the use of machine learning techniques to create original content, such as images, text, and music, as the user or developer continues to feed it vast amounts of data to expand its knowledge. Large datasets train GenAI algorithms so they may learn to emulate structures and patterns and can then be applied to produce new information with a style or structure that is comparable to the original data. A large language model (LLM) called a Generative Pretrained Transformer (GPT) uses deep machine learning to output human-like text, making it eerily impossible to distinguish between what is human and what is not.

Usage of GenAI is widely used today by gamers and students and its technology is a literal game-changer for the industry and society. Platforms like ChatGPT and Midjourney are assisting in game design and storylines, streamlining the process of game development that would traditionally take longer. The most popular game engine in the market today, Unity, has recently announced it aims to open a GenAI marketplace for game developers, primarily using the AI solution to offer personalized scenarios based on player input.

To further understand the implementation of AI solutions in video games and their usage, this paper takes into consideration two different genres of video games. It will take a closer look at the application of AI in each game design and development and how those decisions translate to the end user. A comparative case analysis between The Sims 4 and Red Dead Redemption 2 will show the overlapping similarities between a life-simulation game and an action-adventure game and their distinguishing contrasts.

The Sims 4

Image via Playstation.com

The Sims, a popular life simulation game, was released by Electronic Arts in 2000. Players in The Sims create and control virtual avatars, who they guide through many life phases and activities in the game, including the construction of houses, upkeep of relationships, the pursuit of occupations, and satisfaction of physiological demands like food and cleanliness. Players may alter the environment their Sims live in as well as their looks, personality, and conduct. The Sims have had several expansion packs, spin-offs, and sequels developed, making it one of the most popular and influential video game series of all time.

GenAI

GenAI plays a pivotal role in The Sims franchise in its gameplay and story progression. The end user ultimately has full control over their sims through avenues like character design, building design, and making decisions and influencing its behavior. Underneath all those human-made decisions are the AI controlling game mechanics, non-playable characters, and actions such as pathfinding (getting from point A to B) and most importantly, “free will”. Free will is the Sim’s ability to survive on its own, based on the narrative aspect when the player is not operating the game, but developers are careful not to allow too much autopiloting as there will be no more incentive for the player to log back in.

The latest version of the franchise, The Sims 4, builds on the tradition of replicating the real world on a tiny screen by streamlining gameplay, coding emotion, and implementing AI solutions that are more efficient for the players. The Sims 4, compared to its previous parts, has seen a major technological upgrade. Much of the routing system or the way Sims navigate in their world has been tweaked and enhanced by its software engineers who have researched human social behavior to mimic real, more believable, human behavior. A simple enhancement to the variability of posture for a character shows just how far AI can take a game. Figure 1 below shows the endless possibilities of character posture which is truly shown when a Sim is on autopilot. The AI system operates in a world separate from the end-user, creating a web of possibilities and outcomes. In autopilot, the AI must be honest and make more believable decisions without the assistance of the player.

how ai works in The sims

In its most basic form, AI usage in The Sims works with the interplay between commodities and utility curves. Commodities are the internal state of the Sim (psychological needs), and utility curves dictate the need to satiate these commodities. For example, a Sim could signify the need to eat/drink to satisfy hunger which will raise energy levels but will lower the bladder. Much like reality, everything is a trade-off. A Sim weighs all potential courses of action, evaluates their results, consults the utility curve, and chooses the best one for each option. To prevent AI from feeding predictable outcomes, these acts are purposefully randomized.

Another technological advancement made to AI is the autonomy when a Sim is on autopilot. Previously, autonomy was operating from a start-and-stop system, but in The Sims 4, developers have created an autonomy hierarchy that would first evaluate all the commodities and prioritize things with utmost importance instead of considering everything each time a Sim decides what to do. This hierarchy eliminates a large portion of possibilities and makes it possible for Sims to become faster and more efficient at decision-making and multitasking than following a first this, then that, script. A good example of this in action is when a Sim decides whether to flirt with another Sim. The Sim will score their desires, consider possible actions, consider how close they are with the other Sim, whether they are interested or feeling flirty, and finally consider all possible interactions they can perform.

AI solutions in The Sims franchise could easily take control of the gameplay and when left to its own devices, the Sim can survive by performing a vast number of actions at once with the potential of overruling player interaction. For this reason, developers were careful in artificially limiting the system because it’s impossible for a human brain to manage that many streams of input, and since The Sims is a model of human life, they also account for the faults of people alongside their efficiencies.

red dead redemption 2

Image via Rockstar Games

Red Dead Redemption 2, better known as RDR2, is an action-adventure, sandbox (games that give the end-user vast freedom, creativity, and interactions) video game developed by Rockstar Games (the same makers of the Grand Theft Auto franchise), first released in 2018. The game is set in a fictional Southwestern environment where players embody a character named Arthur Morgan, a gang leader who attempts to survive in a changing world as the law closes in on him and his gang. RDR2 has garnered international praise for its AI implementation in a complex simulation where thousands of both human and non-human agents act independently and create a believable virtual world by following rules, acting on needs, and making appropriate plans.

RDR2 deploys control agents that primarily focus on which action to take based on the current game state. These agents often can be playable characters, NPCs, vehicles, and even animals, perceive their surroundings and act upon them. This process is often referred to as the “sense-think-act” cycle (fig. 2), for example, an agent may sense that he is shot down during a gunfight and will now need to think about how many allies and foes are left standing then decide to act (fight or flight) based on his intel.

Figure 2: The sense-think-act feedback loop used by intelligent control agents. Via Xiaowei Huang

This technology isn’t new. Popular sandbox games like Grand Theft Auto V have shown us how immersive games could be, but RDR2 raised the bar of believability. The elements embedded in RDR2 are next level in terms of engagement. Imagine vivid wildlife, and an ever-evolving environment, all of which augmented reality and immersive gaming experience. The most notable AI advancement in the game that ties in with the simulation is the interactions and engagement with NPCs.
Traditionally, NPCs were often just elements that give the main player (end-user) missions, or some dialogue, making them mono-dimensional. Limited to just a few interactions with no story of their own, goals, needs, or beliefs. However, in this game, the scope of their abilities has elevated gameplay. The NPCs in RDR2 behave more like people operating based on certain storylines that influence meaningful actions. There is no endless loop of the same repetitive actions and behavior, there are now actions to perform, and it all connects to the entire virtual world (figure 3). Each NPC is now distinguished with its own personality, enriched by mood states and the capability to ‘remember’ and ‘experience’ past events. Players now have a more personalized gaming experience considering the vast possibility of outcomes – the type of response a player receives is based on how they engaged with the NPC, who they are, and how they perceive the end-user. For example, if you’ve assaulted a particular NPC in the past, they’ll remember that instance and are more prone to act hostile towards your character.

Figure 3: Actual gameplay of RDR2 and some behavior from NPCs that mimics reality.

It's the conglomeration of small instances, minor aspects, and often overlooked behavioral actions that influence the unsettling feeling humans experience when androids or NPCs closely resemble humans in different respects that are not quite convincingly realistic. RDR2 ties together what it means to add richness in character depth and tailors context specifically to who is at the end of the controller.

Conclusion

Two different game genres, two different playing styles, and very different game mechanics and goals, and somehow there are still several overlapping features of AI usage in both The Sims 4 and Red Dead Redemption 2. One that stands out is that both video games use AI to enhance and elevate the capabilities of game agents without the direct assistance of the actual human player. The most distinguishing difference is that in The Sims 4, AI is used to progress the Sim’s life all on its own when the actual player is away, whereas, in RDR2, AI is used mainly on NPCs to add and enhance these background characters' stories and interactions that are dependent on how the end-user engages. 

In The Sims 4, AI mimics the behavior of the Sims, and its algorithms control how Sims behave and engage with other Sims and their surroundings. Each Sim has its own unique needs, wants, and personalities which enables the end-user to develop its own storylines and relationships. To wrap up the AI mechanic in this game, one could say AI acts more as a stimulant for character behavior.

Red Dead Redemption 2’s usage of AI on the other hand acts as an enhancer to create more dynamic and immersive open-world environments. RDR2 uses a sophisticated AI engine that mimics the behavior of animals, NPCs, and enemies. The output AI spits out is determined by the reactions of these game agents to the player’s actions and surrounding environment in ways that feel more natural and humane. 

In both use cases, GenAI is used to a certain degree with game agents to progress a story, whether that’s a Sim’s lifestyle and personal growth or characters in RDR2 and their breadth of actions. Developers on both sides purposely design their GenAI systems to limit a character/NPC’s free will mainly because game agents by default have advantageous access to in-game information which isn’t credible when replicating human-like behavior, hence the need to artificially create a degree of imperfection in both video games’ design, development, and decision-making.