Rollin Poe as a storyteller with Unity Narrative Engine

The Scope Story Content Delivery and Interaction

To increase participant engagement while participating in ExNovo UI research experiments, I created a system to house a lighthearted, spacefaring story. Written as a standalone module, the narrative system allows for on the fly audio and art control, player input, and between session saves.

Time: December, 2019 — February, 2020
Status: Complete*

* The narrative gameplay system is complete, but as it was written for the ongoing ExNovo project, incremental updates and tweaks may occur.

A Couple Key Aspects

  • Independent story engine can be inserted into any project
  • High level of control over backgrounds, characters, text, audio, and more with simple, custom scripts
  • Feature addition and integration into existing codebase

Prolouge Engagement through narrative

Vancouver is under attack

A need for context

As the Cognitive Science Lab moved to the second round of testing the ExNovo interface, we saw the need for a longer testing session. In order to keep players actively engaged, we opted to provide context for their actions by framing it around a fun story about invading aliens, friendly robots, and becoming the very best (like no one ever was). To accomplish this, we needed a framework that could house our story and that would be robust to any future directions we took the project, or new ones the lab came up with.


Chapter 1 Background

Hierarchy

Setting the scene

The framework allows for three independent layers to create the backing environment. A background layer provides the base, foreground mainly for transitions, and midground layer for effects. Each layer is independent of the others and can use any visual asset such as photos, animated gifs, and videos.

Chapter 2 Characters

Layers!

Breathing life into the world

Backgrounds do us very little good without characters to live in them. A theoretically unlimited number of actors can be spawned into the scene. Each character inherits from a master character class (in Character.cs) with the unique attributes being housed in its prefab. Characters can talk via the dialogue system, move and animate on screen, and house relevant story elements within their instantiation. Any Unity model can be slotted in, though the current state is set up for sprite-based characters.

Chapter 3 Story

Example Narrative Script

Scripts and Scripting

As unique a challenge as a dialogue free story may be, the time for that is in a different project. Character dialogue and actions are read off text files with custom markup embedded in them. Dialogue is rendered with TextMesh Pro meaning the system has access to crisp vector fonts and effects (colour, bolding, differing fonts, etc.), as well as inline sprite rendering.


Text can be displayed on a per character basis, all at once, or anywhere in between. The dialogue scripts also hold the story choice options, and have the ability to call functions in the narrative engine, load scenes, effect components outside the framework and more.

Epilogue Engine

Scripts

Putting it all together

A brief overview of the key scripts

  • NovelController.cs: The main system for high level controls such as saving and loading, handling the dialogue scripts, player choice input, interacting with the Unity engine, etc.
  • DialogueSystem.cs & TextArchitect.cs: The main systems for displaying text and dialogue.
  • Character.cs: Acts as a parent for all characters. Houses functions to speak, change location, change sprite/animation, instantiate new characters, etc.

Check out the codebase on Github

Locked

The core scripts of the narrative engine can be found on my personal github. Check it out here. Please note that this is only a copy of the main project on a private development repo and as such does not house any art, story, or gameplay assets, and may not reflect the current project.