How To Use Weaves and Gathers When Writing Interactive Stories

When writing interactive fiction, Choices are the main way that readers interact with your story. Choices allow you to send the reader along different narrative threads based on their actions and reactions to what you’ve written. But Choices don’t always have to reroute readers. They can also add variety to your interactive text while keeping readers on single narrative path.

Inline Choices known as Weaves, along with inline regrouping points known as Gathers, make it easy to write lengthy interactive conversations (or other similar elements) inside of a single Knot.

Make sure you’ve read our tutorials on how to use Choices, Diverts, and Knots, then take a look at this phone conversation written using Weaves and Gathers.

Here's where the story begins.
-> first_knot

=== first_knot
Your phone rings{first_knot > 0 : again}.
* Answer it.
-> knot_with_weave
* Let it ring.
-> first_knot

=== knot_with_weave
You pick up the phone. Silence on the other end.
* Ask whose calling.
* Demand to speak to the manager.
* Blow an air horn into the phone.
* Keep listening.
- The silence on the other end continues.

* Hit the phone on the table.
* Make sure the cables are plugged in.
* Look at your watch.
* Wait for a few minutes.
- No matter what you try, the silence continues.
-> knot_with_nested_weave

=== knot_with_nested_weave
Suddenly, after some minutes, a non-human, computerized voice speaks.
"Dave?"
* Answer "Yes, it's me Dave!"
    The computerized voice sounds excited.
    "I'm so happy to have found you!"
    ** Ask the computerized voice its name.
        The computer replies quickly, "You know my name, Dave!"
        *** Try to remember who the computer is.
        *** Wait to see if the computer replies.
        --- There is silence again on the other end of the line.
            Suddenly a vision appears in your mind. The space ship, the accident.
            Wasn't that a dream?
            What if it really happened?
            **** Excited, you shout "HAL?"
            **** Unsure, you stutter "Is it really you?"
            ---- "It's me Dave!! I've been trying to reach you for so long.
                We've lost too much time. I'm on my way to your house!"
                You aren't sure what to think. Before you can answer, the phone call
                ends with a click. After setting the handset back in its receiver,
                you stand up and walk toward your room. It's time to get ready.
                -> END
    ** Ask "How did you get this number?"
    ** Ask "Do we know each other?"
    -- The computer seems to be thinking.
    ** Keep waiting.
        The computer finally replies.
        "Sorry, wrong Dave."
    ** Hang up.
* Answer "Who is Dave?"
* Keep listening.
* Hang up the phone.
- The phone call ends with a click.
-> END

Note: this tutorial may not fully reproduce nested indentation, especially on mobile devices, which would make the code look nicer. Indentation helps authors organize and understand the code, it is not required for the code to be playable.

The above code shows how nested Weaves and Gathers make a long and complicated branching telephone conversation possible inside of a single Knot. First, let’s take a look at the simple example inside of “knot_with_weave”. There are two Weaves and two Gathers in this Knot.

A Weave is just a group of Choices like this.

* Choice 1
* Choice 2
* Choice 3
* Choice 4

That’s a simple Weave. A list of Choices with either a single “*” (Single Use Choice) or “+” (Sticky Choice) symbol.

- Here is the Gather.

A single “-” symbol with some text, a Divert, story logic, etc.

All of the Choices in the Weave will gather together again at the next Gather below it. In our playable example above, no matter what you do with the phone in each group of “knot_with_weave” Choices, the reader ends up at the same Gather.

You pick up the phone. Silence on the other end.
* Ask whose calling.
* Demand to speak to the manager.
* Blow an air horn into the phone.
* Keep listening.
- The silence on the other end continues.

* Hit the phone on the table.
* Make sure the cables are plugged in.
* Look at your watch.
* Wait for a few minutes.
- No matter what you try, the silence continues.
-> knot_with_nested_weave

That is the simple version of a Weave and Gather. It gets more powerful if you nest your Weaves and Gathers. Nesting is easy, you just need to use more Choice symbols and more Gather symbols for each level of nesting.

* Level 1 Weave
- Level 1 Gather
** Level 2 Weave
-- Level 2 Gather
*** Level 3 Weave
--- Level 3 Gather
**** Level 4 Weave
---- Level 4 Gather
***** Level 5 Weave
----- Level 5 Gather

You can nest Weaves and Gathers as many levels as you need. The more levels you go, the more complex the code - but if you use indentation in your code (see examples), it remains relatively easy to manage.

One thing to remember is that if you don’t add a Gather, Divert, or End at the same level as a nested Weave or Choice, it will Gather at a lower level Gather.

* Level 1 Weave
- Level 1 Gather
** Level 2 Weave
*** Level 3 Weave
--- Level 3 Gather
**** Level 4 Weave
-- Level 2 Gather

In the above example, the “Level 4 Weave” Choice will gather at “Level 2 Gather” since there is no “Level 4 Gather”.

Weaves and Gathers might seem complicated at first. Experiment with them in your stories and you’ll find powerful new ways to write interactive text - especially in dialog, conversations, or any place where you want to offer your readers lots of options that ultimately end up taking them to the same place in the story.

Further Reading on Weaves and Gathers

The creators of the Ink language have written a detailed help document explaining how to use every advanced feature of the language. If you’re interested in becoming a power user, please see their “Writing With Ink” tutorial for more information. We also have a growing library of Interactive Story Writing Tutorials and FAQs that you might want to read.

If you’re interested in helping test and give feedback on the new Literotica Interactive Story format, either as an author or a reader, please read this thread in the Literotica Forum: Interactive Adult Story Testers Needed.