Movie Terms Wiki Filmmaking

State-Machine Script

A state-machine script is a programming and authoring approach used in interactive narratives to manage the story's various states, choices, and branching logic.


The Logic Behind the Branches

While a traditional film relies on a linear screenplay, an interactive film requires a much more complex foundational document: the state-machine script. This is not a script in the conventional sense, but rather a logical map or a set of rules that governs the entire interactive experience. In this model, a ‘state’ is a specific condition or moment in the story. A state could be defined by the video clip currently playing, but also by a host of hidden variables, such as ‘character A is angry at the player’ or ‘the player has found the key.’ The script defines all possible states and the ‘transitions’ between them, which are triggered by the viewer’s choices.

A Map of All Possibilities

Unlike a linear script that is read from page one to the end, a state-machine script is a non-linear system. It is often visualized as a ‘node graph’—a flowchart where each node represents a state (a video clip) and the lines connecting them represent the transitions (the user’s choices). This master document is the single source of truth for the entire production, dictating not only the narrative flow but also tracking all the variables that might influence later events in the story. For example, a choice made in the first five minutes might set a variable that changes a line of dialogue an hour later, and the state-machine script is what manages that complex cause-and-effect relationship.

Authoring Tools and Workflow

State-machine scripts are created using specialized software that blends writing with simple programming logic, a task that is impossible in standard screenwriting programs like Final Draft. Popular authoring tools for this purpose include:

  • Twine: An open-source tool for creating interactive, non-linear stories, often used for prototyping and writing.
  • Ink: A powerful scripting language developed by Inkle Studios, designed specifically for writing complex branching narratives.
  • Proprietary Engines: Major platforms like Netflix have developed their own internal tools for scripting and managing their interactive titles.

During production, this script guides the film crew on exactly which video segments (nodes) need to be shot. In post-production, programmers use the script to build the final interactive experience, ensuring the video player follows the prescribed logic, plays the correct clips based on user input, and keeps track of all the story’s hidden states.


© 2026 What's After the Movie. All rights reserved.

Privacy Policy