A child looking through a Bioscope (Image source: Google)

Stoa: A generalized interactive storyteller application

A 5th-semester classroom project done as part of the course on Data Structures and Algorithms. The aim of the project was to come up with a concept code in python that uses the concept of data structures.

Institution: Delhi Technological University
Team:
Akash K Seth & Ipshita Singh
Duration: 1 week

Abstract

The project aims at building a platform that provides to engage, choose, and modify a story to construct a unique experiential narrative. The user inputs command from the console and the program stores it. The interpreter then analyzes the input commands and extracts necessary data points. These data points are then used by the program to provide for subsequent choices which the user inputs and creates their own narrative.

The program is a character-oriented storytelling method redefining ‘First Person Perspective Narrative’. A paradigm shift from conventional storytelling methods, the progression relies on the choices the user makes at each step. Each choice creates a new narrative which in the bigger picture interconnects to form the unique journey.

Introduction

An interactive approach to storytelling helps children(i.e. target user set) in following the two ways - firstly it broadens the scope of imagination by leaving thinking spaces in between narratives, and secondly, it gives them the liberty to choose the direction they wanna take.

It is crucial that the thinking abilities aren’t hampered in this situation of the pandemic where the targeted user set along with the rest of the world is confined to the screens, which is the prime source of learning, education, and recreation. They could be receiving predisposed information without reasoning that, there could be another school of thought as well. This could have huge ramifications later in their life down the line.

We have developed a Python-based easy to use, story independent method to deliver creative and personalized narratives. The program provides for an interface that lets the user interact more intuitively by allowing them to simply click and select their preferred choice. The micro-interactions are written in a simple high-level language. One does not need to know Python in order to use the program.

By leveraging the capabilities of Python and the web we have built a system that will provide educators with a realistic yet simple approach to developing and iterating quickly over new narratives efficiently. It will also help children to understand and percept multiple scenarios in a situation.

The core application of the project relies on the imagination and availability of thinking space allowing the user to manipulate the direction of the flow of the story. The program emphasizes the visual structure of hypertext and does not require knowledge of a programming language like Java or C++ which are often cumbersome. The program allows for ample variation with minimum complexity.

The project specifically addresses the problem in a bottom-up approach fashion. It was made for the rising over exhaustion from screen time that has resulted from the pandemic and can be further extended to address the issue of declining reasoning and rational thinking models.

The input console was so designed that it prompted for almost every choice to be simultaneously displayed in the two buttons provided. The command triggers a discipline that follows up with the narrative that is stored in the respective choice. The output is that in snippets that interconnect to form the unique narrative in the bigger picture.

Description of data structures involved

In the design of the application, a non-linear and hierarchical structured approach was used. Linked lists, trees, and string arrays were used. All the data structures collectively contribute to the hierarchical structure for the narrative. The use of a linked list is for the easy addition or deletion of the different segments and the reason that it can point to the trees associated with each of them. The trees hold the main structure of providing the choices and taking a path for the narrative.

The attached snapshots describe the application briefly.

It shows the input insertion window along with the choice buttons and how the narrative keeps on changing with each choice provided.

Linked List

A linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes that together represent a sequence.

The reason to use linked lists over any other data structure is the ease and efficiency that it provides for adding or removing the nodes in between. The function of the linked list here is to contain the different segments in each node and point towards the tree that belongs to that specific node.

A representation of the structure of Linked list

Trees

A tree is a nonlinear hierarchical data structure that consists of nodes connected by edges. Unlike the other data structures like arrays or linked lists, it is non-linear and stores or retrieves data sequentially. The working of the tree would be as follows — the root node would contain the plot setting for that specific segment. The further child nodes would have the choices that are being provided to the user. The user chooses one of these choices and that defines the path that the narrative will take.

A representation of the structure of trees. The highlighted segment shows the path the user has taken.

Arrays

An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. The array data structure would be used as the content that is being stored to build up the story, be it taking inputs from the user such as names and traits or the build of the story that appears with each choice.

