Journey into the DAG: Puzzle Dependency Charts, Tentacles and You

Joshua Weinberg The Website is Down Intro

• Talk is about Puzzle Dependency Graphs

• I Applied this technique to analyze the game “

• I discovered non-obvious insights into the design of the game. Poster

Intro The Day of The Tentacle (LucasArts, 1993) Journey Into The DAG: Begin Game Find Dr. Fred's secret lab 5 Puzzle Dependency Chart Hierarchical Layout grouped by downstream goal. Access Green Tentacle's Access to Living Room Access to Secret Lab Room Disappearing Ink Nodes colored by game character. 63 puzzles in 5 groups. Puzzle Dependency Charts, Get Chattering Teeth Find Super Battery Plans Get Fake Barf Get Stamp

Tentacles and You

Hoagie Goal: Power Hoagie's Chron-o-John Red Paint Goal: Power Laverne's Chron-o-John Goal: Get Diamond Patent Letter to Hoagie Keys Hoagie

Get into Dwayne's room Get Laverne down from tree Get Crowbar Switch Statue Handedness A Puzzle dependency chart is a Directed Acyclic Graph (DAG). Dr Fred Book drinking Flag Gun to Hoagie Laverne Laverne Crowbar Crowbar Left handed statue his coffee

Get exploding cigar Get Dentures Laverne Access Outside Laverne Access Dr.'s Office Get quarters Get Dime in Gum Get access to VCR Sleepwalk Fred

Access Exploding Cigar Laverne's Fred Nodes represent puzzles. Edges indicate dependencies. Hoagie Chattering Teeth Lighter Gun Wine Dentures Scalpel to Bernard Crank Tentacle Chart Two Dimes Access to VCR Opening Safe Chron-o-John

Get Soap Build a fire in the fireplace Make Vinegar Dentures To Laverne Get Box o' Laughs Disguise Laverne Get Sweater Record Safe Combo

Quarters Access to History Room Bucket Access Future The Super Battery Plans Help Water Vinegar in Access Future Laundry Room Wanted Sign Hoagie Brush Soap The Blanket Time Capsule Disguise Cat Ice Chest Sweater Fred Tied Up Combo Tools: Get lab coat Start Storm Get the gold Give plans to Red Edison Get Vinegar Get ticket to Human Show Make Skunk Get Hamster to Laverne Get tiny sweater Get rope Get Contract Lab Coat Red Edison Franklin in Can Build Name Tag his Room Gold Oil Battery Vinegar Skunk on Roof Mouse Toy Frozen Hamster Red Paint Rope Box Fork Spaghetti Get Kite Get the Super Battery o' Laughs Enter Human Show Get Skunk Defrost Hamster Paint Ted Red Get Ted in Attic

Graphviz Gephi Tulip Cambridge Kite yEd Human Show Advanced Super Battery Dentures Starts Fake Barf Start Human Show Defrosted Hamster Tiny Sweater Red Ted Ted in Attic Charge Battery Mummy Fashion Get Rid of Harold Get Toasty Warm Hamster Rescue Dr. Fred Modeller Charged Super Battery Hot Mummy No Harold Dr. Fred Contract

Visualizations: Power Hoagie's Chron-o-John Win Human Show Get Signed Contract

Club Tentacle pass Signed Contract Stamp Hierarchical Dependency Chart, Hierarchical Dependency Chart, Turn off Kennel Mail Contract In Past Dependency Structure LucasArts Toasty Gantt Chart No Kennel Tentacle Guard Skunk Vacuum Flier Royalties ungrouped Warm 1 2 swimlanes based on character 3 Matrix 4 Hamster Free Edisons Make Vacuum Get Diamond Access to Future Lab

