Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Dynamic Story Scripting with the ink Scripting Language

You're reading from   Dynamic Story Scripting with the ink Scripting Language Create dialogue and procedural storytelling systems for Unity projects

Arrow left icon
Product type Paperback
Published in Nov 2021
Publisher Packt
ISBN-13 9781801819329
Length 272 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Cox Daniel Cox
Author Profile Icon Daniel Cox
Daniel Cox
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Section 1: ink Language Basics
2. Chapter 1: Text, Flow, Choices, and Weaves FREE CHAPTER 3. Chapter 2: Knots, Diverts, and Looping Patterns 4. Chapter 3: Sequences, Cycles, and Shuffling Text 5. Chapter 4: Variables, Lists, and Functions 6. Chapter 5: Tunnels and Threads 7. Section 2: ink Unity API
8. Chapter 6: Adding and Working with the ink-Unity Integration Plugin 9. Chapter 7: Unity API – Making Choices and Story Progression 10. Chapter 8: Story API – Accessing ink Variables and Functions 11. Chapter 9: Story API – Observing and Reacting to Story Events 12. Section 3: Narrative Scripting with ink
13. Chapter 10: Dialogue Systems with ink 14. Chapter 11: Quest Tracking and Branching Narratives 15. Chapter 12: Procedural Storytelling with ink 16. Assessments 17. Other Books You May Enjoy

Disappearing and sticky choices

The default behavior of a weave is to direct the flow of a story along with one of the branches presented by its choices. When the reader makes a choice, the others disappear, and the branch chosen becomes the current flow of the story. Even when rewinding when using Inky to test a story, there appears to only be one valid branch of a weave at any one time.

Anticipating situations where the reader might revisit a part of a story with choices the reader might not have seen before, ink uses the concept of sticky choices to present the same choices again to the reader. Using sticky choices, each remains open during a revisit and can be used again in the future:

You look at the boulder in front of you.
+ Push the boulder.

Sticky choices are created using the plus sign (+). They can be thought of as the opposite of a gathering point. Instead of collapsing a weave, a sticky choice keeps open the option within a weave of using a different branch. Any sticky choice created as part of a weave is always sticky, even if it is the only one within the weave:

You look at the boulder in front of you.
+ Push the boulder.
* Ignore it for now.

In the previous code, there are two choices:

  • The first is a sticky choice.
  • The second would be removed upon a second visit to the code.

In the example, boulder could be ignored once, but the next time the reader visited the part again, they would only see one option: Push the boulder.

In examples where the story only flows down from top to bottom, sticky choices seem of little use. Upon making any choice, the story would flow along a branch and to the next lower part in the story regardless of the choice type:

The blank page stared back at me, taunting me. I glanced again at the clock and then back at the page. I needed to write something.
+ I tried again to write something.
    I wrote a few words and paused.
+ I checked my email again.
    No new messages.

In the preceding example, there is a single weave with two sticky choices. When moving through the story from top to bottom, the weave would be visited once and either choice would branch out and then back together again at the end.

The same example could be made with the other choice type.

The blank page stared back at me, taunting me. I glanced again at the clock and then back at the page. I needed to write something.
* I tried again to write something.
    I wrote a few words and paused.
* I checked my email again.
    No new messages.

Where the two code examples are different is in their intention. In the first, the reader could, potentially, revisit the same part of the story and see the choices again. In the second, the choices are one-way. By making a choice within the weave, they cannot be revisited in a story. Once made, a basic choice is permanent. The only way to change this intention is to use sticky choices that add themselves back to the weave when used.

In the next chapter, Chapter 2, Knots, Diverts, and Looping Patterns, we move into examining loops and controlling the flow of a story across more complex structures. Loops will allow us to revisit the same section of a story multiple times. In these cases, sticky choices will become the default usage for creating options for the player. Because sticky choices remain open, they allow an author to create a weave where a player can select the same option multiple times.

You have been reading a chapter from
Dynamic Story Scripting with the ink Scripting Language
Published in: Nov 2021
Publisher: Packt
ISBN-13: 9781801819329
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image