GoalEvaluator(characterBias)

Base class for representing a goal evaluator in context of Goal-driven agent design.

new GoalEvaluator(characterBias)

Constructs a new goal evaluator.

Parameters:
Name Type Default Description
characterBias Number 1

Can be used to adjust the preferences of agents.

Author:

Members

characterBias :Number

Can be used to adjust the preferences of agents. When the desirability score for a goal has been evaluated, it is multiplied by this value.

Default Value:
  • 1

Methods

calculateDesirability(owner) → {Number}

Calculates the desirability. It's a score between 0 and 1 representing the desirability of a goal. This goal is considered as a top level strategy of the agent like Explore or AttackTarget. Must be implemented by all concrete goal evaluators.

Parameters:
Name Type Description
owner GameEntity

The owner of this goal evaluator.

Returns:
Number -

The desirability.

fromJSON(json) → {GoalEvaluator}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
GoalEvaluator -

A reference to this goal evaluator.

setGoal(owner)

Executed if this goal evaluator produces the highest desirability. Must be implemented by all concrete goal evaluators.

Parameters:
Name Type Description
owner GameEntity

The owner of this goal evaluator.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.