Context type

From AI Product Manuals
Revision as of 15:03, 29 September 2021 by Davemark (talk | contribs) (Initial Entries)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
This page is part of the IAUS Manual.BrainBehaviorBehavior TypeDecisionAI Entity


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


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

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. 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.

"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."

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.

"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.