During his keynote speech at Apply AI Innovations 2007 conference this week, Peter Molyneux delivered an interactive demo of Fable 2’s dog to an audience of game developers and AI enthusiasts.
The dog was introduced at GDC in March this year, but more exclusive details about the dog itself emerged in London — including how the dog’s artificial intelligence works. Lionhead is borrowing design and technology from the Black & White series as well as the original Fable.
The Three Laws of Game AI
Molyneux first presented three design guidelines, which he considers similar to Asimov’s Laws of Robotics. The idea is that AI in games generally, and the dog in Fable 2 specifically, should be there for your entertainment. It sounds obvious, but having a set of laws makes it easier to achieve! A game character should:
Not aggravate the player.
Focus around the player.
Look after itself.
The dog does this by getting out of your way but still running around you, anticipating your movement and acting as a guide, also not barking too much…
Teaching Your Dog New Tricks
The dog’s AI is built around the principles of the creature in Black & White, which apparently holds Guinness World Record for the most intelligent being in a game. This technology, however, seems much more appropriate for this dog than for those large creatures.
The AI behind B&W is explained partly in an article of AI Game Programming Wisdom 1. It’s traditionally called a BDI (belief, desire, intention) architecture, though Peter described it differently this time.
The desires of the creature are represented as a set of continuous numbers that evolve over time. These are used to select the next goal once the current one has been satisfied.
The Fable 2 dog presumably has desires for resting, pooping, peeing, and possibly affection and eating, etc.
Typical dog behaviors are not very goal directed, so this aspect of the AI architecture didn’t show so much in the demo. Most the behaviors Molyneux showed were very reactive: move in front of the player, go relax bladder, lie down.
However, it’s likely planning is used to decide specific details for these behaviors: where to urinate, what to play with, etc.
Based on Peter’s descriptions of the learning mechanisms, it seems a decision tree is still used for understanding objects (like in Black & White). When you give feedback to your dog, it gets an extra data sample to build the tree.
In Fable 2, you can train your dog in the typical way, by rewarding it or punishing it. For example, if your dog likes pooping in the neighbor’s flowers, you could correct that with the basic YES, or NO emotions of your avatar (depending on whether you like your neighbor or not). The same goes for the dog playing with his ball, or burying it.
The AI of the dog is implemented as a set of fixed rules in the engine, but the resulting behavior is context sensitive nonetheless. For example, if the player selects a sword, the dog attacks the nearest enemy, whereas selecting the musket would cause the dog to charge on the enemy that’s best to kill first.
Context sensitive combat behaviors.
The behavior of the dog is also adapted to the landscape. Emotion maps are painted into the world so the dog senses how he should react. The first time the player goes through parts of the world, the dog acts as a forewarning. However, when the player has been to a location before, the dog apparently only reacts to changes in the emotion map.
A Hollywood Director and a Crate of Beer
Lionhead has hired real actors, and a director from Hollywood to play out scenes from the game before they are produced. Peter mentioned they use a crate of beer instead of the dog when acting out the scenes!
When designing scenes in Fable 2, the dog is used extensively as a tool to elicit emotions from the player. Apparently, the story works without the dog also (so you could lock your dog at home), but the experience isn’t as rewarding.
Questions and answers about Fable 2.
Molyneux also mentioned the fact that the player cannot die and replay a scene of the game over and over. This helps remedy problems of the players becoming desensitized to the emotions of seeing the dog get hurt, for example. Lionhead uses heavy scripting as a solution to these situations, and apparently it was quite a hard problem to tackle. (The dog is also part of the equation.)
There’s some speculation that your dog may die before the end of Fable 2, but based on Peter’s hints I find that unlikely. It’s possible the dog might get kidnapped as a punishment for losing an important fight, and you’d have to go and rescue it. “Death must have a consequence” as Peter put it, and that’s a good way to achieve it. Lionhead did that before with the creature in Black and White 1, which still allows the player to have a happy ending to the game — dog included.
AI Elsewhere in Fable 2
Some bonus miscellaneous facts:
There’s a group mind for the villagers.
There will be about 1,000 unique non-player characters.
There are 20,000 lines of AI dialog recorded.
In summary, Peter keeps emphasizing that the AI in Fable 2 is just smoke and mirrors. While that may be true to a certain degree, it’s still better AI technology than most other games out there!