Writing for Video Games: "Branching Stories"

Screenshot from Achromia's new branching story, Control. What will you choose? Available now on Google Play and itch.io.
To celebrate the recent release of Achromia's two video games, OP9 and Control, which I had the pleasure of writing for, I'm excited to share this article on how to write your own video game scripts! Don't forget to check out their games on itch.io (for Windows, Mac, and Linux users) and Google Play (for Android users). 

You could kill your character. Or you could save him.

You could let them kiss. Or you could make them hate each other.

Now imagine if you didn't have the choice. Not only do you not get to choose, you have to write both endings and let someone else choose! That is the essence of a branching story - a novels of sorts where the reader, not the author, makes the choices that determine the outcome of the story.

Chapter 7: Do you take the knife or leave it? If you don't take the knife, you won't be able to defend yourself in the next chapter and you'll die. If you do take it, you'll be able to defend yourself but will be badly wounded. Do you still have the gauze from Chapter 2? If not, you either find another alternative or you die.

You, as the poor author, have to write all these endings and make sure there are no discrepancies. I've learned first-hand how difficult this is after writing OP9, a 130,000 word branching story for Achromia Games. Yes, you read that right - 130,000 words, much longer than a typical paperback novel. Even choices that you make in the very beginning of the story can have effects hours of game play later, and somehow, you as the writer have to keep track of all the possibilities. How on Earth are you supposed to do this?

In this article, I'm going to assume you're writing a computer-based visual novel and that you know a few basic programming terms, which I'll define below:

  • A variable is something you can set to a specific value - a number or true/false. For example, if you were presented with a choice such as, "Should I turn left or right?" I would record your answer by creating a variable called choose_left and assign it a value of either true (left) or false (right). Later on, when this choice became significant, I would provide two different alternatives: if choose_left was assigned true, you'd see one path. If it was assigned false, you'd see a different path.
  • An else-if statement (abbreviated 'elif') is how I determine which path you follow in the story. For example, I could say something like:
    • if choose_left == true: [insert path here]
    • else: [insert path here]

Variables are the best way of keeping track of what's happening in the story. Making a note - on paper or at the bottom of your code script - about what variables are in the story can be extremely helpful. For example:

  • damien_meets_jordan indicates whether or not Damien ever meets Jordan. If he does, this variable is true. If he doesn't, this variable is false. If Damien meets Jordan, scene #1 will be included. If Damien doesn't meet Jordan, scene #1 will be left out.

In this example, if Damien meets Jordan, you give the player access to one additional scene. If he doesn't, the player never sees this scene and the game goes on without mention of Jordan.

A more complex example:

  • damien_meets_jordan indicates whether or not Damien ever meets Jordan. If he does, this variable is true, and if he doesn't, it is false. If they meet, Jordan will be added to Damien's group which will change the entire script. If they don't meet, Jordan will not be added to Damien's group, but will instead become his enemy.

In this example, whether or not Damien meets Jordan determines the outcome of the entire story. The important thing to keep in mind here is that if Damien does meet Jordan, his story will be completely different than if he doesn't meet Jordan. Complex decisions like these can be the hardest to write because you literally write a different book for each choice the player makes. Typically, I don't recommend writing branching stories like this, unless you're willing to put in hundreds of hours to write each possible ending. 

Branching stories should have a thread of consistency throughout. For example, you might write an adventure story about a girl with six teammates (the basic premise of OP9 by Achromia). At the end of the story, she could form a strong relationship with two of those six teammates. The other four relationships are already determined from the start of the story, although you can certainly tweak them to be better or worse depending on your choices. Other outcomes could include accidentally dying, failing to form strong bonds with any teammates, betraying the team, or failing the mission, but the basic premise of the story is already set. It's the outcome, not the story itself, which is determined by the player.

The hardest part about writing a branching story, whether on the computer or not, is keeping track of all the different paths. There's no substitute for having someone read through your work with a critical eye for inconsistencies. Even small continuity errors can totally ruin a branching story because they deprive the player of the ability to make rational decisions within the game. In addition, it's always a good idea to make some sort of chart. I did this in the Atom text editor, using different colors to keep track of all branches (which generally took the form of elif statements and were for some reason green). It's also possible to do this on paper in column or chart format. If you're not keen on writing out all the possible paths - which is extremely difficult and can be even more confusing - try the computer program Twine 2. It was developed as an engine to create HTML/JS text-based branching stories, but you can use it simply to keep track of the paths in a story you're writing elsewhere. Or, if you have a basic knowledge of programming (and/or HTML) and are willing to look up some tutorials, you can use it to create your very own branching story which you can publish online. Either way, it's an extremely useful tool to anyone interested in creating these stories.

The most important thing to remember when creating a branching story is this: make sure the reader is involved, but for your own sanity make sure the story has a base structure which can't be changed. Elaborate from there and leave as many details as you can in the reader's control. And always be sure that there's complete continuity throughout the story.

If you create any of these stories using Twine 2 or another engine, I'd love to check them out! Let me know about them in the comments below.


  1. In games that show a male strong and smart, he will mostly likely be white, tall, thin, movie star looking and buff. You will rarely see him be a minority, short, chubby, not buff, nerdy looking, while still being strong and smart. You see this even LESS for females. 토토사이트


Post a Comment