Featured Blog

A Better Narrative using OCC Emotional Model

Create a good emotional narrative is really hard. To help us, we can use the OCC model, a cognitive theory that gives an explanation how a certain emotion can be produced. Here, I present a way using OCC model to design a game which I found so far.

Narrative is a complicated word. Some people believe that narrative could increase gaming experience while others say it is only a tainted game play. I won’t start a fuss about it, but I personally believe that the narrative holds a prospect in the game. This year GDC, Ken Levine, presented a new way of treating the narrative in a game referred as Narrative Lego. I see a big chance on it though it is still in early concept. A chance where narrative not only acting as decoration, but also a core of the game itself. His speech motivates me to do my own little research about narrative. Herewith, I will present what I’ve found so far.

In my opinion, the narrative is considered great when it triggers emotional effect to the player. To make it happens, the character in the game must possess emotion itself and delivers correctly to the player so they could feel the character’s emotion in order to create empathy towards the character. The first step in creating a great narrative is to know more about emotion, explore how many are they and how to elicit them. There are many concepts about emotion that we can use, but i’ll use OCC model because it describes how the emotion created in a structural way which makes it easier to understand (believe me, if you’re not into philosophy or psychology, read about emotion will push your brain off to the limit).

OCC structure, taken from The Cognitive Structure of Emotion, 1988

In OCC, it is said that a person can trigger an emotion by doing an appraisal towards event, action, or object. In a simple way, it goes like this: When an event happens to a person, he/she will appraise that event whether it is pleased or not then give a consequence to others or himself/herself. Afterwards, the effect from the other side will be recognized as desirable or not desirable. If it gives consequences to him/her, the consequence will give a prospect relevant to the person’s goal or not. After that consecutive appraisal, a person will elicit emotion according to the appraisal result. However it does not end here. If a person recognizes the action creating the event, he/she will appraise whether that action is approved or not and who did the action: himself/herself or another person. And if the person recognized it, people will apprise if he/she like the perpetrator or not.

Okay! Surely it’s a big and complicated system. Luckily we only care what it means in a game. The focus is on the player. We only care about anything related to the player. So, the event here means the event happens to the player; action means an action that the player does; object means the player; others means the player itself - non playable character (NPC) in the game. In order to track the emotion NPC possess to the player, we need an emotion that we can count and it must general enough so it can include other emotions. For this, love and hate emotion are chosen. Love will include all positive emotion characters held towards the player while hate will include all negative emotion. Just like passion bar in narrative lego; I present love and hate in a bar at each sides. Let’s call it affection bar.

Affection Bar: love at right side; hate at left side.

Let’s see what every emotion means to this affection bar.

For example, you are in a situation with other players where you got one thousand gil without doing anything (pleased, consequences for other and desirable for other) – later on will be referred to ‘one thousand gil’ event. Obviously the NPC will deliver happy emotion for you, right?  So it will increase the point of affection bar automatically right?

You wrong. Life isn’t that simple, dude.

If the NPC likes us, surely he will be happy for our fortune. On the contrary, if the NPC hates us, he will resent to our condition. It means the emotion produced by NPC depends on his affection bar. If it has quite an amount, he will be happy for us and vice versa. However, the event won’t add or decrease his affection bar. So he won’t add more love or hate to us.

However, what if we just meet him for the first time with his affection bar in a neutral state? Surely, we can make him not to elicit any emotion to us, but it would be boring. It would not represent people emotion in real life. You see, not every people are kind. Some people like to see other people in a desperate situation for no particular reason. Then, how to create this in a game?

To make the function enabled in a game, we need another attribute of NPC beside affection bar. I called it egoist value. It represents how strong an NPC would forsake the right of humanity moral value in his every behavior/emotion for his own benefit. Going back to one thousand gil event, If NPC egoist value is quite low, he will be happy for us (he keeps his right morality, happy for other’s fortune even though he doesn’t get a return). On the contrary, if his egoist value is high enough then he will resent to us (he ignores his right morality in order to fulfill his own jealousy and acknowledge his desire). Egoist value has another function, but I will tell it later when it is used.

