Since the birth of the videogame market, artificial intelligence (AI) has been a standard feature of games - especially with developers' emphasis on single-player games, which represented the vast bulk of released titles up until fairly recently. Although the recent support for multiplayer capabilities (especially via the Internet) and free online gaming services such as Battle.net and Microsoft's Internet Gaming Zone may have prompted some developers to downplay the need for good computer opponents, good AI is needed more than ever.
At the 1996 Computer Game Developer's Conference (CGDC), I attended a number of excellent technical discussions on game AI. Everything from formal university techniques to better pathfinding was presented to standing-room-only crowds. As a result, developers Eric Dybsand, Neil Kirby, and I thought the time might be right to begin a series of CGDC roundtables on game AI, both as a forum for developers to exchange ideas and as a venue for gauging the industry's use of AI techniques. This article discusses what was discussed in those roundtables, details some industry trends, highlights some recent games that use interesting and innovative AI techniques, and examines how the impact of offloading 3D graphics processing onto hardware may affect AI. I'll wrap up with the thoughts of various game developers on the future of game AI.
Historically, game AI has been one of the last maidens to join the dance during the development process. Emphasis was placed on other aspects of the game, from tuning 3D engines to integrating last minute sound effects. Design and coding the computer opponents was often deferred to the final phase of the project, when it was dumped on whichever hapless developer happened to be least busy at the moment. There was little planning beyond "Get it done by the shipping date," and little design beyond "Don't lower the frame rate."
In part, this can't be helped. For obvious reasons, most testing and tuning of computer opponents can't really be done until large portions of the game are already complete. Since this doesn't usually happen until close to the shipping date, it can be difficult if not impossible for developers to correct any major deficiencies in the AI if anything pops up at the last minute. That's one reason why patches are issued a mere week or so after a game hits the streets.
This state of affairs seems to be changing, however. More developers are becoming involved in the design and implementation of the AI at an earlier stage, and more resources are being dedicated to AI processing. Table 1 (below) shows the results of two questions we asked all developers who attended the CGDC AI roundtables in 1997 and 1998. While these figures and others from the roundtables shouldn't be considered statistically accurate and cannot necessarily be applied across the entire industry, they do show some encouraging trends.
Table 1 . Resources dedicated to AI development.
The number of projects with developers dedicated to game AI increased sharply from the roundtables of 1997 to 1998, from roughly 24 percent of all projects represented to nearly 50 percent. A handful of developers reported that there were "two or more" programmers dedicated to working AI, and one developer at the 1998 session reported a whopping three programmers wholly dedicated to game AI and scenario development. AI is still taken care of by a small subset of the programming staff, and these developers often have other duties as well, but this situation seems to be rapidly changing.
The average number of CPU clock cycles reportedly dedicated in some fashion to AI processing also jumped from the 1997 to 1998 roundtables, from an overall average of 5 percent to around 10 percent. When broken out between real-time action games and turn-based games, we noted that the biggest gains were made by developers who were responsible for the former. This jibes with the fast evolutionary pace of the real-time action game genre. On the other hand, gauging AI advances in turn-based games is necessarily tenuous: many of those present who were working on turn-based projects said that they basically received all of the CPU power they needed when it was the AI's turn.
Significantly, developers overall reported that AI was becoming a more important factor in game design than it had been in the past, often being assigned an equal priority with graphics and sound in the initial game design and allocation of resources. Those responsible for game AI (whether or not it is their sole task on the project) are getting involved earlier in the design and development cycle, smoothing the way for better integration between the AI and game engine. Fewer developers reported having the AI dumped on them in the last month of development, although everyone cited the crunch of the shipping date as a major factor in the tuning of any game AI.
A handful of developers in the roundtables noted that working on a sequel to a successful game, or building on a licensed 3D engine technology, often gave them greater freedom to pursue development of more capable computer opponents. In such instances, this growing emphasis on AI seems as much feature-driven as technology-driven, as companies look to differentiate products in the marketplace.
An interesting side effect of the rapid advances in the 3D hardware acceleration market is that the CPU has been freed up for more AI-related tasks. While some developers at the roundtables felt that the trend towards more glitz in games was stealing CPU cycles away from other portions of the game engine, most developers were of the opinion that offloading 3D processing to 3D hardware was gradually giving them CPU cycles that could be used for deeper AI processing. All the developers felt that offloading 3D processing was a positive trend, especially with today's powerful CPUs (such as the Pentium II and the AMD-K6-2 with 3DNow!) providing orders of magnitude more processing power than were available just a few years ago.
Another trend is the rise of the AI specialist - an external developer who focuses solely on creating the game AI. (Full disclosure requires me at this time to note that I'm just such an individual myself.) This can be a low-risk approach for companies that are interested in providing more challenging AIs in their games, but which lack the in-house experience to develop it. Several developers also noted that their companies are in the process of setting up their own internal teams to handle all AI development across multiple games, which is something that simply didn't happen just a couple of years ago.
A handful of people from development studios stated that they were also attempting to find developers with knowledge of both AI and general writing/story-telling expertise. This trend was most evident among groups working on RPGs, especially online products, and likely reflects some of the lessons learned from Origin's Ultima Online experiences. Developers working on these projects felt that by hiring AI developers experienced in writing and story telling, they could build more realistic worlds that would interact with players more consistently with what the games' producers had in mind.
Exploring the AI technologies used in games has been popular in the CGDC roundtables. As the importance of good game AI increases, developers have been turning to academia and defense research for information on more exotic technologies and better methods than the brute force approaches often used in the past. Here are some AI technologies that have been employed recently.
Rules-based AI, characterized by the heavy use of the almighty finite state machine (FSM) and its close cousin, the fuzzy state machine (FuSM), remain the technologies of choice for AI development. Every game on the market uses rules-based AI to some degree or another and with good reason: these methods work. Rules-based AI remains the foundation of opponent intelligence in most games for three simple reasons:
Yosemite Entertainment's S.W.A.T. 2, on the other hand, demonstrates some of the capabilities of FuSMs, which were heavily used for the tactical AI in that game. This approach was driven by the game's design: the developers wanted set scenarios that could play out in any number of plausible, yet different ways. Similar games often use scripting to lay out a scenario, but this can lead to predictability and limits replayability. S.W.A.T. 2 gets around this by building FuSMs. Each possible decision is run through a bit of code they call a "fuzzy decider," which weights the possible responses of any given unit based on its health, personality, and so on, and then chooses one of these randomly. The result is a series of actions that are perfectly believable and realistic, but which vary from any previous game so the player is never quite sure what will happen. FuSMs also provide more of an "analog" feel to the AI, allowing a spectrum of realistic behaviors that might not be expected by the player.
One nice side effect demonstrating the intrinsic power of such a straightforward approach to AI can be seen in something called "emergent behavior." A developer faced with coding a complex AI can instead break it down into smaller pieces. Rather than having to code thousands of rules for every conceivable situation that could arise in a game, lower-level behaviors are coded individually and then linked in a decision-making hierarchy. The interaction between these low-level behaviors can cause higher-level, more "intelligent" behaviors to emerge without any explicit programming. This is the basis behind flocking, an AI technology that seeks to emulate the behavior of large groups of animals, such as flocks of birds or schools of fish. No one member of a flock actually knows anything about the motion of the flock, and yet through individual actions their motions are coordinated and fluid. Flocking has found its way into a number of first-person shooters and RPGs as the basis of sort of artificial life, another form of AI technology seeing more use in games.