Sponsored By

Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs.

This post covers my experiences trying to leverage AI to generate game content rather than make them actors in a planned story. I cover the difference of perspective that is necessary to take advantage of our medium through our AI agents.

Brandon Franklin, Blogger

October 3, 2018

15 Min Read

Artificial intelligence is one of the primary sources of content in games. Designer and programmers add features and actions into these AI so they can engage with the player and give them a good experience. This can include combat, speaking, leading, and acting for the player. So what is missing from AI in games?

AI (almost) never has the same tools to interact as the player does.

Often, even the tools they do share with the player are dumbed-down to a huge degree. This is done with good reason, and I would even consider it to be good design in a lot of cases. For example making it so AI characters have worse aim when they’re behind the player or making them shoot less is positive. This makes the game seem more fair to players by tipping things into their favor. However, there is a type of game that exists that lets the non-player characters (NPCs) of the game have all the same tools as the players and both NPCs and players share rules for mechanical interaction. These games are tabletop Role-Playing Games (RPGs).

I am a huge fan of tabletop games and have been a player and a game master many times for over 10 years now. I’ve also been a big fan of digital RPGs and Immersive Sims that seek to take some of the design principles of tabletop RPGs into video games. Not all of my ideas for how to utilize AI is going to be applicable to all games. That said, if they are used for games, they can give a whole new player-game dynamic that’s been completely neglected in digital games. I’m also not going to go too much into the specifics of how I think these AI should be structured technically, if you want to hear more about the specific technical elements you can watch a video I made about my side project of implementing these ideas.


 

Emergence

This AI structure games are missing can be summed up into one word: emergence. Emergence is when simple rules create complex systems. An example is how ants individually follow a very simple set of goals but an ant hill seems to be an immensely complex system to keep the ant society safe, fed, and reproducing. That overarching goal isn’t even known to an individual ant, it just knows how many workers, scavengers, and warriors are needed and will try to meet those quotas if any one count is low. We hear about emergence a lot when it comes to games because of emergent gameplay. Emergent gameplay, similarly, is when all of the tools, mechanics, and systems of the game accidentally create a deeper mechanics/systems interactions. This is usually due to having open systems that allow for things to freely interact with it and don’t only work with a small set of actions, objects or characters in a small set of ways.

Emergent interaction can summarized as two or more rules interacting with one another. If you make a rule, for example you can shoot your hook-shot into wooden surfaces to pull yourself to it, and a separate rule, for example starter enemies spawn with wooden shields, then you could have an unplanned result when the player exploits these two rules. In this example the player could pull the start characters by using the hook-shot on their shields or maybe they can even just pull away their shield and leave them defenseless. This gives the player a feeling of being smart, of surprise, and will make them want to manipulate more game rules. Assuming these interactions are something the designers are aware is possible, they’re unlikely to break the game and it encourages the player to engage with your game not like it’s a static world you authored and more like it’s the interactive experience it should be.

The Legend of Zelda: Breath of the Wild use these elements with their AI. When they get surprised at camp they have to walk over to pick up their weapons. If you used stealth to take those weapons already then they have to improvise, throwing things or just running to safety. Their wooden shields can also be burned and you can knock their shields and weapons out of their hands, making them run to retrieve them during combat. These are many simple rules and simple actions that all add up to a very complex system. Not just a complex system, but a complex system that is very intuitive and has many elements to it that the player can choose to adjust to see new results.

Just about every game with AI in it could benefit from this structure for AI characters. No designer tries to make a system that limits the players actions or expressions. They’re trying to make a certain experience to illicit a certain feeling for the players. Fallout 3 had a tactical aiming mode that let the player shoot the gun from your enemies hands who will then either flee, take out a secondary weapon, or go pick of the gun you made them drop. Just this one element makes the AI seem so smart, so human, and they make the player feel smart, empowered and feel like they understand the world they’re in. These all seem like desirable outcomes unless your game is specifically about disempowerment.

 

Tabletop Games are Cheating

