Difference between revisions of "Context type"

From AI Product Manuals
Jump to navigationJump to search
m (Davemark moved page Context Type to Context type without leaving a redirect: Capitalization)
 
Line 3: Line 3:


== Concept ==
== Concept ==
The Context Type for a [[Behavior]] specifies how the Behavior should apply the scoring and effects of the Behavior.
The '''Context Type''' for a [[behavior]] specifies how the behavior should apply the scoring and effects of the behavior.


== Implementation ==
== Implementation ==

Latest revision as of 14:13, 7 October 2021

This page is part of the IAUS Manual.BrainBehaviorBehavior TypeDecisionAI Entity

This item is a component of a Behavior.

Concept

The Context Type for a behavior specifies how the behavior should apply the scoring and effects of the behavior.

Implementation

Code

It is stored as a simple enum, "ContextType" in the enums file.

enum class ContextType
{
	StandAlone = 1,         // Works regardless of any specified target
	Self = 2,               // Uses owner's agent as target
	SingleTarget = 3,       // Can be used on target agent in the world -- scored per target
	LocationTarget = 4,     // Is used on a specific, single, pre-determined location in the world
	SingleTargetOnSelf = 5, // Scored per target agent in the world but used on self
};

Stand Alone

"StandAlone" can be used for anything that isn't acting upon an object. This is considered an un-targeted behavior. For example, a random wander behavior that is going to select and move to a nearby world location would be good for "StandAlone."

Self

The most commonly used items are "Self" and "SingleTarget". Self just means that the Behavior is scored once and the implementation of the BehaviorType is applied to the acting character itself.

Single Target

SingleTarget, on the other hand, is scored once per potential target (thereby creating individual Decisions for each combination of the Behavior and a Target) and executed specifically at that Target.

Note that there is often a distinction between these two with an action. An emote of "yawn" is something that is played by the character itself and is un-targeted (and therefore could be "StandAlone". However, an emote of "wave" is necessarily directed at another agent and would, therefore, need to be specified as "SingleTarget". A good way of understand which one to use is to ask the question, "who am I going to do this on/to?" In the above examples, you aren't going to yawn at anyone. However, you can decide among many potential targets to wave to. ("Should I wave at Chuck or Ralph?")

"SingleTarget" specifically excludes the agent that is considering the behavior. Therefore a "heal" action that the character can perform an allies or on itself would need to have two separate behaviors.

Location Target

"LocationTarget" specifies that there will be a target location in the future. However, unlike "SingleTarget", it isn't scored more than once. An example would be using an area of effect spell. You have decided you want to cast your fireball because there is a large group of enemies clustered together (see the Imap system). However, the exact calculation of where the center of those enemies is will be calculated on the execution of the action.

Single Target on Self

"SingleTargetOnSelf" is scored per agent in the world (like "SingleTarget") but the effect is executed on the agent itself.