Narramancer Window

The Narramancer Window acts as a hub for the main elements of your game, including the Verbs, the Nouns, and Global Variables.

Advanced note: the Narramancer Window is the properties panel for Narramancer Singleton, which is a ScriptableObject.

The window has two views: Editor Mode and Runtime Mode.

Accessing the Narramancer Window

To open the Narramancer Window, use the menu bar at the top of the Unity Editor, choose Window -> Narramancer.

The menu for opening the Narramancer Window

The menu for opening the Narramancer Window.


The Narramancer Window will open up as a Unity Panel, and can be docked in a way like the Inspector panel or the Project panel.

Editor Mode

The Editor mode allows you to attach starting nouns and verbs, as well as assign other values.

A screenshot of the Narramancer Window in Editor Mode

A screenshot of the Narramancer Window in Editor Mode.


Editor Mode has four subviews: Nouns, Adjectives, Verbs, and Variables.

The first three sub views allow you to assign the starting Nouns, Adjectives, and Verbs, respectively. Nouns applied this way will be instantiated on game start, and Verbs assigned this way will run immediately after.

Variables

Narramancer has a built-in 'variables' feature, which allows values to be assigned, accessed, and manipulated from various parts of the system.

The following section outlines what we call Global Variables. There are also Scene Variables and Verb Variables. The three 'scopes' differ in where they exist, but are similar in how they are used.

To use a variable, it must be defined prior to runtime and it must have a type and a name.

Creating Variables

Open the Narramancer window, use the Editor mode, switch to the Variables Tab, and add Variables using the variables list.

A screenshot of the Variables tab within the Narramancer Window.

A screenshot of the Variables tab within the Narramancer Window. There are two variables defined: an integer


Starting Values

The third field on the variables table is for the 'starting value' (for supported types). The variable will take on this value on game start.

GameObject Starting Values

Assigning GameObjects from within a scene to a variable's starting value is not supported. In order to reference in-scene GameObjects using variables, there are three ways:

  1. Use a SetGlobalVariablesMonoBehaviour to assign the global variable on scene start.
  2. Use a Narramancer Scene component and assign the desired GameObject to a Scene variable.
  3. Use a RunActionVerbMonoBehaviour and assign the GameObject to a Verb variable.

Using Variables

Global variables are assigned using SetVariableNodes (with the setting for scope set to Global). Note that the node can only be used in ActionVerbs and will only assign the value when it runs.

A SetVariableNode assigning a value to the 'money' global variable.

A SetVariableNode assigning a value to the 'money' global variable.


Accessing global variables can be done using a GetVariableNode with its scope set to Global.

A GetVariableNode getting the value of the 'money' global variable.

A GetVariableNode getting the value of the 'money' global variable.


Runtime Mode

During Unity Play Mode and using the Narramancer Runtime Mode, you can see the current table of NounInstances and manipulate various values.

A screenshot of the Narramancer Window in Runtime Mode

A screenshot of the Narramancer Window in Runtime Mode.


For debuging or testing purposes, you can see all aspects of each NounInstance, as well as add or remove properties and stats.

Singleton

The Narramancer system uses a Singleton pattern, meaning there is one static class (called an instance, not to be confused with NounInstances) that handles most of the functionality. The Narramancer Singleton is guaranteed to exist at game start because it is a ScriptableObject asset.

Script and code can call almost any Narramancer method using a static call to NarramancerSingleton.Instance.

A code example of accessing the NarramancerSingleton instace.

A snippet of code with two uses of the NarramancerSingleton instance: the first one attempts to get a NounInstance, and the second one creates a new NounInstace.


This allows you to have access to the table of nouns as well as other functionality.

The Narramancer Window is (more or less) the properties of the Narramancer Singleton ScriptableObject.