API Docs for:
Show:

TUDelft.Gamygdala.Agent Class

Defined in: Gamygdala.js:540

This is the emotion agent class taking care of emotion management for one entity

Constructor

TUDelft.Gamygdala.Agent

(
  • name
)

Defined in Gamygdala.js:540

Parameters:

  • name String

    The name of the agent to be created. This name is used as ref throughout the appraisal engine.

Methods

TUDelft.Gamygdala.Agent.addGoal

(
  • goal
)

Defined in Gamygdala.js:574

Adds a goal to this agent's goal list (so this agent becomes an owner of the goal)

Parameters:

TUDelft.Gamygdala.Agent.appraise

(
  • belief
)

Defined in Gamygdala.js:634

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:

TUDelft.Gamygdala.Agent.getEmotionalState

(
  • useGain
)
TUDelft.Gamygdala.Emotion[]

Defined in Gamygdala.js:658

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 Boolean

    Whether to use the gain function or not.

Returns:

TUDelft.Gamygdala.Emotion[]:

An array of emotions.

TUDelft.Gamygdala.Agent.getGoalByName

(
  • goalName
)
TUDelft.Gamygdala.Goal

Defined in Gamygdala.js:608

If this agent has a goal with name goalName, this method returns that goal.

Parameters:

  • goalName String

    The name of the goal to be found.

Returns:

TUDelft.Gamygdala.Goal:

the reference to the goal.

TUDelft.Gamygdala.Agent.getPADState

(
  • useGain
)
Double

Defined in Gamygdala.js:679

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 Boolean

    Whether to use the gain function or not.

Returns:

Double:

An array of doubles with Pleasure at index 0, Arousal at index [1] and Dominance at index [2].

TUDelft.Gamygdala.Agent.getRelation

(
  • agentName
  • The
)

Defined in Gamygdala.js:754

Returns the relation object this agent has with the agent defined by agentName.

Parameters:

  • agentName String

    The agent who is the target of the relation.

  • The TUDelft.Gamygdala.Relation

    relation object or null if non existing.

TUDelft.Gamygdala.Agent.hasGoal

(
  • goalName
)
Boolean

Defined in Gamygdala.js:599

Checks if this agent owns a goal.

Parameters:

  • goalName String

    The name of the goal to be checked.

Returns:

Boolean:

True if this agent owns the goal, false otherwise.

TUDelft.Gamygdala.Agent.hasRelationWith

(
  • agentName
  • True
)

Defined in Gamygdala.js:745

Checks if this agent has a relation with the agent defined by agentName.

Parameters:

  • agentName String

    The agent who is the target of the relation.

  • True Boolean

    if the relation exists, otherwise false.

TUDelft.Gamygdala.Agent.printEmotionalState

(
  • useGain
)

Defined in Gamygdala.js:708

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 Boolean

    Whether to use the gain function or not.

TUDelft.Gamygdala.Agent.printRelations

(
  • [agentName]
)

Defined in Gamygdala.js:768

Returns the relation object this agent has with the agent defined by agentName.

Parameters:

  • [agentName] String optional

    The agent who is the target of the relation will only be printed, or when omitted all relations are printed.

TUDelft.Gamygdala.Agent.removeGoal

(
  • goalName
)
Boolean

Defined in Gamygdala.js:584

Adds a goal to this agent's goal list (so this agent becomes an owner of the goal)

Parameters:

  • goalName String

    The name of the goal to be added.

Returns:

Boolean:

True if the goal could be removed, false otherwise.

TUDelft.Gamygdala.Agent.setGain

(
  • gain
)

Defined in Gamygdala.js:622

Sets the gain for this agent.

Parameters:

  • gain Double

    The gain value [0 and 20].

TUDelft.Gamygdala.Agent.updateRelation

(
  • agentName
  • like
)

Defined in Gamygdala.js:726

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 String

    The agent who is the target of the relation.

  • like Double

    The relation (between -1 and 1).

TUDelft.Gamygdala.decayAll

(
  • gamygdalaInstance
)

Defined in Gamygdala.js:792

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

    A 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)