Difference between revisions of "Consideration"

From AI Product Manuals
Jump to navigationJump to search
(Implementation)
 
Line 1: Line 1:
{{IAUS Header}}
{{IAUS Header}}
 
{{Part of Behavior}}
== Concept ==
== Concept ==
[[File:Diagram - Consideration.png|400px|thumb|right|Consideration as part of the IAUS structure]]
[[File:Diagram - Consideration.png|400px|thumb|right|Consideration as part of the IAUS structure]]
A Consideration is a mapping of an input value through a [[Response Curve]] to get a value that is used to help score a [[Behavior]].
A '''Consideration''' is a mapping of an input value through a [[Response Curve]] to get a value that is used to help score a [[behavior]].


== Components ==
== Components ==
Considerations have different components, most of which make them what they are and are required.
Considerations have different components, most of which make them what they are and are required.


=== Input ===
=== Input ===
The [[Input]] on a Consideration is the data that the consideration needs to retrieve in order to process.
The [[input]] on a Consideration is the data that the consideration needs to retrieve in order to process.


=== Response Curve ===
=== Response Curve ===
The [[Response Curve]] of a Consideration is what converts the value of the input into the output value for that Consideration. It is comprised of a [[Response Curve#Curve Type|Response Curve Type]] and [[Response Curve#Variables|Consideration Variables]] that define what the curve "looks like".
The [[Response Curve]] of a Consideration is what converts the value of the input into the output value for that Consideration. It is comprised of a [[Response Curve#Curve Type|response curve type]] and [[Response Curve#Variables|consideration variables]] that define what the curve "looks like".


=== Parameters ===
=== Parameters ===
Considerations may have [[Input Parameters]] that add more context specific to processing that consideration. (Note that these are different from [[Behavior Parameters]] which apply to the [[Behavior]] as a whole.)
Considerations may have [[Input Parameters]] that add more context specific to processing that consideration. (Note that these are different from [[behavior parameter]]s which apply to the [[behavior]] as a whole.)
 
== Implementation ==
=== Code ===
All the processing for considerations is contained in <syntaxhighlight lang="C++" inline>Class Consideration</syntaxhighlight>. The only member variables are the name, input, response curve, and parameters. There is one consideration object for each independent consideration in any behavior. Note that these are truly unique ''objects'' that may be the same as other consideration objects elsewhere. So, for example, Behavior A may have a consideration with the same response curve and parameters as a consideration for Behavior B. Those two considerations would be individual objects in the data. This is because the are associated as member objects of those parent behaviors. If the data is changed in the [[data tool]] for one of the considerations, the data held in the created objects would not be different.
 
The objects themselves hold no state.
 
The only entry point for use is <syntaxhighlight lang="C++" inline>float Consideration::GetScore(const ContextInfo &thisContext)</syntaxhighlight>. From there it acquires the input value from the specified input using, if necessary, information passed into <syntaxhighlight lang="C++" inline>GetScore</syntaxhighlight> via the [[context info]].
 
Once it has retrieved and processed the input value, it runs it through the response curve and returns the value of the consideration.


== Code ==
<syntaxhighlight lang="C++" inline>float Consideration::GetInputValue(const ContextInfo &thisContext) const</syntaxhighlight> does all the heavy lifting of the process of calculating considerations for a behavior. Because of that, this is going to be one of your most accessed functions during AI execution. It is essentially a large '''switch''' statement branching on the [[input]] that is specified in this particular consideration. This switch runs the input against all of the enum'd <syntaxhighlight lang="C++" inline>ConsiderationInput</syntaxhighlight> values so that the program knows where to get the value from in the game engine and, if necessary, process it accordingly.


== Data ==
=== Data ===


== Export ==
=== Export ===

Latest revision as of 03:07, 9 October 2021

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

This item is a component of a Behavior.

Concept

Consideration as part of the IAUS structure

A Consideration is a mapping of an input value through a Response Curve to get a value that is used to help score a behavior.

Components

Considerations have different components, most of which make them what they are and are required.

Input

The input on a Consideration is the data that the consideration needs to retrieve in order to process.

Response Curve

The Response Curve of a Consideration is what converts the value of the input into the output value for that Consideration. It is comprised of a response curve type and consideration variables that define what the curve "looks like".

Parameters

Considerations may have Input Parameters that add more context specific to processing that consideration. (Note that these are different from behavior parameters which apply to the behavior as a whole.)

Implementation

Code

All the processing for considerations is contained in Class Consideration. The only member variables are the name, input, response curve, and parameters. There is one consideration object for each independent consideration in any behavior. Note that these are truly unique objects that may be the same as other consideration objects elsewhere. So, for example, Behavior A may have a consideration with the same response curve and parameters as a consideration for Behavior B. Those two considerations would be individual objects in the data. This is because the are associated as member objects of those parent behaviors. If the data is changed in the data tool for one of the considerations, the data held in the created objects would not be different.

The objects themselves hold no state.

The only entry point for use is float Consideration::GetScore(const ContextInfo &thisContext). From there it acquires the input value from the specified input using, if necessary, information passed into GetScore via the context info.

Once it has retrieved and processed the input value, it runs it through the response curve and returns the value of the consideration.

float Consideration::GetInputValue(const ContextInfo &thisContext) const does all the heavy lifting of the process of calculating considerations for a behavior. Because of that, this is going to be one of your most accessed functions during AI execution. It is essentially a large switch statement branching on the input that is specified in this particular consideration. This switch runs the input against all of the enum'd ConsiderationInput values so that the program knows where to get the value from in the game engine and, if necessary, process it accordingly.

Data

Export