AI in games

AI is used extensively for games, nobody would disagree with that statement, although most would assume by AI we mean computer-controlled characters that the player can play against. While the most noticeable AI in games are computer-controlled bots, many consider them much simpler than a “proper AI”.

So with that in mind, I want to write about a couple of times I have seen or used AI in games in ways people would not normally expect or in ways that impress me. Some may not consider these AI as they do not always learn, but many have been called AI by their creators. Either way, I find them all interesting ways to use a computer to create content artificially and intelligently for games.


AI Storywriting and Directing
AI can be used to create custom stories that adapt to your own characters. I recently played a game that does this well called Wildermyth where the characters you meet are randomly generated and the type of traits determine the events you can come across in-game, the game decides an event will happen and picks it based on your current situation to determine the specific event.

Another game that does this well is the text-based game AIDungeon which creates a unique and personal story for each player that can be different every time.

The roguelike Mystery Dungeon games are nearly fully generated, while there is an overarching story, both the levels and missions are randomly generated from a set of parameters. Usually, it would be a set mission with random clients and targets, but there are also several rules for map generation that the game follows, perhaps not considered an AI director, the computer is still using maths to determine an output, which is all that most AI do, the big difference here is how you define AI as some consider an AI to only be a true AI if it learns, even if what most would call an AI, especially under the games label, do not actually learn.

Finally, the classic game Left4Dead famously had an AI director designed to challenge players by deciding how many zombies the players will face, this dynamic difficulty impresses me as it monitors how fast players are going and creates swarms to entertain fast players or to encourage slower players to move on before getting overwhelmed.

I would enjoy creating a game with an AI writer or Director and would see immense value in creating technology for myself to use on future projects. Without a budget to hire writers, having an AI add extra content allows smaller-scale developers an immense amount of content.

I also use this kind of AI to generate missions for the players to increase replayability, For the game Adventure In Aellion, I developed a proxy system which I have since used in other games which allows an AI to select potential objectives that when completed can be moved and re-randomized, this allows for great replayability within a controlled environment. I have found the proxy system to be very useful for dynamically replayable games.

Dynamic AI Chatbot for Unreal
When working on my talking car, the first thing I had to do was to create an AI chatbot, and, given the Unreal Engine had python as an experimentally supported language, my first created version worked as an Unreal Engine character chatbot. The chatbot, based on CakeChat allowed every character to speak to you dynamically and I controlled key conversation, such as starting a quest, with some keywords and key topics the character could detect to use a more specifically trained chatbot instead of the more generic conversation chatbot. I could give characters specific information topics that they would be aware of instead of writing tons of text for conversation. Finally, when a conversation is had, it would save the response from the player to learn new topics and sentences per character so each character learned over time.

AI creating full games
AI has the potential to create full games. While in its infancy, several examples of AI creating games exist, Specifically I will be speaking about Simon Colton, professor of Digital Games Technologies at Falmouth University’s work. Of course, I am not a huge fan of the idea of AI taking my job, I am interested in the idea of using code to create code and what’s going on within that code. I see a couple of potential ways to create an AI that could do this, it would have to learn what certain code does, learn what a game is, and try to solve the problem of “Using the code I have learned, how can I create something that meets the requirements of what is a game” and then it would have to add newly created code to its potentially usable code knowledge. Keep in mind at the end of the day, this is still just maths and we can analyze how to solve it to create such an AI.

Level generation with AI
Many games claim to use AI to generate levels when what they actually mean is that they create levels with maths. Ray-marched cubes is a technique that allows for random generation within 3D space using a coordinate system, specifically to create walls, but combined with some data such as building type for the cell and color and you could create a whole city from just a bit of maths. Poisson disk sampling is a technique that using maths can fill an open space with objects using a radius to ensure the objects don’t overlap, you can even work out different sizes of objects within the filled space and still prevent overlaps without having to test every object using only maths. Cellular automata can be used to generate blobs of empty space and filled space, which can be very useful as a base for ray-marched cubes to create caves, towns, or any area really.
Many games use these techniques and claim their game is generated by an AI when in fact it’s more just fancy maths, but that’s all an AI really is, an input to an output.


So does AI actually exist in games? Well, that depends very much on the definition of AI you go by, but whatever the computer does, it’s just maths and rules, initially controlled by the programmer, and where the code attempts to learn from and rewrite itself from its results are where it gets really interesting.

References

Leave a Reply

Your email address will not be published. Required fields are marked *