Arguably, much of the AI design is about emergence. Most of the components in the architecture are not aware of each other (transparency); they just provide an output. As this output is assembled, it emerges into purposeful behaviors.
Reaching a goal in space with reactive movement is an example of emergence by sequence (see Figure 43.1). The policy is to head toward the target while avoiding obstacles. If a turn of over 90 degrees away from the target is necessary, a wall-following behavior is engaged until the target is within a direct line again. This approach works for a majority of layouts—but not all.
An example of emergence by combination of actions is circle strafing. The two primitive actions are to look toward the enemy and to step sideways. Emergently, the pattern created is a circle around the enemy's location—ideal for combat behaviors.
Another example is the emotional system from the previous chapter; neither the emotions nor intelligent reactions could provide complex behaviors, but combined, they offer believable results.
Even high-level strategies emerge from straightforward tactics. For example, retreat when the enemy is dominating, locate items or weapons, and attack with the element of surprise. Even such reactive behaviors can match the levels of complexity of planned tactics in many cases.
As well as behaviors of individual creatures, emergence also applies collectively (a more popular definition of emergence). Groups of NPCs with simple behaviors can perform complex tasks together. Ants, for example, are particularly effective as a colony. In single-player games, combinations of different enemy types can be particularly tough to conquer as a group, despite being simple to defeat as individuals.
In large realistic worlds (for instance, simulations of small cities), the environment is so rich that each character has vast possibilities. Such designs leave room for emergence to create very interesting patterns—even with NPCs of fixed behavior. This can be somewhat problematic for designers, because the outcome can emerge to completely unforeseen patterns—which could become bugs!
Embodiment can help tremendously from this point of view. When the design of individual NPCs is biologically plausible, the higher-level patterns that emerge from the simulation are likely to be realistic—and therefore acceptable.