The main advantage of tabletop games is that there’s a person running everything. The rules to Dungeons & Dragons used to be pretty vague because of this, and it wasn’t until some creative changes over time, likely due to the expectations brought about from video games, did the rules get more explicit. The vague rules and the prompt to act like everything was real to your character made it so anything could happen and it would feel right. You could make any plan or any action, and then the person running the game would give you a chance at success they though reasonable and a dice would decide the outcome. Short of actions that were impossible, rolling a 20 on a 20 sided dice was considered a critical success and the player would pull off the action they attempted regardless of likelihood or character skill, often with an added benefit. This is a big part of what incentivizes taking chances is a dangerous game even if you have failed similar actions many times before. You know you can succeed as long as it isn’t impossible because that person running the game will figure out how to make it so success makes sense.

This person also facilitates all the character interactions. If you treat people with respect, they may be more apt to be friendly, if you get caught stealing from that person, they’re likely to try to kill you or get you imprisoned. These situations are unpredictable for a few key reasons: you often don’t know about the person you’re dealing with ahead of time, you don’t know what they’re capable of, and there is a real person that has been a part of all the actions of your campaign. This can mean that a somewhat temperamental person will try to kill you if you steal from them, not because of that person’s motivation, but because of the game runner’s motivation to make you stop stealing from everyone you see.

I think this is where the hand of a designer is usually seen in digital games, they have an idea of what you’ll enjoy or an idea of how you should play to enjoy it the most, and they can stack the deck against you or for you to motivate you to play that way. This isn’t a bad thing for tabletop games because manipulating NPC motivation is a necessary tool for the game runner, for a game that wants to give the player everything this medium has to offer, this sort of designer tweaking would make for the consistency needed for emergence to crumble.

 

Consistency Leads to Emergence

If you want players of digital games to tell their own story in a world like you can with a tabletop game run by a person, then character motivations need to be consistent. You could drive the player towards some characters and away from others with some sort of game state manager, but that wouldn’t necessarily create a unique story for the player. That would mainly be your story. You will never be able to use a system meant to be a virtual designer as well as a tabletop game runner can use a split second tweak. That system will never compare to a truly unique experience due to a simple rule acted upon by a simple action from a player creating an experience from the collaboration of the player and the game.

I don’t think that having a system to nudge the player experience is limited by technology or implementation, I think the concept itself is flawed because it will always miss the personal relationship that tabletop games create through a shared story. A digital game doesn’t create a relationship between the designer and player like in tabletop games; it creates one between the game itself and the player. We should strive to get out of the way of that and make games that the player can treat with as much respect as they do crossing the street. Everything is real, everything is consistent, and my actions will have specific and retaliatory consequences.

So, if we aren’t the arbiters of our games as designers, who is? The answer that serves this article is of course that the denizens of the game world are what facilitates your game! Although it can also be the player themselves if you don’t have AI agents enacting their will in the game. But most games have characters other than the player, even if the effects of those characters is only seen through notes or other ways they affected the game world. When you break a law in The Elder Scrolls V: Skyrim you don’t shame yourself, the designer doesn’t remove 1 alignment point and say you’re slightly more evil than before. What happens is a citizen tells a guard and that guard will hunt you down if they spot you. This is two simple rules, a law you can break and a citizen can report broken laws, and suddenly you’re losing gold, fighting guards, or running away with a new part of the map to avoid for a while.

Players get away with a lot in games, and they enjoy doing so. It’s not always a good idea for the fun of a game to remove unintended interactions even if they break entire game mechanics. An example from Skyrim is that you can put a wicker basket on the head of NPCs to steal from them, completely negating the need for the stealth stat in shops. But you can incorporate those same ideas in ways that don’t break the illusion of sentience for your characters. Dungeons & Dragons for instance has a spell called blind. It’s essentially a basket for the heads of NPCs, but it has a cost, you need to be able to use magic, you need to have the spell prepared, you need to have gotten the spell somehow, and you can be caught using it. Suddenly stealth looks just as good as the spell, maybe even more appealing, but the spell is still useful, fun, and, in many ways, a way to break the game to have fun.

 

That Seems Like A Lot of Work...

