JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section


The term reactive has two meanings. The first sticks to the formal description—not too common during practical applications. The second is a much slacker meaning, allowing for small deviations from the theory.

Reactive by Definition

Whether behaviors or techniques, all AI components take an input and produce an output. For reactive AI, there is a particular property about the output; given a specific input, it will always be the same.

This can be interpreted as a function in the mathematical sense (see Figure 3.1). Each configuration in the domain (input) corresponds to only one configuration in the codomain (output). Naturally, these functions can take multiple input values and return multiple outputs, but this can be understood as one single configuration on the input and output.

Figure 3.1. A reactive mapping from the input to the output. The mapping is deterministic, because no ambiguity exists. All the inputs are assigned to one output only, but outputs may correspond to multiple inputs (many-to-one function).


Often, these functions are known as many-to-one. None of the inputs correspond to multiple outputs, so there is no ambiguity. Each output is fully predictable for this reason. Such components are therefore known as a deterministic.

Practically speaking, a reactive behavior always does the same thing in the same situation. A reactive component makes the same decisions, and outputs the same predictions for identical input conditions, which is particularly appropriate for computer games. Designers and producers tend to prefer predictable results.

Reactive in Practice

In theory, a reactive component would have absolutely no sense of state; it has no memory, however small. If it did, the mapping between domain and codomain would not be deterministic; an output that depends on a state variable potentially varies output based on the same input.

Strictly speaking, internal feedback is not reactive either for the same reason. If the preceding output is used to determine the next value, the same input could also lead to a different output. Both these examples reflect nondeterminism.

Using a small trick, it's also possible to consider these techniques as reactive (see Figure 3.2). If we consider the internal state, or the feedback connection, as another input, the mapping is once again reactive! There is no longer any ambiguity when the internal variables that would make the component nondeterministic are instead exposed as inputs.

Figure 3.2. A nondeterministic component can be interpreted as reactive if the internal state values are considered as an input. The state also may be updated reactively.


So in practice, components with a small sense of state or feedback connections are considered as reactive. Even when a small random factor is used to perform the mapping, it can be considered as reactive, too; the random number could be interpreted as an additional input.

      Previous Section Next Section
    Аренда опалубки перекрытий аренда опалубки перекрытий

    JavaScript EditorAjax Editor     JavaScript Editor