Polarith AI
1.8
Context

front-end / back-end: AIMContext | Context

The Context is the main component of Polarith AI (for Movement, short: AIM). It is required by every concrete AIMBehaviour and holds important information like parameters for the internal ConstraintSolver, the objectives, the (Planar) Sensor and it manages the attached behaviours. Furthermore, the indicator is configured here, it is responsible for visualizing objective values in-scene at runtime.

Properties

This component has got the following specific properties.

Main Properties

Property Description
UpdateFrequencyDetermines how often an agent is updated within one second. If it is set to 0, the standard Unity update method is used, otherwise, an Unity coroutine is used.
Threaded If enabled, the agent is handled by a Performance component if there is one within the scene.
SensorShared If disabled, the attached sensor is cloned so that the manipulation of the sensor at runtime cannot affect other agents.
Sensor Used to sample the world, whereby it determines the problem space where the agent can operate.
SelfObject If not specified, the game object where this component is attached is used to extract percept information for this agent, like Velocity or Position. So this field can be used to separate the AI components of your agent from its physical or visual representation into an own game object. The SelfObject is not perceived for further processing in its own Context, but child and parent objects are.

Indicator Properties

Property Description
Enabled If enabled, the indicator is visualized. Note, you must active Gizmos in Unity's PlayMode.
Wireframe This is only relevant when the gizmo is drawn as a mesh (see ResolutionThreshold). If enabled, a wireframe mesh is drawn. Otherwise, a solid mesh is drawn. Note, it may be used to avoid unwanted occlusions.
ShowReceptors If enabled, the receptors of the attached sensor is visualized.
ShowConstrains If enabled, the constraint for each objective is visualized.
DrawDoubleSided If enabled, the mesh is drawn in a way that it can be seen from both sides.
ResolutionThreshold If the ReceptorCount of the attached sensor is greater than this number, the indicator is drawn as a mesh (depending on Wireframe). Otherwise, the indicator is visualized using lines.
CustomScale Resizes all drawn gizmos additionally to the objects scale.
Spacing Controls the space between the visualized objectives.
SolutionColor The color of the receptor which corresponds to the found solution.
InterpolatedSolutionColor If an interpolator is used (e.g. Planar Interpolation), the resulting best direction is drawn in this color.
ConstraintColor The color of the given constraints for each objective.
ReceptorColor The color which is used to draw the receptors.
LineColor The color of the lines used to separate the objectives from each other.
ObjectiveColors The color for each objective. Note that this color pattern is repeated if the number of objectives exceeds the number of specified colors.

Objective Properties

Property Description
Objectives Objectives of the internally specified MCO Problem including their corresponding constraints which are used by the internal MCO solver.
Min If enabled, the solver minimizes this objective, otherwise, it is maximized. For example, it is likely that you want to maximize your interest objective and to minimize your danger objective.
Norm If enabled, the objective values are normalized before the context is evaluated.
Unlimited One and only one objective needs to be marked with this flag so that it ignores the constraint and can be considered as the main objective. Normally, this may always be the objective which should be considered as good or interesting for an agent.
Constraint Threshold to filter possible solutions which violate this constraint.

Remarks

If you set up a constraint for a maximized objective, the threshold works the other way round. Instead of selecting solutions which are equal to or below the given constraint, the system considers only objective values equal to or greater than the given threshold.

The SelfObject can be used to distinguish between objects inside an AIMEnvironment. E.g., a group of enemies that should avoid each other, and thus, perceive themself. The SelfObject prevents a specific instance from perceiving itself, and thus, prevent to create unwanted magnitudes. Note that only a single game object may be ignored this way but not its parent or child game objects that may belong to the same Unity layer, AIMEnvironment, respectively.

As the very foundation of the movement AI system, Context is interconnected to other important system modules. This is illustrated in the following figure.

Figure 1: Shows the four main modules which are managed by or interconnected to the Context.

Imprint