StoryDev - A parser for interactive story development

I’ve posted this once or twice before, but this was on the OpenFL forums. I have been working on a story development tool for Haxe for a long time now, which would allow you to write interactive non-linear stories within any context.

The idea behind StoryDev is to be as simple as possible while providing you with an easy tool to translate story into any game engine. It has no dependencies and can be integrated into your code base in very few lines:

package;

import sd2.Parser;
import sd2.CommandType;

...

static var parser:Parser;

...

parser = new Parser();
parser.parseFile("test.sdc", true);
var block = parser.getBlocks()[0];
if (block == null)
{
   trace("For some reason, the first block could not be found.");
   return;
}
    
for (command in block.commands)
{
   switch (command.type)
   {
      case CommandType.NARRATIVE:
      {
         trace(": " + command.data[0]);
      }
      case CommandType.DIALOGUE:
      {
        trace(command.data[0] + " : " + command.data[1]);
      }
      case CommandType.CHOICES:
      {
        for (choice in command.data)
	{
	    // each choice is text with the `;` separating the display text
	    // from the conversation to go to.
	    var display = choice.substr(0, choice.indexOf(";"));
	    var goto = choice.substr(choice.indexOf(";") + 1);
	    trace("> " + display + " -> " + goto);
	}
      }
    }
  }
}

The following is an excerpt from my own interactive story currently being created:

# The True Beginning
: It was the early morning when I awoke to thumping outside.
: Danger was near, so I quickly got out of bed and rushed to the other bedroom.
Johiah : Quickly, out of bed!
Caroline : Huh?
Johiah : Cultists!
Saniyah : What!?
Caroline : No! After all this time?
Johiah : We must leave, quickly!
: They had crashed through the windows which alarmed the children.
: The children pounced out of bed and cowered behind me.
: One of the cultists clearly recognised me.
Cultist : Ah! Johiah. The daughter of the royal family.
Cultist : I didn't expect to see you here.
Johiah : I'm sure you didn't. And I'm sure you also know of the tales too.
Cultist : We have no time for petty debate. We have come for the children.
Cultist : Now hand them over, or die defending them.
> Defend them -> Defend the Children
> Try to converse out -> Converse

As you can see, the idea is to be as simple as possible. It’s designed to be easy for both a screenplay writer and game developer who can communicate the story effectively in a video game using any library.

All full README is available on the GitHub project which you can use. Any help or feedback using this library, post here and I will do my best to support.

2 Likes

StoryDev, a project that has been mostly a scripting engine, has now got its own editor, meaning you can now design and develop video games with comprehensive story editing tools.

The features include:

  • Ability to manage data for interactive stories, saved as JSON files which can be used in other projects.
  • Create and manage conversations using an interactive semi-linear approach to story design.
  • Write your stories using simple syntax. The project sd2 can be used to parse your stories with the Haxe programming language.
  • Create and design maps for a visual aid to managing your story, as well as being a method for designing and creating Places and Sections.
  • Simulation options to allow debugging of your conversations – know at any point in your story what your Best and Worst outcomes will be.

Official documentation has not been produced, but you can use the Twinspire StoryDev category on our website as a reference for understanding how the project has developed and how to use all of the features.

Note that this software is in Beta and some features may appear not to work as expected or some buttons may just not do anything at all.

I am happy to receive feedback on existing features.

You can browse and download the current project over on GitHub.

3 Likes