AI in Game Development: How Modern Games are Relying upon AI to Drive Engagement.

Warwick AI
Warwick Artificial Intelligence
10 min readOct 20, 2023

--

By Luis Armada

Introduction

In the modern world, Artificial Intelligence (AI) is reshaping industries across the board and game development is no exception. With tools influencing anything from NPCs to playing environments, AI provides key development applications that drive immersion and engagement. In this article we will delve into the many implementations of AI within game development, alongside the future of this rapidly advancing technology.

Current uses of AI in game development

1. Immersing players with AI powered NPCs

A key component in developing any quality game is ensuring that user interaction is both enjoyable and engaging. One way in which games achieve this is by introducing “non-player characters” (NPCs), ranging from humans to animals to fictional creatures. However, to drive engagement with these NPCs, developers must incorporate a layer of meaningful interaction between these ‘computers’ and the player.

Using artificial intelligence (AI), NPCs are ‘brought to life’, enabling them to move and undertake various activities in a scene. The movements of a character are decided with finite state machines [1], which manage the various states or ‘modes’ of an object. A state can be anything the NPC can do, such as: idle, running, attacking or hostile. These states can only transition or change to another state if specific conditions are met. For example, the state machine in Figure 1 shows an enemy who will transition from idle to moving if it has been idle for too long, or from passive to hostile if the player is too close.

Figure 1 — A Finite state machine displaying the possible states for an NPC and how to move between them.

Finite state machines are one of the simplest forms of AI models, yet they provide a plethora of possibilities. Character behaviour, decision-making and pathfinding are the simplest examples, but programs are further developed to incorporate character dialogue, complex quest systems and more.

2. In-depth player analysis via machine learning

Multiplayer games are extremely popular, and with good reason. They connect millions of people around the world through the internet, allowing gamers to play with or against each other on demand. With such an enormous player base, regular maintenance is important to ensure that all players are being provided with the best experience possible. Naturally, this task would be overbearing for humans to manage, requiring constant attention over such a large area. This is another aspect of game development wherein the capabilities of AI can be leveraged.

Via machine learning (ML), computers can use mass calculation to determine a rating for every player in a game. This rating is a representation of a player’s skill and general behaviour. Games are utilising ML, teaching it to learn from previous data and accurately decide how to distribute ratings based on known averages. The AI can then discern which players have good behaviour (such as friendly communication) and should be rewarded, and which have bad behaviour (such as communicating rudely or purposely sabotaging games) and should be penalised.

Move over, multiplayer games frequently feature skill-based matchmaking using this player rating system — providing a more balanced, inclusive, and enjoyable virtual experience. This is accomplished by matching players of similar skill levels, keeping opposing scores close and games fair. This in turn keeps players engaged and encourages a sense of improvement over time. An example of such a system is Microsoft’s TrueMatch [2], which uses ML as well as reinforcement learning (probabilistic models and non-linear optimisations) to adjust matchmaking based on player location and skill level.

Player analysis is an extremely useful tool which games can use to provide a customised experience to the player. An AI based rating system can also lead to useful applications such as the dynamic provision of suggestions or coaching tips to players — using data mining — or to prevent cheating in multiplayer games.

3. Generating compelling storylines and environments with NLP tools

The process of designing unique plotlines and gameplay mechanics for an entire video game can oftentimes be a difficult task. Luckily for developers Natural Language Processing models (NLPs) can assist in idea generation, ranging from the conception of game mechanics and environments to entire storylines.

In essence, NLP is the subfield of AI concerned with enabling computers to understand human language. It works by breaking down the input into tokens and applying statistics gathered through Machine Learning to determine their meaning. NLP has made it easy for users to enter a prompt of what they require, receiving some output that fulfils their needs which saves significant time and energy.

OpenAI’s ChatGPT is a recent example of an NLP tool that can be used to facilitate the process of game development. ChatGPT is an AI-powered chatbot that — given a prompt from a user — will produce a response by referring to a large dataset of human-written text used to train it. This is a powerful asset for game developers, as it can generate novel and engaging storylines, character traits, game mechanics and more, in a matter of mere seconds.

