Home > Store > Programming > Games

Writing Interactive Fiction with Twine

Register your product to gain access to bonus material or receive a coupon.

Writing Interactive Fiction with Twine

Best Value Purchase

Book + eBook Bundle

  • Your Price: $26.99
  • List Price: $44.98
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

More Purchase Options


  • Your Price: $19.99
  • List Price: $24.99
  • Usually ships in 24 hours.

eBook (Watermarked)

  • Your Price: $15.99
  • List Price: $19.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.


  • Copyright 2016
  • Dimensions: 7" x 9-1/8"
  • Pages: 432
  • Edition: 1st
  • Book
  • ISBN-10: 0-7897-5664-1
  • ISBN-13: 978-0-7897-5664-0

Writing Interactive Fiction with Twine: Play Inside a Story

If you’ve ever dreamed about walking through the pages of a book, fighting dragons, or exploring planets then Twine is for you. This interactive fiction program enables you to create computer games where worlds are constructed out of words and simple scripts can allow the player to pick up or drop objects, use items collected in the game to solve puzzles, or track injury in battle by reducing hit points. If you’ve clicked your way through 80 Days, trekked through the underground Zork kingdom, or attempted to save an astronaut with Lifeline, you’re already familiar with interactive fiction. If not, get ready to have your imagination stretched as you learn how to direct a story path.

The best part about interactive fiction stories is that they are simple to make and can serve as a gateway into the world of coding for the nonprogrammer or new programmer.

You’ll find expert advice on everything from creating vivid characters to building settings that come alive. Ford’s easy writing prompts help you get started, so you’ll never face a blank screen. Her “Try It Out” exercises go way beyond the basics, helping you bring personal creativity and passion to every story you create!

  • Get familiar with the popular Twine scripting program
  • Learn how to design puzzles
  • Build your own role-playing game with stat systems
  • Maintain an inventory of objects
  • Learn game design and writing basics
  • Change the look of your story using CSS and HTML
  • Discover where you can upload your finished games and find players

Sample Content

Sample Pages

Download the sample pages (includes Chapter 3 and Index)

Table of Contents

Foreword xvi

Introduction to Interactive Fiction 1

Chapter 1 The Nuts and Bolts: Getting Started with Twine 5

Installing Twine 5

Starting Your First Story 6

Saving in Twine 9

Navigating Twine Menus 9

    Getting to Know the Stories Screen 9

    Getting to Know the Blue Grid Screen 9

    Getting to Know the Hover Menu 10

Chapter 2 Using Choice to Create Agency 13

Designing Agency 14

    Providing Clues 17

    Crafting Meaning 18

    World-Building with Optional Details 19

    Using Choice to Affect Pacing 21

Imagining Different Choices 22

    Giving Preference Choices 22

    Giving Value Choices 22

    Giving Adventure Choices 22

    Giving Ethical Choices 22

    Giving Cause/Effect Choices 22

    Giving Exploratory Choices 23

    Giving Obtainable Choices 23

    Giving Directional Choices 23

Plotting Your Story’s Choices 23

Handling Endings 25

    Using the Fan Story Shape 25

    Using the Hourglass Story Shape 25

    Delaying Branching 27

Creating Another Type of External Link 27

Chapter 3 Creating a Vivid Setting 29

Understanding the Importance of Setting 29

    Creating Setting from Prompts 30

    Adding Descriptions with (link:) 31

    Repeating Text with (display:) 32

Setting Tips and Exercises 35

    Writing What You Know 35

    Being the Player’s Eyes 36

    Considering What a Character Would Notice 36

    Combining Motion with Surroundings 37

    Using Your Other Senses 38

    Considering the Mood of a Place 38

    Drawing the Player’s Attention 40

    Using Descriptive Words 40

    Distinguishing Static and Dynamic Settings 42

Building a Map-Based Game 43

Creating a Maze 46

Chapter 4 Designing Puzzles 49

Finding Puzzle Ideas 50

    Finding Puzzles in Everyday Life 50

    Making Your Puzzles Matter 51

