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:


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.");
for (command in block.commands)
   switch (command.type)
      case CommandType.NARRATIVE:
         trace(": " +[0]);
      case CommandType.DIALOGUE:
        trace([0] + " : " +[1]);
      case CommandType.CHOICES:
        for (choice in
	    // 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.

1 Like