FEED Magazine
Playing God
<b>Mark Van de Walle</b> on Black & White's revolutionary artificial intelligence

WHEN YOU GO to the message boards for the new game Black & White, released by Lionhead Studios earlier this month, the most popular topic around seems to be crap. In post after post, the flight, trajectory, and eventual resting place of vast quantities of virtual crap is discussed in loving detail. Villagers are pelted with crap; fields are fertilized with crap; crap is produced and promptly eaten. There's evil crap and good crap. The arrival of both is occasionally greeted with dancing from local villagers. On other occasions, crap is desired but difficult to come by. Players' avatars, in the form of cows, tigers, and apes (known collectively in Black & White-speak as "creatures"), work mightily to generate it, and get nothing but gas and maybe some embarrassed looks.
Welcome to the current cutting edge in artificial intelligence.
The man who wrote the code that makes all this happen is Richard Evans, a former philosophy major and current next-desk neighbor to Black & White creator Peter Molyneux.  For the past three years, Black & White has been one of  the most hyped and highly anticipated PC games around (it'll be available on other platforms shortly). Now that Molyneux's brainchild has finally arrived, surprisingly enough, almost no one seems to think the hype was unwarranted. The game's mix of creature training, morality play, and world shaping has been hailed as the latest big step forward for the art of gaming.
The goal in Black & White is to literally remake a world over in your own image. You use your godlike powers -- a little "Hand-of-God" icon is your most direct presence in the game -- to convince the inhabitants of one of seven different primitive agrarian societies that you, and you alone, are the One True God. To accomplish this, you have to make your power felt. You perform miracles, which get more impressive as you gain believers. You can smite villagers (by dropping rocks on them, for instance) or save them (by arranging to water their crops, for instance). Mostly, though, you communicate with villagers by means of your painstakingly raised  creature, who goes into the world to perform deeds in your stead (hence the crap-throwing tigers).
While all this emphasis on training may sound similar to Artificial Life games like The Sims and Creatures, which also let you control towns and train (or torture) their inhabitants, Black & White differs in both scope and depth. The perspective zooms seamlessly from the one-on-one mode you use when you're training your creature to a god's-eye view ten miles above the planet. Perhaps more importantly, in Black & White all your relationships -- with your worshipers and particularly with the creature who is your avatar -- are direct and personal. When your monster does something good (or at least something that you want it to keep doing), your Divine Hand literally strokes it; when it does something incorrectly, the same Hand of God smacks it. Eventually -- ideally, anyway -- it grows into an active extension of your will, spreading your Word via its deeds. As a god, you're more Old Testament than Deist, more active meddler than detached clock-maker.
Ultimately, your decisions, actions, and style of play shape individual characters, villages, and societies, and eventually, an entire world. Creatures change appearance as they grow, becoming either demonic or angelic depending on whether you're a benign or malevolent god. The landsape can become a jagged Gothic nightmare or crystalline fairyland, reflecting your temperament.
Of course, in order to have this degree of responsiveness, every character in the game -- and the world itself -- must be capable of learning. Which means that to an almost unprecedented degree, the experience stands or falls on the strength of the game's AI, particularly its ability to "learn," to generate both useful and expected -- as well as unexpected -- responses to a variety of situations. So Evans and Molyneux have created villagers who must be taught to believe in and worship you. They've created creatures capable of learning in a multitude of ways, from imitation to a carrot-and-stick system. It's a neat combination of several different types of AI. The creatures run a variation the standard Artificial Life model, where a combination of simple, hard-coded behaviors are controlled by various motivations. In this case, the interactions between small sub-routines can produce higher-level behaviors that are complex and "lifelike" without having to resort to explicit coding of those behaviors. The creatures in Black & White, once trained, can seek out "bad" villagers to eat when they're hungry, as opposed to "good" villagers; the code allows them to distinguish between the two. For the villagers, the AI is more similar to what's been used in strategy games: a mix of hierarchical and group AI.  Here, behaviors are again broken down into parts, with some AI code controlling decision-making for the village population en masse and others controlling how those decisions are carried out on the individual level. "The town itself is a group mind, working out what needs to be done, and delegating jobs appropriately," Evans says. "Every time they react to something -- a friendly creature, a miracle, a house on fire -- they are controlled by a Reaction which is another type of group mind. When they dance, they are controlled by a different sort of group mind. It is these various group minds, coexisting, shifting priority over time, that give the villagers their varied behavior."
Until fairly recently, the kind of emphasis you see on strong AI in Black & White was rare in  gaming. AI coders had to fight for CPU power to make their creations go, and most games wound up sacrificing smarts for graphics. As recently as 1999, most games devoted only  .1% of  the CPU's resources to running the AI. This would be bad enough, but AI people were typically already working at a disadvantage, usually starting their work at the very end of a game's development cycle. (It's difficult, after all, to create intelligence for characters who inhabit a world that doesn't yet exist.) Over the past year, however, all that has changed. The march of Moore's Law and the increased muscle of 3-D graphics cards means that CPU power is no longer the bottleneck it once was. According to a recent article on the game development site Gamasutra, an average of 250% more of a computer's resources are now devoted to AI. And with the introduction of more flexible algorithms, work on AI can start earlier: Instead of the whole thing getting rushed in the final weeks, basic behavior gets written at the beginning and is tweaked as work continues. Maybe most importantly, the success of Half-Life and The Sims, among others, has pushed AI to the fore: Developers have discovered that smarter opponents, and smarter worlds, sell games. As of last week, Black & White is the top-selling PC game on the market right now. Something for John Ashcroft to consider -- in what other industry is the smartest kid in school also the most popular?
FEED caught up with Evans, the man behind Black & White's mind, via e-mail, and got his thoughts on a variety of topics: group minds; how creatures, villages, and even worlds can learn; the things he had to leave out of the game; and the next big thing in AI.
Next: Mark Van de Walle interviews Richard Evans.


FEED: The heart of the game, in a lot of ways, is the creature-learning routines. What did you do there that was new?
EVANS: Well, the creatures learn in a variety of ways:
-- Learning facts (that there is an enemy town behind that hill)
-- Learning how to do things (how to fish, how to cast miracles)
-- Learning which desires to prioritize (do you want a greedy creature? a compassionate creature? a playful creature?)
-- Learning which factors should be most important for particular desires. For instance, there are lots of possible motives for [eating]: Having low energy, feeling depressed, seeing something tasty. You can [teach] your creature which factors are most important, and which to ignore.
-- Learning which types of objects are most suitable for satisfying particular desires: What sorts of things are best to eat? What sorts of things should you try and help?
As well as many different sorts of things to learn, there are also different types of situations which prompt a learning experience. The creature learns when he is slapped or stroked, but also, more importantly, he learns from watching what you are doing, trying to understand the motives behind your actions.
So there are a variety of types of situations that can prompt a variety of types of learning. This happy bundle of learning types coexist together snugly.
FEED: Do you use a variation of Artificial Life code for the creature learning, or is it something else, like a combination of pathfinding and A-Life?
EVANS: To implement the creature learning, we used a combination of methods: We used perceptron training for learning desires, and symbolic (decision-tree) learning for the opinions. Perceptron training has been used before in A-Life programs like Creatures, but decision-tree learning has not to my knowledge been used before in games.
FEED: As for the villagers -- how smart are they? How does their intelligence compare, in terms of its complexity, to that of the creatures?
EVANS: Given how many of them coexist in a world, the villagers are very smart indeed. Like creatures, they have basic bodily desires: survival urges, urges to sleep and eat. But they also participate in a variety of group activities, both for their own sake, and for that of their colleagues. Their behavior is driven by a variety of group minds.
FEED: Can you talk a bit about the group interaction among the villagers?
EVANS: The town itself is a group mind, working out what needs to be done, and delegating jobs appropriately. Every time they react to something -- a friendly creature, a miracle, a house on fire -- they are controlled by a Reaction which is another type of group mind. When they dance, they are controlled by a different sort of group mind. It is these various group minds -- coexisting, shifting priority over time -- that give the villagers their varied behavior.
FEED: How open-ended is the AI? Were you thinking in terms of making the AI extensible when you built the code?
The AI is very extensible. If new types of objects are introduced into the game by other people, the creature will automatically know about it, and can learn how to behave towards it specifically. It is also easy to add new actions or animations to the creature. You can also add new motives and motive-factors, but these changes require a recompile.
FEED: Have you been surprised by any of the creatures' -- or villagers' -- behaviors so far?
EVANS: The first time the creature was put down in the game world, he just stared at his feet. I was puzzled, but after debugging found that the creature was trying to eat himself. He was hungry, and had spotted himself as a nearby convenient object!
There are a number of sites on the Net, with funny unanticipated creature behavior on them. Look at Planet Black & White or Black & White Community site.
FEED: How closely did you work with Peter? Or rather, how did you and Peter work together -- was it a matter of his providing an overall picture and the AI fitting into that, or did you work directly together on the larger issues of the AI?
EVANS: I sit next to Peter, and I think he feels that I don't wash enough and smoke too much. We worked closely together on the villager reactivity, the alignment, and the foundation classes. Peter also helped me with the creature, introducing the critical concept of the leash.
FEED: What was the most interesting AI issue you got to explore while you were working on Black & White?
EVANS: The issue of empathy, the way the creature keeps a mental model of his master.
FEED: Was there anything that you really wanted to include in either the creatures' or the villagers' AI that you had to leave out?
EVANS: Anticipation.
FEED: Can you talk a little more about that? Like what kinds of behaviors anticipation involves, etc.?
EVANS: The agents in Black & White are reactive and proactive, but they are not anticipatory. They are reactive in that they respond appropriately to unusual events. They are proactive in that they decide what to do based on their desires. But they are not anticipatory: They do not plan ahead, or see the consequences of their and others' actions.  They are incapable of calculating counterfactuals: "What would happen if?" So, for example, a creature might have decided to put down a rock.  We need to hard-code the fact that he needs to put it down in a safe place to stop it from damaging people as it falls; if the creatures could calculate counterfactuals, they could work out that if they were to drop the rock there, it would cause damage,  so they must drop it elsewhere. In future projects, we hope to build a Counterfactual Engine, which would be used by the agents so that they could be more flexible.

Mark Van de Walle is a contributing editor at FEED. His book on trailer park disasters, Magnets for Misery, will be available soon from RE-Search/Juno Books.

Other articles by Mark Van de Walle

Back to Article