Spielebuch: A package to create interactive stories

Spielebuch: A package to create interactive stories.

Tl;dr: I made two packages to create and display interactive stories with meteor. Check it out:

On atmosphere:

Examples:

Background:

I think we all know gamebooks, I read them in my youth and most of you did too. Last semester I participated in a project on my university where people tried to create a frame to accomplish this in Unity. I brought Meteor to the table and created a proof-of-concept. In the summer-break I rewrote everything and created these packages.
They are far from finished, but they work good enough to show them. And I want to use them in the upcoming hackathon, so I thought this post was the right thing to do.

Principles:

In the example apps you find in /server/story.js a heavily commented example. Additionally, a brief overview of the objects:

For each use a story is created:
var story = new Spielebuch.Story(userId);

For this story we can create scenes. You can see a scene as a location or a situation. If one or both change, you can change to another scene (like in theater). E.g.: Walk down the street => change the scene, everything explodes => change the scene…

You get a scene-object from the story:
var sceneOne = story.addScene();

Every scene has an index, so you can jump to it:
story.next(sceneOne.index)

You can add text to a scene:
sceneOne.addText(‘This is the first sentence.’);

GameObjects are word you can interact with. You create them by using markdown in addText:
var table = sceneOne.addText(‘This is a [table](table_key).’);

Table_key will be used later to add events and properties to all the objects with this key.
The variable table contains a gameobject you can work with:
You can add events (functions that are executed when triggered in the view):

table.setEvent(Attack, function () {
    player.attack(self);
}, 'fa-crosshairs');`

Properties of everything are set by rules (key/value) that can be packed into an effect and added to gameobjects or the player itself.

player.addEffect(new Spielebuch.Effect(‘Human’,[
    new Spielebuch.Rule(Spielebuch.Gameplay.damage, 20),
    new Spielebuch.Rule('Brave', 20);
]);

And they can be queried in-game.

var braveness = player.getValueByName('Brave');
if(bravebess<30){
    //player runs away
}

The value of rules can be absolute (Number) or manipulators (String ‘+30’,’-25’…) and can be added at runtime.
By the way: The player is created from the story.
var player = story.createPlayer();

I will write a documentation in the next weeks, feedback is always appreciated. Create an issue here or use this thread.

Have fun playing.