Building Puzzles in Twine 52

    Finding the Starting Point and End Goal 52

    Adding Layers to Your Puzzle 54

    Finishing the Puzzle 58

Building Other Types of Puzzles 58

Using Macros and Hooks 59

Using Named Hooks 62

Chapter 5 Building Objects with Variables 67

Using Objects in Interactive Fiction 67

Building Interactive Objects with Variables 68

    Creating a Variable 68

    Changing a Value 69

    Using Strings 70

    Using Boolean Values 70

    Using Variables in Passages 71

Building Conditional Statements 77

    Adding a Conditional Statement 78

    Adding More Than One Condition 81

    Keeping Track of the Player 83

Setting Up Types of Quests 86

    Writing Search Quests 86

    Writing Fetch Quests 87

    Writing Drop-off Quests 87

    Writing End Quests 87

    Writing Rescue Quests 88

    Writing Escape Quests 88

    Writing Transformative Quests 89

    Writing Creation Quests 89

Chapter 6 Stasis, Catalyst, and Climax: Understanding Story Arc 91

Drawing a Story Arc 91

Understanding Time and Pacing 93

Making a Game with Story Arc 94

    Opening a Game in Stasis 94

    Continuing to the Catalyst 96

    Building to the Climax 97

    Returning Back to Stasis 99

Diagramming the Story 100

Extending Story Arc 102

Counting Turns with the (history:) Macro 103

    Controlling Time with (history:) 104

    Controlling Links with (history:) 105

Chapter 7 Exploring Interactive Fiction Genres 107

Managing Reader Expectations 108

Creating Chance with the (either:) and (random:) Macros 109

    Using the (either:) Macro 109

    Using the (random:) Macro 113

Delving into Genres 115

    Exploring Horror 115

    Exploring Fantasy 116

    Exploring Science Fiction 117

    Exploring Mystery 118

    Exploring Espionage 118

    Exploring Adventure 119

    Exploring Magical Realism 120

    Exploring Historical 120

    Exploring Western 121

    Exploring Nautical 123

    Exploring Fairytale and Folklore 123

    Exploring Mythology 124

    Exploring Realistic Fiction 125

    Exploring Other Genres 125

Understanding Motivations 126

Chapter 8 Constructing Believable Characters 127

Recognizing the Traits of Successful Characters 127

Using the (click:), (mouseover:), and (prompt:) Macros 129

    Using the (click:) Macro 129

    Using the (mouseover:) Macro 132

    Using the (prompt:) Macro 137

Distinquishing Types of Characters 138

Limiting Characters 139

    Creating a Clear Set of Traits 139

    Setting a Goal 142

    Being Vulnerable 143

Deepening Character Building 144

    Assigning Purpose 144

    Providing Exposition 145

    Exploring Relationships 145

Chapter 9 Maintaining an Inventory 147

Managing Inventory with Arrays 148

Using Variables to Work Around Arrays 151

Using the (array:) Macro 154

    Building a Basic Array 154

    Adding Items to an Array 156

    Dropping Items from an Array 158

    Checking Strings in an Array 159

    Checking the Array Size 161

    Limiting the Array Size 161

    Troubleshooting Arrays 162

Using the (count:) Macro 164

Utilizing Literary Techniques 165

    Using Symbolism 166

    Using Allegory 166

    Using Simile 167

    Using Metaphor 167

    Using Analogy 168

    Using Allusion 169

    Using Irony 169

    Using Hyperbole 170

Chapter 10 Achieving Proper Pacing 171

Understanding Plot 172

Setting the Pace with Language 177

    Determining Description Amount 177

    Employing Internal Thoughts 177

    Leaving Information Unknown 177

    Setting the Danger Level 177

    Varying Sentence Length 178

    Regulating Passage Length 178

    Limiting Word Count 178

    Using Sentence Fragments 178

    Moving with Vivid Verbs 179

Utilizing Setter Links 179

Chapter 11 Foreshadowing Important Clues 183

Using the (append:) Macro 184

Using the (prepend:) Macro 187

Foreshadowing Clues 189

    Dropping Direct Clues 189

    Dropping Subtle Clues 190

    Dropping Dream Clues 190

    Dropping Feeling Clues 190

    Dropping Red Herrings 190