Now we already finish one route of appraisal (pleased/displeased, consequences for other, desirable for other). Let’s see another route of appraisal in undesirable term which will produce either gloating or pity emotion.

The way we treat this situation is not different from the last. If NPC affection bar is high, he will produce pity emotion or else will gloat if it’s low. Furthermore, if affection bar is still at neutral (zero number) it’ll look NPC egoist value. If it’s high enough, he will elicit gloating, but pity if it’s low.

Let’s turn to emotion coming from an event that gives consequences for self (NPC). Now, it’s going to be more complex. Beyond consequences of self appraisal, the paths split to whether the event gives prospect to NPC goal or not. If it gives a prospect, it will elicit emotion either hope or fear (which will create another branch depending on whether the event is confirmed or not). If it is not relevant to NPC goal, it will give either joy or distress. Combined with action appraisal, this joy or distress will become gratification or remorse (if the action conducted by himself) or gratitude or anger (if the other person did the action). Let’s see if we try to translate it into a way related to the game. 

Firstly, just as what I stated before, we only care about feeling related to the player. It makes emotion gratification and remorse caused solely by NPC himself can be removed (it doesn’t mean we throw away these emotions, but they can be scripted by writer and triggered by a controlled event). Secondly, from the structure, we see emotion related to one’s action is only gratitude and anger. Does it mean that satisfaction, fear-confirmed, relief, and disappointment didn’t cause by someone’s action (in this case player action)? The answer is yes, and no. Yes, because producing these emotions, a person only have to appraise the event. No, because even though producing these emotions, a person doesn’t need to appraise someone’s action. In reality, after a person has finished with this appraisal and created an emotion such as satisfaction, then he will turn to appraise the action that create this event and produce another emotion such as gratitude. So it’s like an automatic system where it will create two emotions from two kinds of appraisal at the same time. Thirdly, still related with the last, what is the difference between prospect relevant and prospect irrelevant actually? From the structure, it shows that prospect relevant is caused by an event related to someone’s desire/goal, while prospect irrelevant is related to someone’s well being. So basically it’s just about priority, with prospect irrelevant usually at a higher priority than prospect relevant. Also, it doesn’t mean that someone doesn’t have hope and fear about his well being. It’s just normally people doesn’t aware of it. Maybe it’s not the right thing to do, but in the game, we can merge between prospect relevant and prospect irrelevant and also satisfaction and relief with gratitude, and fear-confirmed and disappointment with anger (still, we can make them differ each other by scripted them differently). Then, we can present them in some table called concern list that unique to each NPC.  It contains every NPC hope and fear, and present them in order that show its priority. Each hope and fear then will have its own list of condition that needs to be done to get his hope or eliminate his fear.


NPC Concern List

Let’s take an example. There are an NPC named john. He has concern list as below.


In one of quests that you did, you defeated the dragon that blocked the way to neighbor village. Hearing what you did, he feel satisfied, because your action would help his hope to meet the most beautiful girl in neighbor village comes true. It will make his affection bar increase, and he will love you more. The next time he heard that you were injured by a bandit goblin, he will feel pity to you.

That’s it! Easy, right?

No. There is something missing in here. Maybe it could work, but it makes the interaction feel only one direction. You do something good, plus to affection bar, you do the contrary, minus to affection bar. What if we want to do something good, but we failed? What emotion the NPC will produce? Then, will the NPC become this goal oriented? Where is his humanity? Also, will the NPC this dumb? I mean, when one hope cannot be fulfilled, does he just throw that hope away, or can he create another way to fulfill that hope?

To answer that question, let’s broaden our train of logic.

