Skip to content

RenDisco is a C# parser and runtime of a subset of RenPy.

License

Notifications You must be signed in to change notification settings

aaartrtrt/rendisco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RenDisco 🪩🕺📖

RenDisco is a project for .NET to parse and execute scripts written in a subset of Ren'Py - the popular engine for creating visual novels. It allows the integration of Ren'Py-like scripts within C# applications, allowing access to the .NET ecosystem while utilising the easy-to-learn syntax of Ren'Py to create dialogue.

Features ✨

  • Parsing Support: Parse Ren'Py-like scripts directly from C#.
  • Execute Commands: Seamlessly execute parsed commands using a runtime engine.
  • Modular Architecture: Easily extend and adapt the parsing logic and runtime interactions according to your needs.

Getting Started ✍️

To get started with RenDisco, clone this repository and build the solution in your preferred .NET environment.

Prerequisites 📦

  • .NET Core 3.1 or higher

Installation 🔧

  1. Clone the repository:
    git clone https://github.com/aaartrtrt/RenDisco.git
  2. Navigate to the cloned directory and build the project:
    cd RenDisco
    dotnet build

Usage 🏗️

Below is a simple example of how to use RenPySharp in your project:

  1. Import RenDisco:
using RenDisco;
  1. Prepare your script: Write your Ren'Py script as a string or load it from a file.
string script = @"
label start:
    e ""Hello, world!""
    jump finish

label finish:
    e ""Goodbye, world!""
    return
";
  1. Parse the script:
RenDisco.RenpyParser parser = new RenDisco.RenpyParser();
List<RenDisco.RenpyCommand> commands = parser.Parse(script);
  1. Set up the runtime engine:
RenDisco.IRuntimeEngine runtime = new RenDisco.SimpleRuntimeEngine();
  1. Do a Step loop:
while (true)
{
    // Check if we need to read a choice from the user
    if (play.WaitingForInput)
    {
        Console.Write("> ");
        int.TryParse(Console.ReadLine(), out int userChoice);

        // Create a StepContext with the user's choice loaded
        StepContext stepContext = new StepContext(userChoice - 1);
        play.Step(stepContext: stepContext);
    }
    else
    {
        Console.WriteLine("-");
        play.Step();
    }
}

License 📝

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

RenDisco is a C# parser and runtime of a subset of RenPy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages