Smarter Environments, Simpler Behaviors
The previous example reveals the importance of the environment in creating emergent patterns. In fact, in some cases, the environment is the cause of the patterns, such as Conway's Game of Life [Conway70]. The environment is a grid, which defines the likelihood of cells surviving or dying in terms of their neighbors. Surprisingly complex patterns, both stable and chaotic, can arise from very simple rules.
AI engineers can exploit the importance of the environment to increase the functionality of their NPCs and simplify the design. An early trend in robotics was to enhance the test world, such as painting white lines on the floor or decorating walls with sensor-friendly materials. This allowed the robots to cope with simpler AI—hence smaller processors.
Nowadays, a popular trend in robotics research is pervasive computing, whereby rooms are filled with miniature interacting devices—sensors and actuators (for instance, detecting doors or shutters, controlling lights). These devices collaborate together and with local robots who emergently provide the expected functionality with simple signals.
As game AI designers, we have the luxury of manipulating virtual worlds in a much simpler fashion to assist the development of synthetic characters. There are two different aspects to consider: what information is available, and how to provide it.
Not only can each object be used in a variety of ways, different players can also use the objects in various fashions. The objects are said to afford being used. For example, a door affords to be opened, a ladder affords to be climbed, and an item affords to be picked up.
A perceptual psychologist introduced the concept of affordance [Gibson77, Gibson79]. According to Gibson's theory, affordances are relationships between actors and objects. These relationships exist naturally, regardless of whether they are desired, known, or even visible [Norman99].
Because affordances are actionable relationships, they only exist between actors that can perform an action on the object. For example, a door switch affords being pressed by humans only, but not by most mammals. So, affordances can be understood as being context dependent.
The Sims takes advantage of such ideas by placing smart furniture in the houses. Each avatar (that is, human-controlled game characters) can immediately tell what to do with each of the items in the world. More conveniently, the avatars know exactly what each item provides. Just like with the robots, this approach allows the AI to be much simpler because the environment provides additional hints about its functionality. The NPCs have simple reactions but rely on concise information, which together produce complex intelligent behaviors.
Associating affordances and functionality with items in the world benefits the development, because it prevents having to compute that information. But how should this information be provided to the AI?
Perceiving and Broadcasting
Affordances simplify the processing of the perceptions in the brain by modeling relationships between actors and objects. As we may expect, there are many possible implementations, each corresponding to different ways of organizing the data: perceiving or broadcasting.
In one case, the animats interpret their perceptions and associate them with the corresponding information. This approach is particularly suitable when players in the game have different capabilities and, therefore, different affordances.
Alternatively, the game engine can broadcast the affordances along with each of the objects. This approach is particularly appropriate when all the players have the same abilities, so the objects have the same affordances.
Once again, hybrid solutions are also very appealing. The animats can alert the game engine as to which affordances they are aware of, and the engine can broadcast them with the visible objects. This has the advantage of flexibility and convenience, providing an efficient solution while respecting principles of embodiment.