DigiPen isn’t your typical college, and our course catalogue reflects that. In our Class Select series, we’ll explore a few of the many interesting and unusual courses we offer our students.
When going above and beyond on a class project, one might expect to earn some extra credit, or a compliment from the instructor at best. But DigiPen’s CS 380 Artificial Intelligence For Games is different than most college courses. “Just today, I gave a full tour of Nintendo of America to the top three students from class who wrote the fastest A* pathfinding algorithms for their project,” adjunct instructor Steve Rabin smiles. It’s a coveted prize he’s offered his DigiPen computer science students since he started teaching the course 18 years ago.
Rabin, a 26-year Nintendo software engineer with 16 Nintendo patents and a bronze Mario statue to show for it, brings an incredible wealth of experience to the course. Rabin has been at the forefront of the video game AI community for decades — editing, organizing, and contributing to the Game AI Pro and AI Game Programming Wisdom book series; leading the Game Developers Conference AI Summit since 2009; and founding the AI Game Programmers Guild in 2008. “I love how games are made. It’s fascinating,” Rabin says. “That’s what’s special about this course to me. Every class is full of fascinating ideas about different AI topics, and it’s all rooted in the real code that goes into real games. My perspective is that anything a game AI programmer has got to do, that’s what we’re going to teach.”
The class begins by addressing the most fundamental aspect of AI programming. “How do you author behavior?” Rabin says. “That’s AI architecture! There are many different ways to achieve your specific idea for what you want this crazy boss to do.” For their first project, students learn how to create a “behavior tree,” one specific kind of AI architecture that has risen to prominence in the game industry, which students practice building using a “visual programming language.” Although students work extensively using the C++ programming language throughout the course, visual programming languages simplify things by presenting the code visually, as its name implies. “You make what kind of looks like a flow chart,” Rabin says of the behavior tree approach, which allows the programmer to connect different behavior “nodes” to control and direct the flow of an AI’s decision making based on specific parameters.
For their next project, students dive into pathfinding, one of the most essential, yet CPU-intensive tasks an AI programmer takes on when developing a game. Making a game character travel from point A to point B on their own is a simple, but deceptively complex challenge. Students learn how to solve the problem using the A* (pronounced A-star) search algorithm, which searches out and determines the fastest, most optimal path between two points. “Those searches can take a long time, but when working on games, you’ve got to write fast code, or else you won’t be able to run the game at 30, 60, or 120 frames per second,” Rabin explains. “With certain games, you might have 500 different characters all pathfinding at once, so optimization is extremely important.”
With the previously mentioned Nintendo of America tour as a prize, students set to work trying to write the fastest A* search algorithm possible for the project, which is tested using a custom engine Rabin wrote for CS 380 named the “Rabin Engine.” In a matter of minutes, a 3D mannequin guided by the students’ algorithms is run through thousands of randomly generated path requests in a set of 2D mazes to determine who wrote the speediest, most optimized code.
Once students find their own way out of the maze of AI pathfinding, they build on that knowledge with their next project — terrain analysis. Students learn how to combine pathfinding with a number of AI techniques that start to give characters the ability to strategize based on the environment and sensory feedback. “We learn how to model vision and hearing, how AI can find safe paths, avoid danger, figure out where to stand to shoot people, and then hide to be safe,” Rabin says. “We also learn how to make them hunt down the player! We can make AI agents legitimately search for the player around the map using what they’ve seen.” Students demonstrate their understanding in the Rabin Engine, toggling different modes that exhibit each AI technique on a 3D mannequin as it moves through various 2D maps, sometimes with an additional “player” mannequin for them to hunt down.
Throughout the course, students’ learning isn’t limited to the material covered in each project. Each class covers completely new ground, from procedural generation, to the science behind human reaction time, to the math that can help determine whether a two-handed sword, dagger, or spell is the best attack for any given situation. “Should I shoot, reload, or run away? Well, you can draw a curve to determine that,” Rabin says. “What’s neat is, now that curve is a personality, and you can give different curves to different guards to make one more of a scaredy-cat or one more aggressive.”
In fact, according to Rabin, CS 380’s designation as a computer science course only tells part of the story. “Something surprising about my course is that it’s actually half game design,” Rabin says. “It’s very easy to program a killing machine that can beat the player, but that’s not the goal. The goal is to make a fun, engaging, handcrafted experience.” Throughout the course, Rabin draws from an extensive list of real-world examples to illustrate how that goal has been achieved through clever AI in landmark games like Splinter Cell, Spore, Fable, Black & White, The Last of Us, and even baseball video games. “How do AI players work with each other to get the ball? It’s a whole thing!” Rabin laughs. “There are so many topics and they’re all interesting. It always feels like I’m telling secrets to the students.
For their final research-based project, students get a chance to dive into any AI concept from the course that caught their interest. Done solo or in groups of three to four, students create a demo of an AI topic of their choosing, give a presentation on it, and write a five-page paper about their work. “The whole class is an exploration, and for their final project, I just want them to have fun and pursue their interests,” Rabin says. Students are allowed to use the Unity or Unreal engine, the Rabin Engine, or even their game team project as the source code. “They don’t have to make something from scratch! If they’re working on their game project but want to add some really neat AI to it, they absolutely can,” Rabin says. “I just want them to be comfortable and do something cool with AI.”
Rabin’s passion for AI and its power to achieve “cool” results is infectious. Some might even call it viral. “Check this out,” Rabin says, grinning as he opens up a command prompt window. “I’m going to show you how we can use AI to roll a virtual D20 that intelligently recombines the lyrics of ‘Never Gonna Give You Up.’”