Let’s look at player action. Player action in this term is a meaningful action that will make NPC concern completed or not. If an action has a value of success, hence an NPC ideally will elicit emotion depending on this action’s success. Not only seeing from its result, if we see OCC model, a person will appraise the action whether he approved it or not. What kind of action that a person approves? In reality, there are two ways of a person will consider some actions to be approved or not. First, we can see if the action helps him to get what he wants (lets called it concern value). Second, we can see whether the action is a right thing to do based on humanity or not (and this one called morality value). Sometimes these two considerations have the same value (approved or not), but sometimes not. For example, you killed the king. In the prince’s eye, this action is approved because it will make him a king, something that he hopes for. However, he also sees this action cannot be approved from humanity perspective. It created two different values from the same action (obviously, if the prince has a fear of his fathers death where priority is higher than his hope for the crown, it will make a different situation. But for this example, let’s say this prince hate his father). This is where egoist value kicks in. Just like how it differentiates between happy forand resentment emotion. Egoist value’s NPC will make NPC valued an action based on humanity or forsake his humanity to value the action based on his concern only. How it is done will be explained later.

Furthermore to the theory, let’s make the NPC less like a robot. When a person needs to do something to get his concern obstructed, he will try to create another way to complete it. It can be done by adding his ‘to do list’, or completely change his perspective to gain it. Additionally, if the concern isn’t important, people can still change its priority with other concern in a way that there is possibility in the future to meet the goal which previously blocked to be opened.

To achieve these, let see back to OCC with other perspective. Earlier, I mentioned that at times when people do an appraisal, he would appraise the event, the action, lastly the object.

The sequence of  appraisal where square represents event, triangle represents action, and circle represents object.

As the object in here is the player himself, we can eliminate object from the sequence. It leaves us with event and action. The event represents some changes occurred in the world as triggered by an action. It means every time an event occurred, there is something changing the world. It can be the rise of the new king coming from a riot in the kingdom or it can be as simple as the decrease of someone money because he spent it. Furthermore, every event can make another new action happens, such as the rise of the new king will create the action of building the statue of the new king. As long as the new event doesn’t forbid the action in the last event to re-occur, the action will still exist in new event. This will make a chain of action-event. One thing to note down is which event considered as having a big impact that creates a new state of the world. Like I said before, even small action can ripple the world state that creates a new one. However, if we include all available actions, it is hard to manage the narration and game progress.

Example of chain of action-event

Let’s turn to NPC concern list. NPC concern list consists of his hope/fear. Each hope/fear contains something that he wants to happen to make him closer/further to what he hope/fear. It is only available in some world state. Thus, what he wants to happen is actually an event. For example, a targeted NPC fear that he could be captured and killed. He knows that there are three bounty hunters chasing him. In order to eliminate his fear, the pursuers must be defeated before they found the targeted NPC. This means that he longed to a world which doesn’t have these three bounty hunters. If you killed one of bounty hunters, it will create an event of a dead bounty hunter and make the world state change from which three bounty hunters exist to only two bounty hunters. So it makes the wanted NPC fear progressed. Hence, we can conclude that every hope/fear that exist in NPC’s concern list is a chain of action- event that subset of the global chain of action-event.

NPC chain (the red one) in global chain action-event

Previously, we agreed that an action has two values, concern value and morality value, where values differ for each NPC. When a player do some action that will lead to an event (and also new world state), every NPC will appraise this action whether it has positive values that will make him love the player more (plus to affection bar), or negative values that will make him hate the player more (minus to affection bar). Since an action could succeed or failed, there are two kinds of values to an action giving us probability as below table.


It is easy when morality and concern value have the same value, we can just add them and the result is NPC value to the action. But what if they have different values? Can we just add them too? I don’t think so. When we meet with this condition in real life, naturally we consider which value we will use. Will we use the morality value or concern value? To model this way of thinking, we can use the NPC’s egoist value. Egoist value holds a number that represent whether NPC would forsake the right of humanity moral value for his own benefit. However, what this number means in regards to our chain of event-action? 

From the chain of action-event perspective, when the player does an action, it will lead to a new event. The closer new event to an NPC chain of action-event representing his concern, the more he wants the next action to lead an event that belongs to his chain of action-event. Hence, he will appraise the action by its concern value only. On the other hand, if the current event is still far away, yet the NPC  think it’s still possible to get his concern from the current event  he will not too determine about the next action furthermore he will appraise the action by its morality value only. However, if the next action leads to an event further from NPC chain of action-event, until at some point he will think it is hard to get his concern  he will start to appraise using its concern value again.