Creating a Hint System 191

Including Inside Jokes and Easter Eggs 194

Chapter 12 Making a Role-Playing Game 195

Using the (datamap:) Macro 196

    Adding Values to the Datamap 197

    Removing Values from a Datamap 198

    Using a Datamap for a Stat System 198

Establishing Class 199

    Becoming a Wizard 199

    Becoming a Knight 199

    Becoming a Thief 199

    Becoming a Healer 199

    Becoming an Elf 200

    Becoming a Dwarf 200

    Coding Class Selection 200

Establishing Names 202

Establishing Personal Characteristics 203

    Choosing Gender, Height, and Weight 204

    Troubleshooting User Play Decisions 204

Establishing Traits 206

    Deciding on Traits 207

    Determining Hit Points 207

Making the Next Character 208

Wrapping Up the Opening 210

Limiting an Array 211

Chapter 13 Combat and Consequences in Role-Playing Games 213

Exploring the World 215

    Using Personal Characteristics 215

    Making Consequences 217

    Using Traits 219

    Using Items 220

Battling Monsters 223

    Starting the Fight 224

    Continuing the Fight 227

Solving Puzzles 229

Writing a Conclusion 231

Taking Your Role-Playing Game to the Next Level 231

Breaking Down Game Writing into Manageable Chunks 231

Chapter 14 Wiggling Words: Changing the Text Appearance 233

Changing Fonts 234

    Adding a New Font 234

    Designing Fonts 235

    Picking a Font 236

Changing Text Style 237

    Adding Style 237

    Changing Understanding 238

    Changing Size 239

Changing Text Color 240

Changing Text Transitions 241

Chapter 15 Story Style: Changing the Game Appearance in Harlowe 243

Navigating the Stylesheet 244

    Setting Up Selectors and Declarations 245

    Changing the Background 247

    Changing the Sidebar 248

    Changing the Font 249

    Changing the Links 251

Getting Rid of Whitespace 252

Chapter 16 Adding Images in a New Format 253

Changing Over to SugarCube 254

    Learning a New Macro Format 255

Deciding to Use Images 256

    Knowing Which Image Files You Can Use 256

    Enhancing Understanding with Images 257

    Enhancing Player Mood with Images 257

    Enhancing Game Play with Images 257

Adding Images to a Game 258

    Sizing Images Before Uploading 258

    Writing Image Code in a Passage 258

Using Images Creatively 260

    Making Simple Links 260

    Making Setter Links 262

    Making Mouseover Clues 264

Chapter 17 Setting Up the Pre-Story, Central Story, and Post-Story 267

Learning New Macros 268

    Using the <<set>>, <<unset>>, and <<print>> Macros 268

    Using the <<if>>, <<else>>, and <<elseif>> Macros 270

    Using the <<nobr>> and <<silently>> Macros 273

Designing the Pre-Story 275

    Telling or Not Telling 276

    Working the Backstory into the Game 277

    Including Game Tutorials 278

Designing the Post-Story 279

    Defining the Ending 279

    Moving Beyond Happily Ever After 281

    Making Sequels 282

Chapter 18 Developing a Strong Player Character 283

Using the <<button>>, <<radiobutton>>, and <<checkbox>> Macros 284

    Learning the <<button>> Macro 284

    Learning the <<radiobutton>> Macro 285

    Learning the <<checkbox>> Macro 286

Using the <<textarea>> and <<textbox>> Macros 288

    Learning the <<textarea>> Macro 289

    Learning the <<textbox>> Macro 290

Using the <<click>>, <<append>>, <<prepend>>, <<replace>>, and <<remove>> Macros 291

    Learning the <<click>> Macro 291

    Learning the <<append>> and <<prepend>> Macros 292

    Learning the <<replace>> and <<remove>> Macros 294

Working with Narrative Voice 296

    Setting the Narrator 296

    Being Consistent 297

    Changing the Point of View 298

    Playing for Research 299

Communicating with Non-Player Characters 299

    Handling Dialogue 299

    Using Twine Tricks for Conversation 301

    Conveying Nonverbal Communication 302

    Employing Juxtaposition and Contrast 303

