DEV Community

Fran Tufro
Fran Tufro

Posted on • Originally published at onwriting.games on

writing npcs

In the area of character development, writing interactive storytelling opens up an immense design space.

I'm going to focus on the characters that are not our player's, which is known as NPC (Non-Playable Characters) in game design jargon.

A traditional way of writing these characters is by defining their motivations and personality.

Once we have this, we can easily derive their behavior and dialogue with greater ease and consistency.

When we transform our stories into something dynamic, this principle can be modified in two ways.

The simplest way is to react to the state.

Our NPCs have pre-defined motivations and personalities, but their behavior changes according to the state of the game.

An example of this is when we design a zero sum reputation system.

But it doesn't have to be as big at that, we can create small branches where different things happen, or modify the probabilities of the NPC saying or doing certain things based on the player's previous decisions.

The other way in which the principle can be subverted is by not fixing the NPC's personality and goals, but transforming them into variables and having all their behavior derived from these variables.

An example of this in Dance of the Spirits:

# start
  [fede]
    [(50%) fede_honest]
      set fede_liar false
    [(50%) fede_liar]
      set fede_liar true 

Enter fullscreen mode Exit fullscreen mode

At the beginning of the game, I define whether Fede, one of the characters, is a liar or not. There's a 50/50 chance.

This will define many things that happen in the game and allow or disallow certain endings.

In this case, I am modifying Fede's behavior based on a single variable for simplicity, but this could also be a combination of several variables.

Top comments (0)