Daniel Brewer Game AI

Building games. Documenting the journey.

What is Game AI anyway?

Ask ten game developers what ‘Game AI’ means and you’ll get ten different answers — and that’s before anyone mentions ChatGPT. Here’s my take, shaped by 18 years of shipping AI systems for AAA games like The Darkness II and Warframe.

The first thing most people think of as Game AI is the logic that controls the enemies and non-player characters in a game. How they perceive and react. How they move between locations. The brain that controls their decisions, attack patterns and ambient behaviors.

But it can be more broad than that too. Games can present expansive open worlds for players to explore and experience. The complex systems that breath life into these virtual worlds. How the citizens go about their daily routines. Where and when enemies or wildlife are present. How the wildlife interact with each other and with the other denizens. Simulating an entire city takes a lot of CPU resources and memory. Systems need to keep track of where the players are and keep an active bubble of activity around them as they move through the world. These can all be considered Game AI too.

These large worlds require a lot of time from a lot of developers to construct. Procedural Content Generation (PCG) are a set of techniques that can automatically generate environments or items based on patterns and rules established by developers. This allows small teams to amplify their workflow and create stunning, believable worlds for players to explore. Or these techniques can be used dynamically during the game to create near endless possible dungeons for players to plunder!

These techniques have become so powerful and important that they have now become their own, independent category of game development. However, I still consider them Game AI, because for me, these systems take some uncertain input and generate believable, complex outputs. And PCG techniques lead straight to Ai Directors, systems that monitor the game as a whole and adjust what’s going on. Effectively artificial Dungeon Masters, pulling strings behind the scenes to ensure the experience is still strong and has good pacing, despite dynamic level layouts.

The common threads for my definition, are:

  • They handle uncertain states
  • They respond to actions the player takes in a believable way that is consistent with the game world.

What about all these new fandangle algorithms like DNN, LLM, Generative AI, Reinforcement Learning, Agents and RAG etc?

For me, these are all new tools and techniques that may be useful for specific problems or features, but they are not the golden solution to every problem. Currently, video games need to run on personal hardware, and need to be highly performant. We try to squeeze every last FLOP out of the CPU and GPU every last byte out of the memory. Game developers, more than almost all other software developers, work very close to the hardware. We pay close attention to memory allocation and fragmentation patterns. We analyze the cache coherency of our data structures and algorithms. We need to do all our computation for everything in the game, in less than 1/60th of a second! If not, the game stutters, like a stalling car, and the experience will suffer and players will notice.

In practice, most ML inference is a budget problem. You have maybe 2ms of your 16.6ms frame to spend on AI — a neural net that takes 50ms sitting in the cloud doesn’t make the cut, no matter how impressive the demo looks. It’s a bit like talking to someone on an overseas call, where they need to translate everything you say into their own language and then look up the answer and translate it back into your language before responding. That does not lead to a very responsive conversation!

These techniques do have their uses. And as the hardware improves and the algorithms get more efficient, we will see them used more and more. But for the common Game AI problems, (where to move to? what to target? what action to take on a moment to moment basis) there are far more simple solutions that we can use.

With this blog, I hope to shed some light on these simple, and sometimes not so simple, solutions. And I also hope to explore where new ML techniques might be appropriate.

Next up, I’ll cover some of the foundational building blocks of Game AI and we’ll start building some examples.

The views, thoughts, and opinions expressed on this website are my own and do not reflect those of my employer or any affiliated organizations.