Sponsored By

Teaching Your Games To Think: An Introduction To Artificial Intelligence

Playing and interacting with your game should be a no-brainer, but you definitely don’t want your game to be a no-brainer. Teaming up with someone versed in AI design, or learning the practice yourself, will help make your games immersive and interactive.

Pat Flannery, Blogger

February 21, 2012

11 Min Read
Game Developer logo in a gray background | Game Developer

 design3: Teach Your Games To Think

design3: Teach Your Games To Think

The resources available to modern game developers are unparalleled in their ease-of-use, simplicity, and professional results. Games built in premade engines like Unity and UDK can now visually compete with big-budget AAA titles, and scripting languages and alternative means of building logic (visual scripting) have brought gameplay into the same realm of accessibility. On the surface it appears that, given the right motivation, an aspiring developer could create an entire game without any outside assistance or knowledge of coding. However, there is one ‘sticking point’ left in the game development pipeline that is often overlooked: artificial intelligence. How will you configure the interactivity within your game? Unless your project specifically doesn’t require interactive logic, you’re eventually going to hit a brick wall in your development process. Let this article guide you towards a solution for your artificial intelligence woes, and help you finish a game that you’re proud of.


Learning to Think

So first off: what is artificial intelligence? In short, it’s when an “intelligent agent” receives information from its environment, makes a decision, and acts its decision back out on the environment. A great place to start learning about AI is through the free project www.ai-class.com, which is a series of videos, quizzes, and lectures that can take you from baseline to a pretty complete understanding of the concepts of artificial intelligence. After just a short time exploring the online classes, you’ll begin to realize that your traditional understanding of AI is probably a bit narrow. Rather than AI being just the brain of an NPC, it’s really an integral part of your entire game’s logic and probably the most important part of making your game something that can be interacted with. This might leave aspiring developers a bit frustrated with their own lack of knowledge and programming ability; even worse, it could be yet another reason for you to say “I don’t feel like making this anymore.” Hopefully we can make the daunting task of approaching artificial intelligence a bit more tangible, and get you motivated to face another tough, but entirely conquerable challenge in the game dev process.

So if you’ve started checking out ai-class.com, you’re beginning to get into the mindset of an AI developer - this isn’t the instantly-gratifying realm of visual arts. Rather, it is a thoughtful process of designing interacting systems. A great idea is to represent your AI’s logic visually or through some sort of easily accessible list system; for example, you might have an entity called Joe the NPC, along with a detailed list of his possible inputs and behaviors, looking something like this:

design3: AI Diagram

design3: AI Diagram

This type of diagram can help you wrap your mind around what’s going on within your AI system, what kinds of reactions you want to create, and how it all interacts with other events within the game. Clearly, as you build out your knowledge of coding and AI design, this diagram will become more complex; for example, “Player Hits ‘Action’” would be clarified to include that a raycast from the player would be required for “Action” to cue the resultant behavior. Even if your knowledge of programming/building an AI system is still next to nothing, these methods of organization will help you greatly when you either pair up with an AI-minded programmer, or learn the process yourself.


It’s Alive! It’s Alive!!

The part of learning AI that is undoubtedly the trickiest for aspiring game developers is actually implementing the code to control your NPCs, game feedback systems, etc. For years, this part of the process has been a straightforward case of programming and, for those unfamiliar with coding, difficult. Now, thanks to the advancements in game development technology, there are more options...but unfortunately implementation of your AI is still a tough process. A common question is: Why hasn’t this part of development been made as intuitive as other aspects of the pipeline? Many people have offered their input on what Chris Hecker described as “the Photoshop of AI”; or an easily accessible solution for non-programmers to work with artificial intelligence. An important talk by Professor Michael Mateas about this concept is available exclusively here (http://www.design3.com/industry-insight/item/2404-michael-mateas-presentation-revisiting-the-Photoshop-of-ai-debate), in which he spells out the problems with the idea of a “Photoshop of AI” and why artificial intelligence may never have an easy-to-use option. The gist of his argument is that because the options for AI interactions are nearly endless, a tool that took most of the work out for you cannot exist. For example, if our diagram above were instead for a sports game, the inputs and behaviors would be 100% different; the lack of consistency between games makes designing for all options redundant.

That being said, there are numerous options being developed to act as middleware between you and your engine to reduce the amount of direct coding required. An extensive list of resources can be found at the end of this article, and there may be even more that we overlooked (feel free to add in the comments section). In essence, these pieces of software are not intended to be the end-all “Photoshop of AI” - rather, they do what they can to make your interaction with AI systems more tangible, easy to understand, and intuitive. Commonly this involves removing the need for in-depth coding and replacing it with a modular, visually-driven interface; these systems (like the Xaitment suite shown below) intend to allow more intuitive adjustments to be made by designers without complex engineering to the underlying system. In effect they abstract the programmatic connections to a simplified visual interface. Most of these middleware programs are not free, and require the user to learn and develop additional skills specific to the software, but in doing so can offer a much easier (and faster) way to control your game’s AI processes.  design3: AI Diagram

design3: AI Diagram

  The Pupil Must Become The Teacher The most extreme difference between AI authoring and all other aspects of game development is that the software will not do extra work for you. You might apply a brush in Photoshop, drag it across the canvas, and achieve an end result that you couldn’t have planned on; similarly, you can tweak physics settings in Unity and discover new interactive dynamics. However, AI design requires that you know more than the software knows - you must have all your ideas in your head and use the code/middleware to achieve it. This fundamental difference explains why you haven’t ever found yourself ‘playing’ with AI tools as you might with Unity, UDK, Source or the variety of software used throughout the pipeline. In short, you must know more than your game in order for your AI interactions to be satisfactory; this might prove to be a difficult hurdle in your game development race, but if you truly dedicate to it, you can master the art of designing artificial intelligence in your games. If your time is spread too thin, don’t feel embarrassed to join up with someone more adept at programming - just make sure you get your intentions and ideas across clearly, and stay true to your original vision. No matter what choice you make, start looking into AI more deeply today to begin reaping the benefits it can offer to your game development projects.
design3 AI Resources 

 

 

Unity:

1) https://www.design3.com/training-center/engines-sdks/unity/coding/basic-artificial-intelligence-part-1

2) https://www.design3.com/training-center/engines-sdks/unity/coding/basic-artificial-intelligence-part-2

 

Additional Resources:

1) https://www.ai-class.com

2) http://aigamedev.com

3) http://www.gameai.com

4) http://software.intel.com/en-us/articles/designing-artificial-intelligence-for-games-part-1/

 

AI Middleware:

1) http://www.xaitment.com/english/products/xaitcontrol/features.html

2) http://rivaltheory.com/

3) http://www.plus7systems.com/index.html

4) http://en.wikipedia.org/wiki/List_of_game_AI_middleware

 

Pat Flannery is currently a Production Assistant at design3 and has been busy shooting and editing lots of interviews with game developers and industry professionals. Find him on design3.com as “pflannery” or follow him on Twitter, @design3video. Original Artwork by Bill Kiley.

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like