That gives us three regions.   Region 1 is where the current event closer to NPC’s chain of action-event; region 2 is where the current event not close from NPC’s chain of action-event yet still tolerated by NPC; and region 3 is where the current event way too far that NPC can tolerate. The size of each region is different for each NPC, the more egoist he is, the wider region 1 and the narrower region 2 he has. Contrary, the less egoist he is, the narrower region 1 and the wider region 2 he has. This will be represented by NPC’s egoist value. To measure NPC’s egoist value and the size of regions, we can use the total number of events. For example, region 1 with the size of three will make NPC start using his concern value when the current event is located three or less than his chain of action-event And for region 2 with the size of five will make NPC use his morality value if the current event is located in more than three (size of region 1) but less than eight (size of region 1 + region 2). Yet, it makes every event has the same value. In reality, every event has its value which represents its difficulty. The event where the king got killed obviously will have bigger value than the event of some stray animal killed. As a result, we need another attribute of the event which represents its difficulty. In turn, rather than using the total number of event for the size of the region, we could use a total of event’s difficulty. Furthermore, by dividing the size of region 1 (total difficulties of region 1) and size of region 2 (total difficulties of region 2), we will get NPC’s egoist value.

Now, it gives us one new attribute and one new understanding of the current existing attribute. The new attribute is difficulty which belongs to an event. It represents the event’s difficulty to obtain and a new understanding of NPC’s egoist value coming from total difficulties of region 1 and 2.

And for how NPC appraise an action, it would become like below table


From the table, it can be seen that some action led to 0 value. It is due to undesirable action for NPC and located in region one and three where its morality value doesn’t matter.

The use of chain of action-event automatically will help tackle the problem of the ‘feel-like-robot’ NPC too. Let’s look for a part of a chain of action-event. For an easier read, the picture consists of only important event and action to explanation.


For example, the current event is at A. To get his hope, NPC needs the event to progress to B, then to C, and finally arrives at the event D where he will get what he hopes for. Rather than going to event B from action 1, player did action 2 which lead to event E. This action blocks NPC to get his hope. However, it doesn’t mean he will throw away the hope. NPC will try to make his hope to be fulfilled by searching the shortest way to get it; as a result player will do action 5 that makes event F occurs, then do action 6 which lead to event B as what he planned before. Additionally, if the player arrives at event F, NPC can suddenly recognize that doing action 7 will make NPC’s hope achieved faster. It will make NPC change the route of his hope from previously going to event B and C with doing action 7 only. It shows that using the chain of action-event will make NPC more dynamic to achieve what he hopes for.

In conclusion, here is the relationship data if we represent it with ERD.

However, this concept also has flaws. Some points which I recognized are:

1.  Similar to what happens with Ken’s narrative lego, it needs a lot of writing to make it interesting. We need to consider every available path that comes up with every action and event. And the more writing it has, the harder we manage the connection between every action and event.

2. It is difficult to design a chain of action-event on a paper. If you take notice, every chain of action-event shown on this text is pretty simple. It has only up to two actions for every event  and it’s very hard to make the chain closed where event always have action towards another (also a meaningful one). To have better design, we could use a computer to model it in 3D so we can create more available actions without being entangled to each other, and we can easily track each event and action.

3. Even though this concept add the effect of action result to the emotion and make NPC more dynamic with their concerns, it’s still far away to represent the real emotion. It still does not cover the creation of people’s belief coming from emotion (something that I currently work at).

However, this concept is still at a very early phase which I believe there are things can be done to make it more efficient and represent how emotion is. Should you have any thought, please let me know! Your thoughts are much appreciated. Thanks for reading!



Latest Jobs

Double Fine Productions

Hybrid, San Francisco CA, USA
Senior Systems Programmer

Purdue University

West Lafayette, IN, USA
Clinical Assistant Professor in Game Development

Digital Extremes

Lead AI Programmer
More Jobs   


Explore the
Advertise with
Follow us

Game Developer Job Board

Game Developer


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Advertise with

Game Developer

Engage game professionals and drive sales using an array of Game Developer media solutions to meet your objectives.

Learn More
Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more