Dialogative 2.0.1

dotnet add package Dialogative --version 2.0.1
                    
NuGet\Install-Package Dialogative -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dialogative" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dialogative" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Dialogative" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dialogative --version 2.0.1
                    
#r "nuget: Dialogative, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dialogative@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dialogative&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Dialogative&version=2.0.1
                    
Install as a Cake Tool

NuGet

<img src="https://raw.githubusercontent.com/ydinkov/Dialogative/master/Dialogative/icon.png" alt="Dialogative icon" width="180" />

Dialogative is a YAML-driven dialogue engine for games, with PowerFx conditions, branching options, and explicit state updates.

Install

dotnet add package Dialogative

Minimal YAML Example

title: Tavern Intro

scenes:
  default:
    - line: ["Welcome back, traveler."]
      speaker: "Innkeeper"

    - line: ["What do you need?"]
      options:
        - text: "A room"
          goto: room
        - text: "Just passing by"
          goto: exit

  room:
    - line: ["One room. Fresh sheets. No questions."]
      speaker: "Innkeeper"
      update:
        set: "hasRoom"
        to: true
      goto: exit

Example 1: Dialogue Object (event-driven)

Use Dialogue when you want direct control and optional event subscriptions.

using Dialogative;

var gameState = new Dictionary<string, object>
{
    ["reputation"] = 5,
    ["hasRoom"] = false
};

var dialogue = new DialogueBuilder()
    .FromFile("tavern.yml")
    .WithGameStateProvider(() => gameState)
    .Build();

dialogue.SubjectChanged += speaker => Console.WriteLine($"[speaker] {speaker}");
dialogue.SoundTriggered += sfx => Console.WriteLine($"[sfx] {sfx}");
dialogue.EventTriggered += evt => Console.WriteLine($"[event] {evt}");
dialogue.StateUpdateRequested += (key, value) => gameState[key] = value!;

while (!dialogue.IsFinished)
{
    var result = dialogue.Continue();

    if (result.HasError)
    {
        Console.WriteLine($"Error: {result.Error}");
        break;
    }

    if (result.IsFinished)
        break;

    Console.WriteLine(result.Text);

    if (result.HasOptions)
    {
        var selected = result.Options[0].Text; // replace with player choice
        result = dialogue.ChooseOption(selected);

        if (result.HasError)
        {
            Console.WriteLine($"Error: {result.Error}");
            break;
        }

        if (!result.IsFinished)
            Console.WriteLine(result.Text);
    }
}

Example 2: DialogueHandler (imperative wrapper)

Use DialogueHandler for a straightforward Continue/ChooseOption loop that always takes an explicit game state.

using Dialogative;

var gameState = new Dictionary<string, object>();

var handler = new DialogueBuilder()
    .FromFile("tavern.yml")
    .BuildHandler();

DialogueResult result = handler.Continue(gameState);

while (!result.IsFinished && !result.HasError)
{
    Console.WriteLine(result.Text);

    if (result.HasOptions)
    {
        for (var i = 0; i < result.Options.Count; i++)
            Console.WriteLine($"[{i + 1}] {result.Options[i].Text}");

        var chosenText = result.Options[0].Text; // replace with player input
        result = handler.ChooseOption(chosenText, gameState);
    }
    else
    {
        result = handler.Continue(gameState);
    }
}

if (result.HasError)
    Console.WriteLine($"Error: {result.Error}");

Result Model Quick Reference

Each Continue/ChooseOption call returns DialogueResult, including:

  • Text and Speaker
  • Mood, Sound, Music, Event
  • Options (with lock state)
  • StateChange
  • IsFinished and HasError flags

NuGet README Publishing

This repository is configured so README.md is included in the package and displayed on the NuGet package page via:

  • PackageReadmeFile metadata in the project
  • Packing README.md into the .nupkg root
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 131 7/19/2026
2.0.0 100 7/19/2026
1.1.0 350 8/12/2023
1.0.8 276 7/28/2023
1.0.5 630 2/13/2022
1.0.4 603 2/13/2022
1.0.3 608 2/13/2022
1.0.2 603 2/13/2022
1.0.0 295 2/13/2022