Computer games often contain creatures, active entities that move around and do things. The behavior of creatures is modeled on that of animals, which prowl around, choosing to eat, mate, or fight based on their perceptions of their environment. A computer simulation of a creature must explicitly model the creature's sense and actions, and the rules which connect the two. (This three-part structure is similar to the input-simulate-display main loop of a game program.) A creature's senses detect conditions in its world, and thus a sensing routine must test the data describing the states of objects in the game world. For example, in Atari 2600 Adventure a dragon (or bat) sensed which other objects were in the same room with it, and it also sensed the type of each of these objects. An action performed by a creature changes its own state or the state of some other object, and thus changes the underlying data which defines these states. When a creature moves itself, for example, it changes the coordinates that describe its own position. The rules for triggering actions by senses define the behavior of a creature. The dragon in Adventure is a good case study in rule-governed behavior.
The dragon chases some objects (like the player's cursor) and flees from others (like the sword which kills dragons). The essence of the chase algorithm is that the coordinates of the pursuer are compared with the coordinates of the prey, and the results -- greater than, equal, or less than -- tells whether each component of the pursuer's velocity should be positive, zero, or negative. If the roles of pursuer and prey are reversed, then the algorithm calculates a path for the creature away from the other object, not towards it -- a flee algorithm. Figure 7-l compares chasing and fleeing. If the prey moves while being chased, then the path followed by the pursuer can be quite complicated, even though the algorithm is simple.
Chasing and Fleeing
A creature can chase after or flee from any object. The dragon might, for example, flee from the sword at one time, and pursue the chalice at another time. But what happens when both the sword and chalice are in the same room with the dragon? The dragon must choose among (or perhaps make a synthesis of) its various inclinations. The solution used in Atari 2600 Adventure was, for each creature, to have a prioritized list of objects to which the creature responded. The creature's behavior is governed by the highest object on the list which is in the same room with the creature. Each creature has its own chase-flee list. The priorities of the three dragons (and hence their behaviors) are different. The bat of Adventure has a similar priority list. (See Figure 7-2.) The pursuit of an unmoving object quickly results in the pursuer sitting directly on top of the object, waiting there until an object of higher priority (like the player's cursor) enters the room to lure the guardian creature away.
Chase-flee lists for the creatures
in Atari 2600 Adventure
This scheme for controlling the actions of a simulated creature is reminiscent of a school of psychological thought called Behaviorism. According to this theory, living creatures respond to certain stimuli, so that the entire behavior of a creature can be specified by a set of stimuli, and the corresponding responses:
Stimulus l ® Response l
Stimulus 2 ® Response 2
. . . . . .
Stimulus N ® Response N
The algorithm using the chase-flee priority list meshes pretty well with the Behaviorist model. The presence of various objects in the same room with the creature is the stimulus; pursuit and flight are the responses. That the dragon is credible as a creature in the simple world that it inhabits suggests that its behavioristic instincts are a model worth considering for simple creatures. That an animated simulation of a creature in an interactive game provides a forum for testing the ideas of behaviorism suggests that video games might be a good foil for testing other psychological theories, and for explorations in artificial intelligence. Creatures could have goals, formulate plans, and try to execute them; or they could be moved from one emotional state to another; or they could contract friendships and hold grudges. Creatures like these could not only provide interesting characters for animated adventure games, but they could also exercise and test the models being simulated of planning, emotion, learning and knowledge.
Plans, emotions and bonds of friendship are internal mental states. A program which models these things simulates a creature's brain. The structure of a brain, human or otherwise, is a fascinating subject. The
field of artificial intelligence attacks this topic, but has fragmented itself, seeking to closely emulate various human abilities such as vision, use of language and problem-solving. Researchers are still immersed, after 30 years of effort, in discovering the mechanisms by which vision, language, and choice work. A machine simulation of a human-like intelligence, integrating these various abilities, is decades away. However, not all brains are so complex as a man's. Earthworms have brains, and even amoeba respond to stimuli with actions. It might be interesting and informative to start with simple models of creatures acting in simple universes (like the dragons in Adventure) and build up creatures with more complex behaviors from that foundation. Certainly, simple models of plans, emotional states, and knowledge could be defined. A creature's plans, emotions, or knowledge would affect its behavior. A plan is a sequence of actions to be carried out, with the intent of achieving some goal. An emotion is a state which affects what goals are chosen, with, for example, fear eliciting flight, and desire eliciting pursuit. Knowledge is a list of objects external to the creature, and their attributes and relations. Perhaps it is too ambitious to have tried to simulate the behavior of a man, a creature of 50 trillion cells, without first simulating the behavior of a one-celled amoeba.
Research into the behavior of E. Coli bacteria has turned up some interesting parallels with the dragons of Adventure. These bacteria have spots on their cell membranes which can respond to different concentrations of nutrients or toxins in their immediate surroundings. They also have flagella, whip-like appendages which can spin around to push them through their fluid medium. The behavior of a E. Coli seems to be that when conditions are improving, that is, when the concentration of nutrients is increasing or toxins decreasing, then the bacterium will motor straight ahead for long periods. But when its sensors show that it is moving into a less friendly environment, the flagella reverse their direction of spin, throwing the bacterium into a tumble which leaves it pointed in a new direction. Thus, the E. Coli travels randomly in various directions, but travels further in directions in which its lot seems to be improving. This behavior is effective in moving the bacterium out of regions with high toxin concentration, and into regions full of nutrients.
The behavior of the E. Coli is even less sophisticated than that of the simulated dragons. Rather than choosing in which direction to move, the bacterium is given a direction, and must decide if it is a good one or a bad one. In both cases, however, approach and avoidance are the responses to a set of stimuli from the surrounding environment. Also, both the dragons and bacteria require a mechanism -- judgment -- for deciding what to do in the face of conflicting stimuli. For example, what should the bacterium do when poisons and food are both becoming more concentrated? What should the dragon do in the presence of both a desired and a feared object? The mechanism of these decisions in the E. Coli is not yet known. The dragon of Adventure ignores all but its highest priority stimulus. More complex behaviors are possible, for example, by synthesizing an action from the responses to two normally separate stimuli. Advanced creatures sometimes "kill two birds with one stone."
Creatures, both simple and advanced, are often confronted with forces in their environments which they cannot control. Creatures can at least have knowledge of these phenomena, or instinct, which is a kind of hereditary knowledge. Knowledge or instinct guides a creature to safe behaviors in hostile situations. In complex creatures, knowledge and understanding can render menaces harmless. Birds have little to fear from bears. Man has conquered fire and controlled disease. However, not all phenomena are accessible to a creature's understanding. An E. Coli bacterium is not likely to comprehend the habits of the scientist who dabs nutrients and poisons into the dish it inhabits. Ants are not likely to understand the bulldozer that demolishes their nest. Similarly, certain mysteries confront human creatures. Why does the universe obey simple laws? Where can happiness be found? Why does death exist? Does time go on forever? Mystery beyond comprehension is more the province of religion than science. The unknowable is God.
Simulated creatures in computer games can interact with player-controlled entities, like the cursor in Atari 2600 Adventure. The player may have about the same capabilities and perceptions as the creatures, or alternatively, the player can be omniscient and omnipotent in the context of the game. He can play God. Depending on his personality, he can cultivate a universe of cringing and servile subjects, or a universe of jolly frolicsome creatures, coddled and protected by their creator. In either case, the absolute power of the human playing the game is unquestioned. Computer games like this can be created, provided that convincing simulations can be constructed of creatures with personalities, knowledge, and emotions. The creator of an imaginary world can be the God of that world. But lest we feel too powerful and mighty, it should be observed that we have no way of knowing that we are not ourselves being manipulated, casually and capriciously, in some greater being's imaginary world.
Copyright © 1983 Warren Robinett. All Rights Reserved.