This is going to be a lot of work. AI is always a lot of work in games because we want them to be fun, interesting, and appear smart. In my experience however as a developer that has mainly worked on small teams the most time I spend on programming is from exceptions. Every time there is a specific edge case that must be changed because of someone’s taste or pacing, even my own, I know it’s going to require some specific code that will be hard to maintain in every possible situation. This can be a failing on the programmer for not incorporating this possibility (if it was a planned feature). Often, however, it is a failing of any developer that isn’t thinking about how to work with the system, but is instead trying to impose their will on this one element that maybe should just cause you to change the system.

I worked on my system for about 2 years part time before I felt it qualified as generating content. It’s still very simple so that seems like a lot of work to get to that point. But I was working alone, and I was figuring all of this out for myself from GDC talks, articles, and my own examination of games. Additionally, I didn’t go into it knowing what I was making or why I was making it. That’s a big part of what this article is, I finally figured out why I want to do this in a game, what to do to make it happen, and what experience this should generate for the player. Figuring this out was a process and if I started from scratch now it’d take way less time. I hope that people that read this who are already capable of trying something like this will go ahead and try it. I don’t think it would take long, but it does take a new way of thinking.

The point in the process I’m at now is realizing how huge my scope was and how limitless the polish can be when you’re dealing with characters. It also requires a lot more art and planning of potential content before it can really be a complete game.

The real issue with the time it takes to create this kind of AI is that you’re looking for something that makes the game fun based on some predefined rules. We aren’t dealing with events, quests, or planned actions. We are dealing with values that drive those things. This is a new way of thinking about game content for most 3D games. Rogue-likes have been creating AI paradigms like this for a while. They mix and match content a lot and they need these AI to be robust enough not to create unwinnable situations in potentially random configurations. Think about what you get out of achieving that. You don’t just get characters and quests; you can get endlessly complex and interesting conflict. A game full of infinite explicit content would take infinite time. It’s clearly better to create a smart system to make that content for you. AI is always procedurally generating content, we just constrain it too much and play it safe.

 

Balancing

Let’s talk about balancing an experience like this. You have all these simulated players acting on the world. How do we stop them from solving all the quests? How so we stop them from solving their own problems? The answer is simple. You don’t. If the NPCs in the game can do the tasks you want the player to do while being mostly normal people just living their lives. Maybe the player shouldn’t be doing that task. If an area is maybe too dangerous or two far for NPCs to go and do them, that sounds like a job for a player of your game. Not to say they can’t help out with local and mundane issues, but they shouldn’t be planned out explicitly unless they’re unique enough or interesting enough that only a player that’s looking for it would even want to get involved.

Let the characters in your world run the world. Let them have jobs, homes, and beds, but don’t make them there just to give the illusion that they are necessary. Make them necessary. Make them part of a system the player can interact with. Let NPCs be functionally tired when they’re woken up. Let the players learn this, exploit this, and look for new things to learn and exploit.

The content of your games should not be simple or have one correct answer. This is an interactive medium. If you have characters, let them be characters. If you want to tell a story in one specific way, then maybe interactive games aren’t the best fit for that. If you want to make an experience for players to interact with, then make experiences they can only have with games.

 

In Conclusion

We’re missing an opportunity with AI. We have so many more resources at our disposal in terms of hardware, experience, and technology. We can make our AI more than babysitters, exposition dispensers, or cannon fodder. Our AI can be agents of the world they live in and be as engaged with the game’s systems as we want our players to be. No only can we do this, but many developers are already doing this and being praised for their innovation and design. It makes the gameplay intuitive, interesting, and makes players engage with it in the same, serious terms you do when creating your game.

Quick Rules for Making Better AI:

  • Construct simple rules to build your game systems on

  • Make the AI play by the same rules as the player

  • Create open gameplay systems that don’t interact in a rigid way

  • Let your AI characters create and drive the content of your game

  • Make things consistent so players can use their intuition to solve problems

  • Don’t artificially limit what your AI can do

 

I'd love to hear what you think about this idea, comment below or message me on twitter @RTCinder

Thanks for reading!

Brandon Franklin

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like