class Action<ActionIdType, ConsiderationIdType, InputIdType>
package needs.ai
The Action class represents an action that an agent has the option of intending/attempting to perform within the game world. It encapsulates a collection of Considerations that are evaluated using a scoring function to calculate an overall utility score for the Action.
Constructor
new (id:ActionIdType, name:String, considerations:Array<Consideration<ConsiderationIdType, InputIdType>>)
Parameters:
id | Id for this action. |
---|---|
name | The human-readable name of the action. |
considerations | The collection of considerations that the action starts with. |
Variables
read onlyconsiderations:Array<Consideration<ConsiderationIdType, InputIdType>> = null
Collection of considerations that are evaluated to calculate an overall utility score for the action.
read onlyname:String = ""
Human-readable name of the action. For an NPC-eating werewolf in a park, available Actions might be called "Eat NPC" and "Hide In Bush".
score:Void ‑> Float = null
Calculates a utility score/floating point value for the action by evaluating the considerations using the action scoring strategy.
Returns:
The utility score/floating point value for the action, usually normalized to the range 0-1.