TUDelft.Gamygdala.Agent Class
This is the emotion agent class taking care of emotion management for one entity
Constructor
TUDelft.Gamygdala.Agent
-
name
Parameters:
-
name
StringThe name of the agent to be created. This name is used as ref throughout the appraisal engine.
Item Index
Methods
- TUDelft.Gamygdala.Agent.addGoal
- TUDelft.Gamygdala.Agent.appraise
- TUDelft.Gamygdala.Agent.getEmotionalState
- TUDelft.Gamygdala.Agent.getGoalByName
- TUDelft.Gamygdala.Agent.getPADState
- TUDelft.Gamygdala.Agent.getRelation
- TUDelft.Gamygdala.Agent.hasGoal
- TUDelft.Gamygdala.Agent.hasRelationWith
- TUDelft.Gamygdala.Agent.printEmotionalState
- TUDelft.Gamygdala.Agent.printRelations
- TUDelft.Gamygdala.Agent.removeGoal
- TUDelft.Gamygdala.Agent.setGain
- TUDelft.Gamygdala.Agent.updateRelation
- TUDelft.Gamygdala.decayAll
Methods
TUDelft.Gamygdala.Agent.addGoal
-
goal
Adds a goal to this agent's goal list (so this agent becomes an owner of the goal)
Parameters:
-
goal
TUDelft.Gamygdala.GoalThe goal to be added.
TUDelft.Gamygdala.Agent.appraise
-
belief
A facilitating method to be able to appraise one event only from the perspective of the current agent (this). Needs an instantiated gamygdala object (automatic when the agent is registered with Gamygdala.registerAgent(agent) to a Gamygdala instance).
Parameters:
-
belief
TUDelft.Gamygdala.BeliefThe belief to be appraised.
TUDelft.Gamygdala.Agent.getEmotionalState
-
useGain
This function returns either the state as is (gain=false) or a state based on gained limiter (limited between 0 and 1), of which the gain can be set by using setGain(gain). A high gain factor works well when appraisals are small and rare, and you want to see the effect of these appraisals A low gain factor (close to 0 but in any case below 1) works well for high frequency and/or large appraisals, so that the effect of these is dampened.
Parameters:
-
useGain
BooleanWhether to use the gain function or not.
Returns:
An array of emotions.
TUDelft.Gamygdala.Agent.getGoalByName
-
goalName
If this agent has a goal with name goalName, this method returns that goal.
Parameters:
-
goalName
StringThe name of the goal to be found.
Returns:
the reference to the goal.
TUDelft.Gamygdala.Agent.getPADState
-
useGain
This function returns a summation-based Pleasure Arousal Dominance mapping of the emotional state as is (gain=false), or a PAD mapping based on a gained limiter (limited between 0 and 1), of which the gain can be set by using setGain(gain). It sums over all emotions the equivalent PAD values of each emotion (i.e., [P,A,D]=SUM(Emotion_i([P,A,D])))), which is then gained or not. A high gain factor works well when appraisals are small and rare, and you want to see the effect of these appraisals. A low gain factor (close to 0 but in any case below 1) works well for high frequency and/or large appraisals, so that the effect of these is dampened.
Parameters:
-
useGain
BooleanWhether to use the gain function or not.
Returns:
An array of doubles with Pleasure at index 0, Arousal at index [1] and Dominance at index [2].
TUDelft.Gamygdala.Agent.getRelation
-
agentName
-
The
Returns the relation object this agent has with the agent defined by agentName.
Parameters:
-
agentName
StringThe agent who is the target of the relation.
-
The
TUDelft.Gamygdala.Relationrelation object or null if non existing.
TUDelft.Gamygdala.Agent.hasGoal
-
goalName
Checks if this agent owns a goal.
Parameters:
-
goalName
StringThe name of the goal to be checked.
Returns:
True if this agent owns the goal, false otherwise.
TUDelft.Gamygdala.Agent.hasRelationWith
-
agentName
-
True
Checks if this agent has a relation with the agent defined by agentName.
Parameters:
-
agentName
StringThe agent who is the target of the relation.
-
True
Booleanif the relation exists, otherwise false.
TUDelft.Gamygdala.Agent.printEmotionalState
-
useGain
This function prints to the console either the state as is (gain=false) or a state based on gained limiter (limited between 0 and 1), of which the gain can be set by using setGain(gain). A high gain factor works well when appraisals are small and rare, and you want to see the effect of these appraisals A low gain factor (close to 0 but in any case below 1) works well for high frequency and/or large appraisals, so that the effect of these is dampened.
Parameters:
-
useGain
BooleanWhether to use the gain function or not.
TUDelft.Gamygdala.Agent.printRelations
-
[agentName]
Returns the relation object this agent has with the agent defined by agentName.
Parameters:
-
[agentName]
String optionalThe agent who is the target of the relation will only be printed, or when omitted all relations are printed.
TUDelft.Gamygdala.Agent.removeGoal
-
goalName
Adds a goal to this agent's goal list (so this agent becomes an owner of the goal)
Parameters:
-
goalName
StringThe name of the goal to be added.
Returns:
True if the goal could be removed, false otherwise.
TUDelft.Gamygdala.Agent.setGain
-
gain
Sets the gain for this agent.
Parameters:
-
gain
DoubleThe gain value [0 and 20].
TUDelft.Gamygdala.Agent.updateRelation
-
agentName
-
like
Sets the relation this agent has with the agent defined by agentName. If the relation does not exist, it will be created, otherwise it will be updated.
Parameters:
-
agentName
StringThe agent who is the target of the relation.
-
like
DoubleThe relation (between -1 and 1).
TUDelft.Gamygdala.decayAll
-
gamygdalaInstance
This method decays the emotional state and relations according to the decay factor and function defined in gamygdala. Typically this is called automatically when you use startDecay() in Gamygdala, but you can use it yourself if you want to manage the timing. This function is keeping track of the millis passed since the last call, and will (try to) keep the decay close to the desired decay factor, regardless the time passed So you can call this any time you want (or, e.g., have the game loop call it, or have e.g., Phaser call it in the plugin update, which is default now). Further, if you want to tweak the emotional intensity decay of individual agents, you should tweak the decayFactor per agent not the "frame rate" of the decay (as this doesn't change the rate).
Parameters:
-
gamygdalaInstance
TUDelft.GamygdalaA reference to the correct gamygdala instance that contains the decayFunction property to be used )(so you could use different gamygdala instances to manage different groups of agents)