Experienced Points

Experienced Points
Next-gen AI and Next-gen BS

Shamus Young | 25 Mar 2014 15:00
Experienced Points - RSS 2.0
EP 3x3

Back in the programming period of my career, my most interesting days were when my boss would come to me and ask, "Shamus, how hard would it be to add an option to do X?" In this case, X represents something impractical, unknown, or difficult. For example, "Make the program run twice as fast." (He never actually asked me to do that, but it makes this example easier to understand. Also I should add that he was an awesome guy, even when asking for implausible or challenging things.)

I couldn't honestly tell him it was impossible, because it's perfectly reasonable to assume that with the right tricks and optimizations you could get that kind of performance increase. You might have to resort to John Carmack-level ingenuity to make it happen, but the opportunities are there. And I also couldn't tell him how long it would take, since I didn't know how to do it yet. The truthful, honest answer to the question was usually me brainstorming various ways I'd attack the problem, which wasn't the kind of simple "It would take X days to complete" estimate he was looking for. I'm sure people in other careers run into the same thing.

The thing is, I loved answering these questions and considering the problems, and I was always disappointed if he didn't tell me to dive into it for a couple of weeks and see what I could do.

These questions about AI are a lot like the questions from my boss; the real answers are probably long, technical, and riddled with exceptions and footnotes. It might involve reading or authoring a white paper. But I can take a stab at clearing up some of the confusion, and hopefully help you to spot instances where marketing wizards are trying to dazzle you with bullshit. I'm not an AI programmer, but I've dabbled a bit.

We use the term AI for a lot of different things, to the point where we could spend the rest of this column debating different definitions and still not have something that everyone would accept. Just to avoid that, I'm going to divide video game AI into two broad categories: Strategy AI and Combat AI. Those are not even remotely the only two types and that's not what their designers call them, but I'm writing this for you, not other coders. These two systems are the big ones that come to mind when thinking about games, so let's stick to them.

These two AI problems are fundamentally different. Strategy AI is the kind of AI that plays StarCraft, Civilization, or Master of Orion. This kind of AI is hard. Hire a pro. Maybe hire a couple. A single-player strategy game will live or die based on its AI. I've never written something like this, but like my boss asking me to double performance, I know this is a serious challenge without needing to consult Google first. Getting the computer to use all in-game resources efficiently in wildly divergent circumstances against unpredictable humans in a way that's interesting and varied is an incredibly difficult problem to solve. It's such a hard problem that in the early days programmers usually cheated and gave the AI extra resources to make up for the massive cognitive handicap.

Strategy games are valued for their depth. People love playing games where it's hard or even impossible to discover and perfect a single overarching strategy. They want layers of gameplay systems to consider and lots of interplay between them. "Producing more food in the short-term will let me expand faster, but I'll need to make sure I put in enough into military or I'll get crushed, and I need to invest in science for the long-term or all those bases and units will be worthless."

This depth comes back to bite the eager game designer in the ass, because the deeper the gameplay, the harder it is to make the AI. Every juicy system that the player can explore adds yet another dimension to the AI puzzle.

But while this kind of AI is hard to design, hard to code, and slow to test, the actual CPU cost usually isn't a big concern. We've had some really good AI in the past, on machines a lot slower than what we have today. We've got plenty of cycles to spend on AI if we want to. Frankly, I seriously doubt AI programmers bumped into the processing limits of the previous generation, so I don't know that this new one is going to open any new doors for us.

At the other extreme, we have Combat AI. Here we have the AI that drives all those mooks you mow down in a shooter. Helghast, Combine, Covenant, NCR, Terrorists, and so on.

Comments on