Defining Goals and Assigning Purpose 303

    Creating Blank or Defined Player Characters 303

    Considering Gender 304

    Slipping Into Character 304

Chapter 19 Balancing Pacing and Action 307

Using the either() and random() Functions 308

    Learning the either() Function 309

    Learning the random() Function 310

Using the turns() and visited() Functions 311

    Learning the turns() Function 311

    Learning the visited() Function 313

Using the <<back>> and <<return>> Macros 315

    Learning the <<back>> Macro 315

    Learning the <<return>> Macro 316

Using the <<display>>, <<actions>>, and <<choice>> Macros 317

    Learning the <<display>> and <<actions>> Macros 317

    Learning the <<choice>> Macro 319

Saving Your Game 320

    Using the Save Feature 321

    Retrieving a Saved Game 321

Playing with the Pacing 322

    Speeding Up the Story 322

    Slowing Down the Story 323

    Striking a Pacing Balance 323

Managing Expectations 324

    Highlighting Change 324

    Using the Rule of Three 325

    Distracting the Player with MacGuffins 325

Chapter 20 Keeping Players Engaged 327

Returning to Arrays 328

    Building a New Array 328

    Adding Items to an Array 329

    Dropping Items from an Array 330

    Checking Strings in an Array 332

    Limiting the Array Size 333

    Troubleshooting Arrays 334

Checking Your Inventory 335

    Setting Up an Inventory Passage 335

Understanding Special Passages 337

    Using the StoryMenu Passage 337

    Using the StoryCaption Passage 338

Knowing Your Audience 339

    Aiming for a Niche 339

    Speaking Broadly 340

    Writing for One Person 340

    Deciding on Length 341

    Piquing Interest with a Teaser 341

Recognizing the Three Types of Players 342

    Making Games for Win Seekers 342

    Making Games for Story Seekers 343

    Making Games for Realism Seekers 343

Keeping Players Engaged 344

    Having a Plan 344

    Being Creative 344

    Giving a Purpose 345

    Rewarding Choices 345

    Leaving Them Dreaming 345

Chapter 21 Show, Don’t Tell 347

Learning About Other Formats 349

    Adding New Formats in Twine 349

Utilizing the time() Function and <<timed>> and <<goto>> Macros 350

    Counting Seconds 350

    Building a Timer 352

    Delayed Text 353

Practicing Showing, Not Telling 354

    Problems with Telling 355

    Describing Actions 356

    Drawing Conclusions 357

    Demonstrating Behavior 358

    Transporting the Reader 359

    Trusting the Reader 360

Telling, Not Showing 361

Chapter 22 Story Style: Changing the Game Appearance in SugarCube 363

Navigating the Stylesheet 363

    Reviewing Selectors and Declarations 364

    Changing the Background 367

    Changing the Sidebar 368

    Changing the Font 372

    Changing Links 374

    Creating a Class on the Stylesheet 376

Using HTML in a Passage 378

    Bolding Words 378

    Italicizing Words 379

    Underlining Words 379

    Resizing Words 379

    Changing the Color of Words 379

    Putting It All Together 380

Chapter 23 Finishing Up and Clicking Publish 381

Editing Techniques 381

    Tackling Different Types of Edits 382

        Editing for Structure 382

        Editing for Details 384

        Editing for Sound 384

        Editing for Coding Errors 384

        Editing for Mechanical and Grammatical Errors 385

    Navigating to the Proofing Copy 385

Testing Your Game 386

    Questioning Beta Testers 386

    Using Testing Notes 387

Clicking Publish 388

    Hosting Your Project on Philome.la 389

    Hosting Your Project on the Internet Fiction Database 389

    Hosting Your Project on Your Own Site 391

    Comparing the Options 392

Reaching Your Audience 392

    Posting on IFDB.tads.org 392

    Posting on Forums 392

Joining the Gaming Community 393

    Participating in Jams 393

    Participating in Competitions 394

    Earning Interactive Fiction Awards 394

Breaking the Rules 394

9780789756640   TOC   4/11/2016


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership