Branching Structures
Last updated
Last updated
Below are some article links that discuss some of the complexity of the structure of branching narratives integrated into games or stories. There is not a simple programming pattern method to implement these systems.
The simplest nonlinear stories use a branching structure; you start at the beginning, are given several options, and those options lead to new choices, which each lead to new choices…this can go on forever, but there is a point where all of these branches become too expensive.
Tracking a world state allows the writer to create more advanced branching narratives, without writing thousands of nodes. A choice can set a variable (such as true/false, or increase by a factor of 1, etc.). Then, later on, when text is being printed by the computer, it can check that variable and print different text based on the value of that variable. This can limit the choices available to a player, or simply change whether the player character is described as a “he” or “she.”
Robert Yang - Radiator Design Blog
branching narrative is just the mental model, the conceptual result, the imaginary line of causality that we want players to understand. That doesn't mean we actually have to author our branchy narrative as a branching structure, it just has to unfold like one or resemble one in the player's head. Instead, maybe we can just write, like 100 different plot events that get triggered based on specific conditions that may or may not get fulfilled during gameplay: e.g. if (player.health > 0.5 && isNotPresident && ateShrimp) then (player.FoodPoisoning();) or something like that. Some plot events might have only a single condition (if the player is not president) or they might get more specific (if the player is not president and ate shrimp). The idea is that you choose the most specific plot event that fits -- and if none fit, then you can trigger a fallback that still fits but has less context. In this way, different (but similar) piles of world states will lead to different (but similar AND specific) responses. It's a self-branching structure! (I'm glossing over a lot of details here -- I really recommend looking at Ruskin's slides.)