ValueWriting
is an important operation which determines how values are written to an objective. Choosing the right ValueWriting
type becomes especially important when combining different behaviours. It is a very powerful tool because it enables you to combine/blend AI behaviours like layers in well-known image manipulation tools, e.g. Photoshop or GIMP. However, ValueWriting
corresponds to the direct writing induced by each percept. To have control over truly separated layers like in image processing tools, have a look at the Layer Blending mechanism in combination with ValueWriting
. The following different types can be set.
Value Writing Type | Description |
---|---|
AssignGreater | Overwrites the existing value if the new value is greater. |
AssignLesser | Overwrites the existing value if the new value is lesser. |
Addition | Adds the new value to the existing value. |
Subtraction | Subtracts the new value from the existing value. |
Multiplication | Multiplies the new value with the existing value. |
Division | Divides the existing value by the new value. The special case that new value is 0 is handled. |
Note that most of the operations are not commutative, like its known from math. Subtraction
, Division
and AssignGreater
respectively AssignLesser
depend strongly on the Order
of the corresponding behaviours.
The effects which different value writing types have on the process of sampling the world are illustrated in Figure 1 below.
Figure 1: Shows the effects of all ValueWriting
types. Therefore, every agent perceives two objects at its right using a Seek behaviour. First, the green object is sampled with AssignGreater
. Second, the red object is sampled with one of the six operations so that we can observe the effect of combining behaviours by different value writing types. From left to right: AssignGreater
, AssignLesser
, Addition
, Substraction
, Multiplication
and Division
.
One of the most powerful and impressive value writing types is the Addition
. For example, by using Seek together with Addition
, we get a clustering behaviour which writes high magnitudes for the receptor directions where the highest number of interesting objects are located. The same can be done for Adjust which then clusters the orientations of multiple perceived objects. Other interesting effects can be achieved using other value writing types. Just a small impression: by using Subtraction
together with Seek on certain objects you can re-construct some kind of Arrive behaviour for your agents when your character controller uses the resulting mangitudes as speed multiplier.
Note that the ValueWriting
behaves differently when combined with LayerBlending
. The reason is simple: When writing values to a completely new layer, this layer must be initialized somehow. The intermediate layer is initialized with the neutral element with respect to the set ValueWriting
operation: 1 for Multiplication and Division, 0 otherwise.
To be honest, even we are standing just at the beginning on what cool effects can be achieved using this kind of layer mechanism. Over time, we will publish more and more tutorials making use of this technique on our website.