Stable Diffusion [3] is another NLP model which can generate photo-realistic images given any text input (Figure 2). This is a valuable resource for developers as it can be used to generate concept art for characters and environments, without having to hire a human concept artist. Naturally, images produced by Stable Diffusion often lack the creative flair in human made art; nevertheless, for those without the resources necessary to hire human artists, the AI generated alternative is more than sufficient.

Figure 2 — Stable Diffusion’s output when given the prompt “A post-apocalyptic city overgrown with vegetation”.

The Future of AI in Game Development

As displayed, AI plays an important role in the field of game development by making games more interactive, responsive, and easier to design. Given the speed of AI’s development, it is also important to recognise the potential of AI in the game development sector in the near future.

4. Building open worlds using generative AI

The refinement of existing AI techniques could result in the automation of larger, more complex areas of game development. Previous examples showed a NLP’s capability to generate images of scenes, but what if we could use similar tools to generate the entire 3D environment?

NVIDIA’s Get3D [4] is one such model that can accomplish this, with the ability to generate high-quality textured 3D models from only a single image (Figure 3). Although this model can only currently reproduce models from its database, it is likely that future developments will surpass this. Figure 3 shows the process of Get3D and the steps it takes to generate a 3D model from the inputted 2D image of a car.

Figure 3 — How NVIDIA’s Get3D projects textures onto a 3D model to train its natural language processing model.

Taking it a step further, OpenAI’s Point-E [5] can generate digital models consisting of 3D point clouds — a collection of individual points plotted in 3D space. The prompt can further customise the models with descriptions, such as adding accessories or changing colours (Figure 4). In theory, this would save developers an incredible amount of resources, allowing them to expedite prototyping by generating required meshes on the fly. Unfortunately, the model needs more development to produce models at a high enough level of detail or quality for commercial use.

Figure 4 — OpenAI’s Point-E outputs when given a variety of text inputs.

Stable Diffusion, as seen in section 3, is not only capable of AI generated art — with its most cutting-edge implementation producing textures for 3D models. In Figure 5, the technology was used to turn three simple shapes into an entire scene simply with the text prompt ‘sci-fi abandoned buildings’ [6]. With this technology, the effort and time required by a human developer is minimised with little cost to the quality of the result.

Figure 5 — Stable Diffusion projecting texture onto blocks to generate an environment, as created by Donald Papp [6] .

A final example is Text2Mesh [7], a tool which adds detail to an existing model by adding colour and small displacements for texture. This model uses a neural network to render multiple 2D images, in conjunction with OpenAI’s CLIP [8], a framework to determine if the resultant model is representative of the actual text prompt provided. Figure 6 shows an example of a simple 3D ring object being turned into a fully textured donut with a single prompt.

Figure 6 — How Text2Mesh adds texture to a model using neural networks to render textures upon multiple 2D axes of the 3D shape.

5. Dynamic character generation and animation

As discussed in section 1, the impact that NPCs have on the quality of a game is significant. Their presence and quality can easily distinguish a dull game from an interesting one. However, the process of creating each NPC becomes very time consuming, with developers needing to ensure sufficient variation between each character to accurately simulate real life. The time needed will scale based on the size of the game and its environment, delaying the development process by a matter of years.

This challenge begs the question: what if we could use AI to dynamically generate unique characters for instant use in the game world? Indeed, this can easily be achieved with a randomiser over each trait on a character creator system. Even so, the development of the character creator system itself could take a long time to perfect and be prone to inaccuracies. The aforementioned technique of producing a 3D model from an image could be applied to animated characters. This could be combined with a model such as the one in thispersondoesnotexist.com [9], which uses machine learning with a generative adversarial network (GAN) to produce novel images of fictitious people. This, in theory, allows a game to include an infinite collection of unique characters without any modelling needed from developers.

Similarly, could the use of AI be extended to something which cannot be easily described in words — like animation? An interesting existing application has AI teach characters how to walk using reinforcement learning [10]. This technique provides rewards to an AI system for completing certain desirable tasks, therefore incentivising it to collect these rewards and ultimately learn to perform a task without significant human input or training data. In the future, this system could be applied to all necessary animations — for example, to teach characters to realistically move, attack or swim. However, reinforcement learning is difficult to implement and can take a long time to train, with AI systems needing to complete multiple attempts before being able to perform a task correctly. Even after many attempts, the AI could still fail the task — making the system unreliable especially in products with time constraints.

