Emotions are used in two specific ways in game AI. The first to help actors select what to do, and the second to decide how to do it.
Drives are emotions that push the actor towards a particular goal. For example, drives may be hunger, thirst, the desire for affection, etc. In the game, these drives would cause an actor to eat, drink and find a mate.
Drives are typically modeled as continuous numbers, that indicate the weight of the emotion on a scale of [0.0, 1.0]. So a hunger level of zero would mean no hunger, and a hunger of 1 would mean it’s time to eat or die.
To model drives, you need two things:
One-off events that modify the weight of the drive (like eating).
Continuous processes that cause the drive to change (like slowly becoming more hungry).
Then, by passing these drives into the decision making system, the AI becomes emotionally aware.
Feelings are beliefs about other actors or objects in the world. Unlike the drives, they don’t work on their own; they need a context.
Feelings can be modeled as a mapping between objects and a weighted value. So a villager from another village might cause a very angry feeling in the AI actor, whereas a neighbor would make it happier.
So, in practice, feelings can only be used during the decision making when trying to select between possible courses of action.