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.
- 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.
To get started with RenDisco, clone this repository and build the solution in your preferred .NET environment.
- .NET Core 3.1 or higher
- Clone the repository:
git clone https://github.com/aaartrtrt/RenDisco.git
- Navigate to the cloned directory and build the project:
cd RenDisco dotnet build
Below is a simple example of how to use RenPySharp in your project:
- Import RenDisco:
using RenDisco;
- 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
";
- Parse the script:
RenDisco.RenpyParser parser = new RenDisco.RenpyParser();
List<RenDisco.RenpyCommand> commands = parser.Parse(script);
- Set up the runtime engine:
RenDisco.IRuntimeEngine runtime = new RenDisco.SimpleRuntimeEngine();
- 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();
}
}
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on the work by the Ren'Py Visual Novel Engine.