Dynamic Story Scripting with the ink Scripting Language
eBook - ePub

Dynamic Story Scripting with the ink Scripting Language

  1. 272 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Dynamic Story Scripting with the ink Scripting Language

About this book

Bring your stories to life by combining the narrative scripting language, ink, with a plugin to build dialogue, quest, and procedural storytelling systems for Unity projectsKey Featuresβ€’ Learn how to translate stories into ink code to create interactive projectsβ€’ Gain valuable insight into the ink story API to create engaging stories using the Unity pluginβ€’ Develop drop-in solutions to common narrative problems for Unity projectsBook Descriptionink is a narrative scripting language designed for use with game engines such as Unity through a plugin that provides an application programming interface (API) to help you to move between the branches of a story and access the values within it. Hands-On Dynamic Story Scripting with the ink Scripting Language begins by showing you how ink understands stories and how to write some simple branching projects. You'll then move on to advanced usage with looping structures, discovering how to use variables to set up dynamic events in a story and defining simple rules to create complex narratives for use with larger Unity projects. As you advance, you'll learn how the Unity plugin allows access to a running story through its API and explore the ways in which this can be used to move data in and out of an ink story to adapt to different interactions and forms of user input. You'll also work with three specific use cases of ink with Unity by writing a dialogue system and creating quest structures and other branching narrative patterns. Finally, this will help you to find out how ink can be used to generate procedural storytelling patterns for Unity projects using different forms of data input. By the end of this book, you will be able to move from a simple story to an intricate Unity project using ink to power complex narrative structures.What you will learnβ€’ Discover how ink understands stories and their partsβ€’ Examine ink patterns for making branching narrativesβ€’ Develop code in Unity using the ink plugin to manipulate storiesβ€’ Design advanced projects combining ink stories with C# codeβ€’ Compare common use cases for ink and Unity, such as dialogue systemsβ€’ Determine how ink can best fit into future narrative projectsWho this book is forThis book is for Unity developers looking for a solution for narrative-driven projects and authors who want to create interactive story projects in Unity. Basic knowledge of Unity game engine development and related concepts is needed to get the most out of this book.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere β€” even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Dynamic Story Scripting with the ink Scripting Language by Daniel Cox in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Graphics. We have over one million books available in our catalogue for you to explore.

Information

Section 1: ink Language Basics

By the time you've completed this section, you will be able to describe the major core language concepts and patterns of ink and how to use their syntax. This section contains the following chapters:
  • Chapter 1, Text, Flow, Choices, and Weaves
  • Chapter 2, Knots, Diverts, and Looping Patterns
  • Chapter 3, Sequences, Cycles, and Shuffling Text
  • Chapter 4, Variables, Lists, and Functions
  • Chapter 5, Tunnels and Threads

Chapter 1: Text, Flow, Choices, and Weaves

This chapter introduces the core concepts of nonlinear storytelling by examining branching narratives and how ink supports creating them. Building on these concepts, this chapter also reviews using lines, text within them, and how to combine them.
As a central element of creating nonlinear, interactive narratives in ink, choices are explained and how best to use them. Weaves and collections of choices are discussed within the context of when a large branching structure might be needed and how to collapse these weaves into simpler parts using gathering points.
In this chapter, we will cover the following main topics:
  • Understanding branching narratives as a flow
  • Creating choices and making weaves
  • Disappearing and sticky choices

Technical requirements

The examples used in this chapter, in *.ink files, can be found online on GitHub: https://github.com/PacktPublishing/Dynamic-Story-Scripting-with-the-ink-Scripting-Language/tree/main/Chapter1.

Understanding branching narratives as a flow

When holding a physical book, a reader moves through a story by turning its pages. The movement between pages is also a movement through the story. What is experienced by the reader is called a narrative. The story is the packaging of its content into different parts called pages. The reader's narrative, however, is the experience of the story across those pages.
In a digital setting, there are no physical pages. The words of a story could be stored as part of a simple text file or bundled together in something more complex. Parts of a digital story, which are the pages in a physical book, can also be arranged much more easily, and the reader might experience them in different configurations, creating new narratives from the same story content.
Consider the following example, where each sentence is a part of a story:
The sun was shining in a clear blue sky.
Clouds rolled in and it began to rain.
The clouds cleared away and the sun emerged.
When taken in order from the first sentence to the last one, there is a story where the major parts are the sun shining, the clouds coming in, but then the clouds leaving and the sun shining again. However, what happens if the parts are rearranged?
The clouds cleared away and the sun emerged.
The sun was shining in a clear blue sky.
Clouds rolled in and it began to rain.
With a different ordering, a new narrative is created for the reader. In this version, the progression begins with the sun emerging and shining. Next, the clouds move in and it begins to rain. In either case, only three events are used, but their order affects the narrative experience of the reader.

Nonlinear storytelling

In the second example, the story still makes sense. This time, however, the events start with the clouds, move into the sun shining, and end with the clouds returning. The second example, in moving around the events, is an example of nonlinear storytelling, where the events or parts of a story are experienced in a new or different way than created or originally written. The progression is not linear from one part to another as created in the story, but a cohesive narrative is still created:
Figure 1.1 – Mapping nonlinear storytelling
Figure 1.1 – Mapping nonlinear storytelling
The structures created by navigating a nonlinear story are often compared to trees. They start with a trunk and then, as different parts are encountered over others, a branching pattern is created, with each branch representing a movement through parts of a story from one end to another. The narrative traversal through a nonlinear story creates a branching narrative, where different parts were or were not encountered. The map of the experienced narrative represents a particular branch of the overall tree of the story and its parts.
While nonlinear storytelling can be done with a printed book, it is often much more difficult. In a digital setting, where events can be broken up into different parts, rearranging them can often be as easy as selecting them and dragging them to a different part of the same document. This consequence of representing stories as data makes writing code to handle arranging the different parts easier too. This is known as narrative scripting.

Introducing ink

ink is a narrative scripting language. It determines which part of the story comes next for the reader. As a user clicks or presses buttons, the code written in ink makes the decision between which branches they should visit and when. Based on rules written by an author, the code can even repeat the same part of the story with new values.
Because ink is designed for the purpose of scripting narratives, it understands navigation through a story as a special concept called flow. As the reader moves through the different parts, they are creating their own experienced narrative, which ink calls the flow. In fact, one of the most common errors encountered by authors is where the flow runs out of a story. Even when writing a nonlinear story with different branches, the story must start and end somewhere. Even if all the parts between the start and end of a narrative change each time a user traverses the parts of a s...

Table of contents

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