Tasks that have no assigned resources 0d 1d 2d 3d 4d 5d 6d 7d 8d 9d 10d 11d 12d 13d 14d 15d 16d 17d Extension Cord Laverne Access to Secret Lab Vacuum Begin Game Find Dr Fred's Secret Lab Get Chattering Teeth Get Crowbar Get Stamp Plug in Laverne's Chron-o-John Get Dusty Warm Hamster Find Super Battery Plans Get Fake Barf Get Dime in Gum Get quarters Get into Dwayne's Room Plugged in Chron-o-John Hamster Generator Give plans to Red Edison Paint Ted Red Get Dentures Get Soap Power Laverne's Chron-o-John Sleepwalk Fred Get Lab Coat Make Vacuum make Vinegar Get Laverne Down From Tree Switch Statue Handedness Get Sweater Get Exploding Cigar Start Storm Laverne Access Doctor's Office Laverne Access Outside Get Access to VCR Build a Fire in the Fireplace End Game Get Kite Get Box-o-Laughs Disguise Laverne Dentures to Laverne Hoagie's Laverne's Record Safe Combo Get the Gold Chron-o-John Chron-o-John Get Hamster to Laverne Make Skunk Powered powered Diamond Get Tiny Sweater Get Ticket to Human Show Get Vinegar Get Contract To download these graphs and the Day of Back to the Present Get Rope Defrost Hamster Get Skunk Enter Human Show Shrunken Kids Get Super Battery The Tentacle Puzzle Dependency Graph Get Ted in Attic Get Toasty Warm Hamster Get Bowling Ball Mummy Fashion Get Rid of Harold dataset visit: Charge Battery Rescue Dr Fred Bowling Ball Win Human Show Power Hoagie's Chron-o-John Get Signed Contract Turn off Kennel Knock Out Ten Tentacles Mail Contract in Past Free Edisons Get Diamond Plug in Laverne's Chron-o-John http://thewebsiteisdown.com/devblog Tentacle Boss Get Dusty Warm Hamster Power Laverne's Chron-o-John Back to the Present Get Bowling Ball Win The Game Knock out ten Tentacles Win the Game Effort (person-days per day) 13.0 In the Talk

● I’ll make some bold sweeping statements: ● Like for example I will define what a puzzle is! ● I’ll make some dramatic claims along the way: ● Like: No two players have ever solved this game in the same way. ● And: Narrative development is incompatible with non-linear branching. ● Will introduce some practical tools which give layout and analysis advantages. Who am I?

● Writer / Director of comedy videos ● The Website is Down (websiteisdown.com) ● Creating an adventure game from the Webseries ● Research for that game led to this analysis Puzzle Dependency Graphs What?

● The idea is: Make a diagram with all the puzzles in your game to show how they relate. ● Key insight here is that solving puzzles gives you things you need to solve other puzzles. ● Thus a dependent relationship between puzzles. Puzzle Dependency Graphs - Why

• Visualize the puzzles in your game

• Give insight into size, complexity, difficulty and pace of the game.

• Visualizes non-linear Branching

• Not used during actual play, just design.

• Noah Falstein GDC 2013 talk. Credits for first use in game design. PDG theory: graphs • A Puzzle Dependency Graph is a type of Dependency Graph. A dependency graph is a type of graph.

• Graph is a general data structure. A collection of nodes and relationships between them.

• Graphs in general can be:

• Directed / Undirected

• Connected / Disconnected

• Cyclic / Acyclic

• In degree and out degree PDG theory: Dependency Graph

• Dependency Graph is a special application of a graph in which edges represent dependent relationships between nodes.

• Dependency over time.

• DG have been around since the 60s : PERTT charts

• A common data structure DG is a DAG • A Dependency Graph is

• Directed

• Acyclic

• Known as a DAG

• Can be connected or not Puzzle Dependency Graph • PDG is the application of a dependency graph to puzzles in a game.

• Nodes in a PDG represent puzzles.

• Edges represent dependent relationships or “the thing you get from solving the puzzle which you use to solve another puzzle”. Puzzle / Dependency Definition

• What is a puzzle?

• For the purposes of this discussion… A puzzle is anything you do in the game which satisfies the dependencies of other downstream puzzles.

• What is a dependency?

• Anything which you have to do to solve a puzzle!

• Recursive and self-referential definition which is totally lacking in mathematical formalism but still super useful. Example • Need a sword to kill a dragon.

• Sword is in a locked chest.

• Need key to open the chest.

• “Kill the Dragon Puzzle” has a dependency on “Open the Chest puzzle”

• “Open the Chest Puzzle” has a dependency on “Get the Key Puzzle” Let’s talk non-linear branching • Our example game is linear - each puzzle has a single dependency and you must solve them each in order.

• Say the Opening the Chest puzzle had two dependencies - The hinge is rusty and you need an oil can to oil it before it will open - then you have a non-linear game segment.

• Player can solve Get the Key puzzle or Get the Oilcan puzzle in any order. Both must be solved to open the chest but the order is not important. Day of the Tentacle • We’ve covered PDG in general.

• We talked about non-linear branching.

• Let’s talk about Day of the Tentacle.

• Classic LucasArts game released in 1993

• Written by Ron Gilbert and he used a PDG to do it. The Day of the Tentacle • Play three characters in a time travel scenario.

• One primary goal - save the world

• Three sub-goals / sub-plots

• Power Hoagie’s Chron-o-John

• Power Laverne’s Chron-o-John

• Get a Diamond

• PDG is recreated here. Start with #1. Day of the Tentacle PDG Features • Nodes are colored by the character.

• Dependencies show the “thing” you get.

• Graphs all have identical data, just different layouts. What can we see here? • Single starting node

• Single leaf node

