Consideration
This page is part of the IAUS Manual. ♦ Brain ♦ Behavior ♦ Behavior Type ♦ Decision ♦ AI Entity ♦
This item is a component of a Behavior.
Concept
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.