The last post about Game::AI++ was very popular, so here are more details since I’m busy writing some documentation anyway! It’s more of an executive summary this time, so feel free to comment or ask further questions…
Note: You can still sign-up to the newsletter in time for the first release on August 1st.
What Kind of AI Can I Use for My Game?
These days, if you’re serious about building great character AI, you’ll either implement:
A behavior tree as used by Halo 3 and Spore. Consider these a generalization of hierarchical finite state machines, since they allow you to place custom code at any level in the hierarchy.
A planner as used by F.E.A.R. and a few other action titles. Typically, these use A* search to solve problems which involve reaching a goal state from any in-game situation.
Where Can I Start Integrating These Techniques?
You have two possible options:
Either license a middleware solution if you’re happy to pay for a HFSM,
Or build your own engine in C++ or on top of Lua (or your game’s scripting language).
There aren’t any other tools or libraries available, whether behavior trees or planners, that work well for actor behaviors.
Should I Think About Implementing My Own AI Engine?
Certainly if you have the time and experience, go ahead! But getting these techniques right separately takes a bit of experience, and if you want to combine them together it’s much more difficult.
Ultimately, however, that’s where things are heading: combining together designer control in the form of a behavior tree and automated problem solving provided by a planner.
How Can I Combine Designer Control with Automated Problem Solving?
A hierarchical planner is one way to do this — and arguably the most reliable. For example, various academic hierarchical task network (HTN) planners provide such functionality. However, there aren’t any implementations that integrate well into simulations written in C++ (most are Java or Lisp).
But the main problem with these planners is that they give you very little control over the execution of the plans, so you can’t handle special cases with custom code like with a behavior tree. Ideally, in a complex dynamic world, you want to have as much control over planning as execution.
Is There An Implementation That Handles Planning and Execution Uniformly?
Not yet, but that’s where Game::AI++ comes in. The logic is structured as a custom graph, where each node provides an algorithm for searching itself modularly. The result of the search is another arbitrary graph.
This design has two main advantages:
It allows both planning and execution as long as your actions and conditions support both modes. A planning tree simply returns the execution tree as the solution.
These graphs can model both behavior trees and search-trees of a goal-oriented planner. Designers can thereby combine the two together to get both realistic and intelligent behaviors.