Game AI is where the action is! By now everyone's noticed the diminishing returns in computer graphics, and programmers instead try to keep their interest with arcane hardware. Why do you think the PS3 turned out that way? :-) If it wasn't for that console, system programmers in game studios would have moved into investment banking IT by now...
Jokes aside, artificial intelligence in games is a continuous stream of challenges ranging from low-level optimizations to key gameplay systems. As anecdotal evidence, I asked some veteran AI Programmers for their best moment in their career, and here's what they replied. You'll hear about their stories and experiences on BIOSHOCK, METROID PRIME 2, F.E.A.R., HALO 2 and MASTER OF ORION 3.
Every project has its fair share of bugs, and you will run into some as well unless you're doing something wrong! Those moments are some of the most entertaining during the development of a game.
John Abercrombie, Lead Programmer on BIOSHOCK INFINITE and Lead AI on BIOSHOCK and SWAT 4, tells two stories from the trenches at Irrational Games:
“One of my favorite moments was when I was working on the BIOSHOCK AI. It was late, a lot of us were working very hard because we wanted to make an amazing game, and we needed some comic relief. So I made the Grenadier splicer throw cats instead of grenades. Hilarity ensued.
Also the time when we first got animation to ragdoll transitions working for guys jumping into water. We basically had a guy in a large square room where there was a square platform in the middle surrounded by water. It was cobbled together, so basically the guy ran towards a point he knew was in water, played a jumping animation, and transitioned into a ragdoll. Unfortunately the velocity transfer between the animation and ragdoll had a bug that caused the AI to leap at a fantastic speed across the water and into the wall. I then turned on slow motion and played Elton John's Rocket Man.” — John Abercrombie
As an AI programmer, you should keep a folder of screenshots and videos of funny bugs. Those are not only entertaining to go through later, but extremely motivating to see how far you've come over the course of the project.
Paul Tozour worked on the METROID PRIME series at Retro Studios for five years:
“It's always the moment when you see a character start to think for itself. When you find yourself surprised by a character, even though what it did seemed entirely natural and smart and appropriate, and even though you coded every part of its behavior, it did something you weren't expecting at all, and you have to trace back through its behavioral model to figure out exactly why it did what it did — that's when you've created something that's begun to be able to think for itself. Nothing can compare to that experience. It feels a little bit like you've created a life form on a very basic level, and that's just an extraordinary feeling.
The one that sticks out the most for me was the creation of Dark Samus in METROID PRIME 2: ECHOES. For the first Dark Samus battle, we were experimenting with ways of making Dark Samus move, and we couldn't get anything that really looked cool and unique enough for such an important character. I came up with a way of doing her locomotion based on blending 8 different animations that made her hover inches above the ground — it allowed her to face any direction and also move any direction (not necessarily the same direction) simultaneously, and really gave her a very eerie and supernatural vibe. It looked a bit like effortless psionic figure-skating. After that, Game Director Mark Pacini came up with the idea of having Dark Samus rise into the air and body-slam into the player. Once we got those two working and put Dark Samus into the arena, her personality just came out in spades.
I was really happy with that encounter. It was a lot of fun, and very different from the stereotypical "giant enemy monster that you run around and stare up at" style of boss encounter.” — Paul Tozour
It's this process of iteration and polishing that Paul describes that leads to memorable characters with polished behaviors.
Most engineers have a tendency to want to over-estimate the complexity of the problem and over-engineer the solution. Yet there is a lot of beauty to be found in small and elegant solutions.
Damián Isla was the AI and Gameplay Engineering Lead at Bungie, who worked on HALO 2 and HALO 3. He explains one of the best moments in his career:
“Getting the AI driving the warthog working for the first time was a great moment. It's a reasonably tough path-finding/following problem (can you say "nonholonomic system"?) and while they didn't drive particularly well at that stage, it was gratifying to see the AI doing something clearly new. It was also a good lesson on how, even with simple hand-tuned controllers, you can still get pretty nice human-looking motion if you pump that output through physics on the way to the screen.” — Damián Isla
While physics in this case helped Damián create human-like driving, often physics can also cause particularly difficult bugs to resolve!
It's not only graphics programmers that have to work close to the hardware for optimizations. Sergio Garces finds this one of the best parts of the job.
Sergio is a Senior AI Programmer at Radical Entertainment, where he worked on [PROTOTYPE]. He previously was Lead AI Programmer at Pyro Studios for IMPERIAL GLORY and PRAETORIANS.
“The best part of being an AI Programmer is that our area extends from the deepest bowels of the lowest level code all the way to helping game designers and animators come up with fun characters and situations. Personally, I derive satisfaction from both. I enjoy shaving a few microseconds off a pathfinder by tinkering with structs to make them more cache friendly, or by implementing an obscure algorithm to make the heuristic a bit better. It's the same rush you get by playing with dark magic.
On the other end, nothing compares to the feeling of transforming a bunch of bytes and animation clips into an interactive character, that can move around and make decisions. This is especially true at the beginning of projects, when you get to see the result of your hard work for the first time. There is always a tipping point when the code works well for the first time; before that, you see only the promise (and a mountain of bugs) but suddenly the character works well enough that you realize what it's going to become, and how cool it can be.” — Sergio Garces
Feedback from Players
The great thing about AI Programming is that your systems continue to live long after you're finished with them! When done right, this can be a great blessing.
Jeff Orkin was a Senior AI Engineer at Monolith Productions where he was responsible for the AI in F.E.A.R. and NO ONE LIVES FOREVER 2. One of Jeff's best memories was after the game was released:
“I really enjoy hearing game players recount their experiences with the AI, after a game ships. My interests lie in creating systems for autonomous behavior and unscripted gameplay, so it's exciting for me to hear how these systems play out in the wild. For example, after playing F.E.A.R., someone emailed:
«I was slowly maneuvering down the hallway when a group of two or three soldiers emerged and started firing. One hid in a small alcove while the other two occupied positions in the hallway to fire at me. I lobbed a grenade 'rebound style' off of the wall furthest from the hiding enemy to try and bounce it into the nook. When the grenade exploded, it killed two of the three enemies, and knocked down one of the shelves partially. Remaining enemy proceeds to duck down behind the semi-shelter created by the fallen shelf. I stand and fire a few rounds into the air over his head. The enemy lobs a grenade my way, forcing me to take cover behind a wall. Then, taking the new level layout into consideration, the soldier did a very cool-looking dive-roll under the shelf and stood up inches from my face. Two shots, and I saw red.»
” — Jeff Orkin
Cracking Tough Problems
The games industry is famous for it's challenging problems with tight constraints, and game AI is no exception. Kevin Dill is a games industry veteran who worked on titles such as MASTER OF ORION 3, KOHAN 2, IRON MAN, and the ZOO TYCOON series, as well as being AI Programmer at Rockstar New England. Kevin's best moment goes back to the start of his career:
“The best moments as an AI programmer are definitely the ones when you figure out how to crack the problem, and everything you need to craft an elegant (and intelligent looking) solution just sort of falls into place. One particularly memorable one — debatably one of my first — was when I was working on Master of Orion 3.
That game had solar systems connected by star lanes, with movement was restricted to the lanes. A given solar system would typically have around 8 planets, ranging from small hot planets like Mercury or Venus, to nice terran planets like Earth or Mars, to gas giants like Neptune, on out to cold rocky planets like Pluto. And of course it had a wide variety of races, many of which would prefer very different planet types. For instance, while humans do best on terran planets, some races prefer gas giants, or even the cold rocky planets at the outer reaches of the solar system.
Our first attempt at a colonization AI would just look at all the available planets that were nearby, and would colonize the one that was best for that race. The problem was that then we ended up with our galactic empires tremendously inter-meshed, as each race cherry picked the planets it liked out of a solar system and left the others to other races. This got ugly when wars started. Worse, as a player the AI races would continuously come in and colonize unused planets in your systems, which was really annoying.
The trick was to use the movement limitations imposed by the star lanes to figure out what was inside or outside of my borders, and then adjust my preference for planets accordingly. For instance a planet that lets me consolidate my borders, reducing the number of places I have to defend, is really attractive even if it otherwise isn't very nice. Similarly, a planet that's perfect for my race, but is smack dab in the middle of somebody else's empire, might not be the wisest choice (unless I'm prepared to go to war in order to get it).
Figuring out that that was what we needed, and then brainstorming the graph walking algorithm to make it work, occurred over the course of a long lunch, bouncing ideas back and forth with Alex Sramek. One of the most memorable (and enjoyable) lunches of my career. The two of us eventually wrote an article on the technique, which was published in AIGPW2, for those who are curious...” — Kevin Dill
As a professional AI programmer, you can expect to encounter all these situations over the course of a game's development cycle. And that's what makes it all worthwhile!
In follow up questions & answers with our resident experts, you'll find out why:
Game AI requires you to work with many disciplines, from design to animation and production.
You get to sit in the middle even, and affect huge changes on the game and own a very visible piece of its design -- maybe more than other developers realize!
You'll be able to know the codebase and many different systems as AI interacts with all of those as well.
There are more opportunities in game AI than almost any other aspect of games. You have room to innovate!
We'll be publishing this as part of a special report on Game AI in Industry for those of you eager to find out more about what goes on behind the scenes. We'll be emailing the report (free) as part of the launch of AiGameDev.com PLUS, so don't hesitate to subscribe here!