6. AI generated soundtracks

AI’s capability to write storylines, as discussed, could be extended into the composition of a variety of creative endeavours. For example, composition of music for use in video games.

Music is often overlooked in gaming however it can be integral to setting the tone of a level. Super Mario, Halo, Tetris: famous games usually have well known soundtracks accompanying them — and this is no coincidence. Better music makes an experience more enjoyable for a player as it sets the mood of a game and drives a deeper immersion. There have already been instances of AI composing music, such as classical [11] and dubstep. However, the composition of an appropriate soundtrack is a task which requires a specific skill set to tailor the music towards the game’s needs. Possibly in the future, soundtracks will be automatically generated to fit right into games without players knowing.

Conclusion

AI has found its way into all aspects of video games from non-player characters to storyline generation. The capabilities of artificial intelligence and its role in game development have improved and diversified to the point where almost every game released in recent years employs some form of AI. Though this article has discussed its applications regarding NPCs, player analysis and storyline generation, the uses of AI extend to many other areas including procedural level generation as well as virtual and augmented reality games.

If all the possible future advancements were to be realised, game developers’ jobs would certainly be easier to perform. This is especially true for independent or ‘indie’ game developers, who might lack the funds to hire professional artists. However, all of this leaves the question of whether AI could replace game developers themselves. AI can already write simple programs as seen through models such as ChatGPT, where an AI could program tic-tac-toe in Java simply by giving a prompt. Could AI possibly improve enough so that it can write the code, decorate the environment, make the characters, animations, music, and storyline all on its own? Could games be artificially generated in the future, and would players even realise?

In conclusion, it is clear these advancements threaten the livelihoods of many professionals in the game development industry. With future AI being able to generate a variety of content already — it is reasonable to question whether the jobs of game developers are at risk, or if the creativity involved in making a game is something that AI will simply never be able to learn.

References

[1] Fernando Bevilacqua (2013) Finite-State Machines:Theory and Implementation [online] evatotuts+. Available at: https://gamedevelopment.tutsplus.com/finite-state-machines-theory-and-implementation--gamedev-11867t

‌[2] Microsoft (2017) TrueMatch Matchmaking System [online] Available at: https://www.microsoft.com/en-us/research/project/truematch/

[3] Stablediffusionweb.com. (2023). Stable Diffusion Online. [online] Available at: https://stablediffusionweb.com/.

[4] Jun Gao et. al.; (2022) Get3D: A Generative Model of High Quality 3D Textured Shapes Learned from Images. [online] Available at: https://nv-tlabs.github.io/GET3D/

[5] Alex Nichol et. al.; (2022) PointE: A system for generating 3D point clouds from complex prompts. [online] OpenAI. Available at: https://openai.com/research/point-e

[6] Donald Papp. (2022) Image-generating AI can texture an entire 3D scene in blender. [online] Hackaday. Available at: https://hackaday.com/2022/12/18/image-generating-ai-can-texture-an-entire-3d-scene-in-blender/

[7] Oscar Michel, Roi Bar-On, Richard Liu et. al.; (2021) Text2Mesh: Text-Driven Neural Stylization for Meshes [online] Available at: https://threedle.github.io/text2mesh/

[8] Alec Radford et. al.; (2021) CLIP: Connecting text and images [online] OpenAI Available at: https://openai.com/research/clip

[9] Phil Wang. (2019) This person does not exist [online] Available at: https://thispersondoesnotexist.com/

[10] Insider Tech (2017) Google’s DeepMind AI Just Taught Itself To Walk [online] youtube. Available at: https://www.youtube.com/watch?v=gn4nRCC9TwQ&ab_channel=InsiderTech

[11] Aiva (2019) Romanticism in D minor — AI Composed Music by AIVA [online] youtube. Available at: https://www.youtube.com/watch?v=03xMIcYiB80&ab_channel=Aiva

--

--

Warwick AI
Warwick Artificial Intelligence

Society run blog on all things artificial intelligence - written and edited by a team of researchers from Warwick AI at the University of Warwick.