Complex Branching
By putting choices in your story, you can create alternate storylines, or branches. This document discusses how to manage the complexity of a branching story. See it in action in the Example Script: Advanced Choices
Choices Reminder:
YOU
A fork in the road... where should I go?
choice “The normal road” {
YOU
So familiar and comforting!
} “The road less taken” {
ROBERT FROST
Nice choice!
gain MET_ROBERT_FROST
}
The choice command creates a set of buttons that appear on screen. The phrase in quotes is the text of the button, and the subsequent dialog (nested between curly braces).
When a player taps a button, they will only see the matching dialogue. This allows you to write dialog that can react to player choices. This gives the reader an active role in the story, which can improve their engagement. However, lots of choices can cause a burden on the writer, because it means writing lots of stories instead of just one. To lessen the amount of writing, we recommending merging your branches early. Don’t let the reader sit in a side branch of a story for too long. Instead, add flags to choices they made that you can later reference.
Goto’s, Labels, and Closing Brackets { }
If you need to do more complicated branching, you can use goto to jump to a different section of the story by referencing a label. You can give the label any name you wish. Example:
ANGIE
Wanna come to the bar again?
choice
“Sure” {
YOU
Yeah, let’s go!
goto the_bar
} “No” {
YOU
Nah, I have an exam tomorrow.
goto studying
}
label the_bar
INT. MIKE’S BAR - NIGHT
YOU
It is so loud in here!
label studying
YOU
This is BORING.
This is also a good way to merge two different branches back together, by directing both branches to goto the same label when they are done:
goto MERGE_THIS_BRANCH
Then later in the story, you would have a label MERGE_THIS_BRANCH:
label MERGE_THIS_BRANCH
In this example, we merge the above split in the decisions back into one story, using the label my_home:
label the_bar
INT. MIKE’S BAR - NIGHT
YOU
It is so loud in here!
I think I should head home.
goto my_home
label studying
YOU
This is BORING.
goto my_home
label my_home
YOU
But it's better I'm home than at the bar.
You can also merge branches simply by closing the brackets around them. If you have a choice with no “goto” command, it will take the reader to wherever its brackets close.
ANGIE
Where in the script should I go?
choice
“Far To The Future” {
ANGIE
I’ll go far into the future
goto FAR_FUTURE
} “Where You Are Now” {
ANGIE
I’ll just stay right where I am.
}
ANGIE
See, where I am is really nice.
NARRATOR
Time Passes.
label FAR_FUTURE
ANGIE
Now I am in the future!
The first choice would take the reader to label FAR_FUTURE and skip everything in between. The second choice would just bring the reader back to the script.
Gaining Flags - recording a choice
In addition to variables, you can use flags to keep track of where the player has been in the story. To set a flag, just use the gain command.
In the first example, there was a command, gain MET_ROBET_FROST. This enables the game to remember which choice the player made. MET_ROBERT_FROST is a “flag” that the player has earned, and your script can check for its existence later in the story. You can create any flag you like.
gain LEARNED_ABOUT_FLAGS
Checking Flags - remembering previous choices
After a merge, you can check for flags to remember which branch you took before at ANY time in your story. You can use “if” and “else” to direct what a character should say or do based on a choice they made. For example:
HAYES
How was your walk?
YOU
Really good.
if (MET_ROBERT_FROST){
YOU
I took a different route.
And met a famous poet!
} else {
YOU
I took my usual route.
}
HAYES
Sounds fun!
In short, “if” the reader made a choice earlier in which they gained the flag “MET_ROBERT_FROST” then they will say that to Hayes. Else (otherwise) they will say “I took my usual route.”
You can create complex story deviations with this technique, allowing players to meet new people, learn new information, visit new places, etc. Just remember that you must ALWAYS close all of your loops narratively. A players should never need information they may not have, or be stuck because they did not make a certain choice. You can see more flag examples in the Example Script: Complex Choices
Branching and Chapters
Even with all these branching options, all chapters must have a single starting point. If you have multiple alternate storylines that exist over the course of several chapters, you need to use FLAGS to resume the correct story line at the beginning of each chapter.
Here are two example chapters which deal with storylines.
These flags are exactly what we have been talking about above - things that set what choice a player may have made in an important decision. These last across chapters and can be referenced between them, but we canNOT end in the middle of a branch.
Nested Branches
Branches can be nested (branches within branches) and grow to be really complicated. We recommend against it, but we support it. Here is an example of nested choices and nested consequences in Example Script: Nested Choices.
Check Your Flags
It is important that all of the flags you reference in your if statements exist somewhere in the story. If they do not, your story will break.
You can use the “Check Flags” tool on the story page to check what flags you have created and where. It will also show you when you reference those flags later. Most importantly, it will show you if you are referencing a flag that does not exist. You MUST fix this.
Character Points
Each character in the story has a score. The user can gain or lose points depending on what choices they make. Add or subtract points from a character’s name either when they speak or if they are standing off screen:
SARAH
I only watch the real football: soccer
LUIS -1
That is too bad.
SARAH
What, you have a problem with soccer?
@LUIS +1
You can also reset a character’s score to 0, if you need to clear the board. This can only be done this way:
@CHARACTER =0
Later you can use your score with a character to select different storylines.
SARAH
Hey I was wondering...
Wanna go to the movies?
if (LUIS > 1){
LUIS
Sure!
} elif (LUIS < -1){
LUIS
Ha. You’re kidding right?
I despise you!
} else {
LUIS
No, I have plans.
}
Comments
0 comments
Article is closed for comments.