• What if multiple starting or ending conditions? This would mean multiple root or leaf nodes.

• Linear story game would have no branching and graph would be just a line. Non-Linear Branching in DOTT

• Non Linear Branching is when you have multiple puzzles “in flight” at the same time.

• With all their dependencies satisfied they are ready for the player to solve them.

• For example once you solve Get Laverne Outside you can solve

• Get Dentures to Laverne

• Get Box o’Laughs

• Disguise Laverne

• Visualized on the graph by Layers What’s so great about non-linear branching?

• Pros: This has the benefit of giving plenty of things to do at any time and avoids holding up the game because the player is stuck on a single puzzle.

• Cons: (Dramatic claim #2) Non-Linear Branching makes narrative difficult. Why does Non-Linear Branching make Narrative Difficult? • Need to talk about Topological Orders

• A Topological Order is an order in which you can visit the nodes in the graph such that their dependencies have been resolved by the time you get there.

• In the case of a PDG it is an order in which you can solve the puzzles in the game.

• Topological Sort is an algorithm which can find a topological order. Generating a topological order is the most common use for a dependency graph. How Many Topological Orders

• There can be more than one valid order for a graph!

• How many?

• To get a lower bound on the answer we can just look at a single layer. Each layer can be fulfilled independently. So pick the third layer. There are 13 puzzles.

• To compute permutations you take factorial of the number of items in the set.

• 13! is > 6 billion ways in which you can arrange the elements of that set. So 6 billion orders those puzzles can be solved.

• Based on this number I stake my dramatic claim #1 (TM) that outside of using a walkthrough no two players have ever solved all the puzzles in this game in the same order. Dynamic Storytelling • Professor ’s talk about interactive storytelling: I sing the Story Electric. Talk given at Practice 2015.

• A story is a particular causally related sequence of events

• Are these 6 billion paths through the graph all different stories?

• They are all particular sequences of events.

• But are these events causally related? We don’t know from looking at the graph. But from playing the game we know they are not. No narrative thread • For example there is no narrative thread connecting

• Get the lab coat

• Get the Soap

• Make Vinegar

• Get the Dentures

• I got the lab coat, then I got the soap, then I made the vinegar, then I got the Dentures.

• These are puzzles with no connection to narrative. Narrative Threads Go Vertically

• There is a narrative thread moving down the graph.

• Get the Soap

• Start Storm

• Get kite

• Charge Battery

• Power-Hoagie’s Chron-o-John

• These events ARE causally related and thus are a story.

• “I got the soap which I used to wash the buggy which caused a rainstorm which caused Ben Implications for Narrative • Non-linear branching makes narrative challenging. You can have both easily but you can’t do them both at the same time easily.

• If you have a layer with two nodes then you could make a story for each path because there are only two paths. With three nodes there are 6 paths - still possible.

• The growth is factorial. If you have a layer with13 nodes… not possible. How then? • So to create narrative and still have non-linear branching you must isolate the sub-plots into their own dependency tree.

• Follow the dependencies backwards to ensure your plot points are all within the inverted dependency tree.

• This is probably why Noah Falstein and Ron Gilbert advise to start at the ending and work backwards. Example • The graph on the right shows that in this game the three major plots are almost completely isolated.

• Even within these sub-plots there is more isolation into sub-sub-plots.

• If you read the graph backwards you can make sense of the story. Reading it layer at a time, no. Narrative Dependency Diagram

• Untested theory - create a dependency diagram for narrative.

• Nodes would be anything which reveals a plot point

• Edges would be the plot points, narrative information

• The tree would represent multiple stories at once and could ensure that the narrative is consistent if the dependencies are satisfied.

• This might be able to be incorporated into the puzzle dependency graph also. In short • Non-linear branching expands the graph horizontally.

• Narrative happens vertically.

• If you want puzzles to integrate with narrative you need to isolate the non-linear branching into manageable chunks

• This is exactly what DOTT does. See graph #3. Tools • Why use tools?

• Graphs look better. Also they have automated layout algorithms and analysis possibilities.

• General graphing tools:

• Visio

• Omnigraffle Tools 2 • Graphviz - simple common file format

• Gephi - designed for larger graphs. Includes spreadsheet like functionality for extra node properties.

• Tulip - Sugiyama layout. Python scripting.

• Yed - The best for this purpose. Good hierarchical layouts with lots of options. Swimlanes. Very easy to use. Was used to create these graphs. CAM • Cambridge Advanced Modeler

• Can generate DSM

• Can generate GANTT

• Can assign time range to each node and use statistical modeling to play with difficulty. Summary • Make a puzzle dependency graph when designing your game

• Don’t fear non-linear branching

• Isolate narrative subplots

• Work backwards

• Use tools

• Thanks!