• Creates a new story runtime instance.

    The runtime manages the current position in the story and provides methods to navigate through nodes, make choices, and track effects.

    Type Parameters

    • TEffect

      The type of effects that can be applied in the story

    • TState

      The type of game state used for condition evaluation

    Parameters

    Returns StoryRuntime<TEffect, TState>

    A runtime instance for navigating the story

    Example

    const story: Story<{ health: number }> = {
    version: 1,
    entryKnot: 'start',
    knots: { /* ... */ }
    };

    const runtime = createRuntime(story, {
    conditionHooks: {
    hasKey: (state) => state.hasKey === true
    }
    });

    const step = runtime.current({ hasKey: false });