A representation of the structure of arrays

The flow of the application

The flow of the application represented linearly

When the program is initialized, the user is prompted to enter basic data and personality traits to build a character persona.

The data that is input, is then utilized to determine the preferences and genres for the user and subsequently provide them with an output.

The user is provided with two choices in predefined specific segments of the narrative. It allows for the narrative to be centered around the choices made in a tree-like hierarchical flow.

The narrative continues non-linearly based on the choices made.

The architecture of the application

The GUI library used for the compilation of the application is Tkinter. It provides a powerful object-oriented interface for the required application.

The overall design of the application can be broadly classified into the following categories:

  1. Graphical User Interface (GUI): the buttons
  2. A console to accept user data
  3. The output text area to display the narrative

Snapshot of window application:

The window for taking the inputs from the user such as the character name and character traits. The image below shows the process of taking the above-mentioned inputs.

The user is prompted to input values

Snapshots from the final window screens:

The snapshots of the whole process of choosing an option and continuing with the narrative. The button’s position remains constant while the choices provided keep updating.

Upon selecting a choice the narrative is built on

Coding Procedure

The core of the application relies on the use of a global variable ‘S’, that runs the program in loops. In each loop variable ‘S’ is updated and based on the current value, one can determine the timestamp.

The core of the application

In the program code, a global variable ‘S’ is assigned whose value keeps on increasing as we move further in the segment. With each choice provided the variable’s value increases by one because of which the next section is displayed. Further moving for the functioning of the tree, the root node contains the starting of the narrative, which provides two choices to move forward with. Both the child of the root nodes have different narratives attached to it and the further choices provided. The user picks a choice and defines the path for that specific step. To move forward users are again provided with two more choices. This process of picking the choice or the path is totally up to the user and it allows the user to make their own narrative for the whole story.

  1. Defining a global variable ‘S’ and using it to make the program move to the next section of the segment.

2. The functions of myclick1 and myclick2 are defined for displaying the choices for whichever path the user takes. It further increases the value of the global variable ‘s’ by 1 and moves on to the next part of the segment.

3. The pack() is a geometry widget used to create the button for the user to easily identify them as a choice and choose one of them.

4. The get() method is used to return the value of the key which is being assigned.

5. The .showwarning typically makes a pop-up box appear when the user doesn’t input the values and continues to choose on the choices and press the button

A collective compilation of the codes written

Conclusion

Storytelling is one of the most essential processes of learning in children, especially the young ones, it is a skill that they are most exposed to — be it fairytale or textbooks. The innate ability to imagine is diminishing in recent times thus making the process of learning redundant.

We are using an interactive programming based approach to build a platform for each user to determine their kind of storytelling and plot buildup.

The main challenge of the process is developing diverse sets of user personas and further segregating them to match each narrative.

References

  1. http://ijirt.org/master/publishedpaper/IJIRT101212_PAPER.pdf
  2. https://ro.uow.edu.au/cgi/viewcontent.cgi?referer=https://www.google.com/&httpsredir=1&article=1002&context=compsciwp
  3. https://www.geeksforgeeks.org/python-pack-method-in-tkinter/
  4. https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.105.9167&rep=rep1&type=pdf
  5. http://index-of.co.uk/Data-Structures/Data%20Structure%20For%20Game%20Programers%20-%20Ron%20Penton.pdf
  6. https://doc.lagout.org/science/0_Computer%20Science/2_Algorithms/Data%20Structures%20and%20Algorithms%20for%20Game%20Developers.pdf
  7. https://www.tutorialspoint.com/python/tk_button.htm
  8. https://stackoverflow.com/questions/43333720/inserting-data-into-a-database-via-tkinter-entries

Github link

https://github.com/Dizzybot31/Stoa-Interactive-storytelling/blob/main/Stoa_Interactive%20storytelling.py

Industrial design student at Delhi Technological University

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store