Coder Social home page Coder Social logo

heavenmercy / storyteller-engine Goto Github PK

View Code? Open in Web Editor NEW
30.0 2.0 2.0 442 KB

A Godot plugin helping in building interactive fictions and dialog system

License: GNU General Public License v3.0

GDScript 100.00%
gdscript godot-engine godot3 godotengine interactive-fiction plugin dialog dialogue

storyteller-engine's Introduction

StoryTeller Engine

A Godot 3.x plugin helping in building interactive fictions and dialog system.

Creation of story

This engine can be created entirely in a GDScript or via the editor for the creation of narration (stories, interactive fictions, dialogs...)

  1. via GDScript

story made via gdscript

The useful classes are: st.StoryLock (a boolean data), st.StoryValues (a float data), st.StoryChunk (a chunk of story), st.StoryCommand (a command to execute), st.StoryTeller (which tells story and executes commands), StoryListener (which hold values, locks, command option's values, namespaces to activate or not...). So the basic process is this one:

  • Instanciate a st.StoryListener with two dictionaries names to values, one for locks and another for values

  • If you need commands, load them (listener.load_commands([namespace...])) using instances of st.StoryCommandNamespace. in each namespace, it is possible to add st.StoryCommand (namespace.add_command(command)).

  • Instanciate a st.StoryTeller with that listener and load st.StoryChunks (teller.load_story_chunks([chunk...])

  • Set the start point (teller.set_start_point(chunk_id)) of the story to a chunk id

There we already have the teller for the next step

  1. via the editor

editor

The two necessary classes are: st.StoryInterpreter (which is used to interpret a story file and st.StoryTeller.

  • Open the editor, by clicking st.StoryTeller at the bar where 2d and 3d are.

  • Make a story in the Sandbox and save it as a file. It is obviously possible to modify the file later.

  • The steps it requires in GDScript to load the story:

    • get the default interpreter st.get_default_interpreter()
    • set a base path to get stories from (interpreter.set_base_path(path))
    • load a story file (interpreter.load_story(story_filename, [custom_listener])) [with extension or not]

Loading the story from a file returns the teller for the next step

Execution of story

With the teller (st.StoryTeller) got we have the possibilities to tell the story and to execute a command.

  1. Telling Story

Each story chunk can have a condition for it to get read/shown. So if a chunk has no condition or verified conditions, it is read by the teller. Delayed chunk are pushed into the stack of delayed chunks waiting for the moment to show. The method of the teller to show story chunks is tell( delta ): delta is used to calculated elapsed time for delayed chunks. The method returns a string if there is a story chunk to read or else it returns null.

  1. Executing Commands

Each command is in a particular namespace. if its namespace is activated, the command can be executed. The command can have a default chunk to read (always read or not) and option related to a chunk to read too. When a command is executed a list of chunks is registered for reading. The method of the teller to execute a command is execute( command ): command is a string like "walk left=5". The method returns a boolean telling if the command has been successfully executed.

To see how the engine works, check the folder scenes. It contains a scripted story and the test scene which loads some stories. The folder assets/stories contains the story created via the editor. It is possible to choose which story to load in the script TestScene.gd at line 36.

The project is still a WIP... I reworked most of the logic of the engine and the editor. If you have issues or suggestions, it will be a pleasure to know about it. Just write it in Issues! Thanks

storyteller-engine's People

Contributors

heavenmercy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cybersys hanok2

storyteller-engine's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.