Thinking of somebody else

Posted by Michael on May 19th, 2006, in Development

When designing a system for autonomous characters, one is very quick to think about the problem in terms of “How or when or why would I do this or that?” The solution for this problem is then to design a system that can reason along the lines of “When I feel like this, I will do that.” Such a reasoning system can be extremely complex and (perhaps because of that) still lead to rigid, unrealistic behaviour when applied to Non Playing Characters (NPCs).

But the NPC, per definition, does not represent you, the player. The NPC is always somebody else, the other. Therefore, a more appropriate way to think about the problem of representing autonomous characters is in terms of “What is she doing and does that make sense?” The natural empathy that we feel makes us immediately project the behaviour that we are observing onto ourselves and translate what we see to “If I were to do that, would it make sense?”. And to answer this question, we would attach some meaning to what is being done. This whole process of empathy does not need to be programmed! The player will do this automatically. All we need to program is the behaviour of the other person (not ourselves). We do not need to program the reasoning. As long as the behaviour is such that the player can attach some meaning to it. This doesn’t mean that the NPC needs to know this meaning. It only means that the NPC cannot behave in absurd ways. So we just need to design a few rules to avoid completely absurd behaviour. And not a synthetical mind.

Another aspect of thinking of the NPC as another person and not yourself is that we only need to program systems for things that can be perceived by the player. If our output (graphics, animations, sounds) can only express sleeping or fighting, i.e. if our output is boolean, there is no need for a complex system that can reason about the decision to either sleep or fight (such as “if I’m a bit tired but I’m close to an enemy, I will fight anyway unless I’m very lazy or I’m sick” etc). All the player will see is the NPC either sleeping or fighting. Why the NPC starts fighting is something that can be left entirely up to the spectator.
For the system, randomness is sufficient. Something like “If I’m close to an enemy, and random number A equals x, then I’ll fight”. We could refine the system a bit by increasing the probability as the NPC gets closer to the enemy, or by taking any other external context into account (context, in other words, that can be preceived by the player) like aggressive behaviour of the enemy or terrain conditions. But the decision itself will always be random because the reasoning of the NPC can not be expressed anyway.

We do have to add some rules to avoid absurdity. For instance, if our NPC is very tired when he starts to fight, we don’t want him to fall asleep during the battle. So we simply make a rule that the NPC cannot go to his sleeping state when he is in his fighting state. The player, who might be aware of the NPC’s tiredness, would attach meaning to it by thinking of adrenaline rushes, etc. But we do not need to program adrenaline.
We can reduce the build workload and increase the flexibility of these rules by generalising them. E.g. by grouping behaviours according to compatibility, something we have to do anyway to ensure consistent behaviour.

I admit that this is a very unintuitive way of thinking about NPCs. So strong is our inclination to empathize. But we have to force ourselves to think of the other as somebody else. Because we only need to program his or her external behaviour. And we can make up much simpler rules to govern that behaviour than if we needed to program our own (including all the reasoning). As a bonus, we allow the spectator more freedom of interpretation and the game more possibilities of unexpected things happening.

No comments yet.

Leave a comment

You must be logged in to post a comment.