Branching Story Structures
Last updated
Last updated
In Project 2, we used the StateMachine framework to create the foundation of our branching story structure. In Project 3, we'll use data-structures to integrate additional conditional logic into the narrative. As a user makes decisions in the story, or interacts with gameObjects, data structures can be used to store that information so that those choices impact the remainder of the user's experience and path through the branching story structure.
In the article linked below, Jason Zeda has a diagram that shows how choices in Netflix's Black Mirror Episode Bandersnatch impact possible paths through the story-experience.
Interactive choose-your-own-adventure content is something I am very passionate about, and seeing how fans have spent the better half of three hours trying to “play all the endings” and soak up every piece of content, I am hoping that this is only the beginning. Not every type of story is right for this platform but with an engaging story, a competent filmmaker and some magic we haven’t seen before, I bet you this will something that only grows from here. I’ve said it many times in the past but will say it one more time…. this is the most exciting time in history to be a storyteller. Jason Zeda: Medium.com
The Qualities in Jason Zeda's diagram provide a good example that illustrates that a user-choice can be associated with simple data that is stored when a choice occurs, and accessed from data-memory at subsequent story points to enable or disable other story options.
A simple data structure for storing and checking this type of decision information is the C# Dictionary, since it can store pairs of information, where one part of the information , the Key is an identifier, which allows storage and access or the associated information, the Value. The C# Generic Dictionary allows an infinite choice of data-types for the key and value elements. Using C# String for both TKey and TValue provides a simple way to store and access this data in our game. In subsequent sections, we'll create an Inventory, which provides a more complex way to store game-data. The Inventory system does use a Dictionary, but it's not immediately obvious to understand how useful and simple dictionaries are for storing game-data. Unity provides 3 built-in Dictionaries for storing persistant data, these are the PlayerPrefs, each uses a String for the key, with a choice of int, float, string provided as different versions.