Search form

Using Artificial Intelligence in Game Development

Kevin Dill is the latest developer in a series of interviews I’ve done with the authors of Game Programming Gems, 8th edition. He wrote a chapter on patterned approaches to modular artificial intelligence (AI) games. These are some excerpts from our interview.

Arti Gupt

Arti Gupt

By Arti Gupta

Kevin Dill is the latest developer in a series of interviews I’ve done with the authors of Game Programming Gems, 8th edition. He wrote a chapter on patterned approaches to modular artificial intelligence (AI) games. These are some excerpts from our interview:

Arti Gupta: AI is being increasingly used in games, and in your chapter you stress the importance of modularizing your code so you can make the AI code reusable. Can you talk a little more about that?

Kevin Dill:

I think this is a weakness that we’ve got in gaming and AI. If you think about graphics, for instance, there’s a lot that gets reused. We have this notion that we use a texture map triangle and all these tools, and in every game it’s done the same. In AI, we’re having a hard time with that, and to a certain extent every game is different. But there’s still a lot in common between, say, Halo and Red Dead Redemption, which are two very different games.

If you think about what AI is, there are really two pieces to it. One is the recent architecture itself, whether it’s a planning architecture, a behavior tree, a finance state machine -- whatever you use. And there’s been a lot of work to reuse this. You can buy middleware architectures. There are architectures like Soar or CoJACK from academia that you can get for free.

But the other half -- the half, to me, that is by far the bigger half -- is the behavior. That means all of the data that goes on top of the architecture to actually control your characters. And for me, I usually spend a month or two building my architectures, and it gets continually tweaked after that, but for the most part it’s done. Probably 80 percent of the work is building that behavior. But we haven’t found good ways to reuse the behavior.

A.G.: In your chapter, you also make a distinction between Boolean- and float-based logic. Can you give an example of Boolean logic and how you would use it in a game?

K.D.:

This is a distinction that’s been growing on me recently. The idea of Boolean-based logic is sort of what you’re used to seeing. You have a bunch of clauses and each clause is evaluated as true or false. Everything is black and white; it’s either yes or no.

The idea behind float-based logic is you try to keep things as floating point numbers for as long as possible. So instead of knowing that you want to attack someone -- yes, it’s true, I want to attack somebody -- you know how badly you want to attack somebody. I want to attack them with a score of 53. From my point of view, Boolean logic is something that I’d argue we should be moving away from. But there is still a lot of room for it in a lot of games.

Arti Gupta has worked on software-engineering projects as a developer, architect and project and product manager for more than 10 years. Now she does community management for game development on the Intel Software Network site. Gupta likes reading, traveling and spending time with her family. Follow her on Twitter: @artigupta.