Skip to content

A high-performance, dependency-free development library for parsing and editing Rhythm Doctor and Adofai levels.

License

Notifications You must be signed in to change notification settings

RDCN-Community-Developers/RhythmToolkit

Repository files navigation

logo

License Nuget Download Downloads

If you find this project helpful, consider sponsoring via 爱发电 (Chinese mainland) or Ko-fi (Global)!

RhythmBase

[ English | 中文 ]

This project primarily serves Rhythm Doctor and A Dance of Fire and Ice level developers, aiming to provide an engine-agnostic, high-performance, systematic, and intuitive level editing proxy development library for developers.
Thanks to the Rhythm Doctor fan community for their support of this project.
You can see examples here.

Special Thanks

Project Description Status Link
RhythmBase Core library for level editing proxy. Maintained You are here
RhythmBase.View Draw all Rhythm Doctor events with SkiaSharp and TypeScript DOM versions. Under Development Go there
RhythmBase.Addition Extensions for the core library. Not disclosed -
RhythmBase.Interact Interact with game level editors. Not disclosed -
RhythmBase.Hospital Level review, hints, and assistance features. Not disclosed -
RhythmBase.Lite Lightweight version of RhythmBase. Under Development Go there
RhythmBase.Control UI control library for level editing proxy. Not disclosed -
flowchart RL
RBLite[RhythmBase.Lite]
subgraph RD[Rhythm Doctor]
  RDLE[Rhythm Doctor Level Editor]
end
subgraph AD[Adofai]
  ADLE[Adofai Level Editor]
end
RDL([Rhythm Doctor Level])
ADL([Adofai Level])
subgraph RBTitle[RhythmBase]
  RB[RhythmBase]
  RBAdd[RhythmBase.Addition]
  RBInt[RhythmBase.Interact]
  RBHos[RhythmBase.Hospital]
  RBV[RhythmBase.View]
  RBVts["RhythmBase.View(TypeScript)"]
  subgraph RBC[RhythmBase.Control]
    RBCCore[RhythmBase.Control.Core]
    RBCWPF[RhythmBase.Control.WPF]
    RBCWF[RhythmBase.Control.WinForm]
    RBCAva[RhythmBase.Control.Avalonia]
  end
end

RBLite ---> RDL
RBCWPF & RBCWF & RBCAva --> RBCCore --> RBV
RBV & RBHos & RBAdd & RBInt --> RB ---> RDL & ADL
RBInt ---> RDLE --> RDL
RBInt ---> ADLE --> ADL
RBV <-.-> RBVts
Loading

Core Features

Comprehensive Event System Support

RhythmBase provides a strongly-typed event model for both Rhythm Doctor and A Dance of Fire and Ice, covering all official event types and Adofai's advanced filter system, also providing compatibility for potential new event models in the future. Through type checking and intelligent hints, it eliminates runtime errors at the source.

Intelligent Event Processing

  • Event Discovery and Querying - Flexible LINQ query support makes it easy to filter events by type or condition
  • Automatic Relationship Management - Event binding system automatically maintains parent-child relationships without manual tree structure handling
  • Timeline Generation - Built-in timeline management tools support advanced temporal sequences and control logic

Rich Toolkit

  • RichText Support - Complete rich text syntax parsing and code generation for dialogue and title events
  • Easing Function Library - Contains all in-game easing curves with support for custom interpolation functions
  • RDCode Integration - Native support for Rhythm Doctor's code system, including syntax analysis and expression evaluation
  • Macro Event System - Generate complex event sequences through code while maintaining full compatibility with original levels

Read/Write Performance Comparison

This section compares the read and write speeds for the level The Power of Terry (the-powe-S7V1kg9RWYK.rdzip).
Operating System: Windows 25H2 26200.7462
CPU: 12th Gen Intel® Core™ i7-12650H
RAM: 16GB

🟥Rhythm Doctor Level Editor v1.0.3/r42(r65) Windows da9f047

  • Utilizes scrEditor.Decode to open the main.rdlevel file and scrEditor.Encode by pressing Ctrl + S in the Editor Interface.

🟩RhythmBase v1.3.4 .NET Standard 2.0

  • Uses RDLeve.FromFile to read the complete rdzip file and RDLevel.SaveToFile to save it as an rdlevel file.
  • Tested in .NET Framework 4.8.9221.0

🟦RhythmBase v1.3.4 .NET 8.0

  • Uses RDLeve.FromFile to read the complete rdzip file and RDLevel.SaveToFile to save it as an rdlevel file.
  • Tested in .NET 8.0.11
---
config:
    xyChart:
        height: 300
    themeVariables:
        xyChart:
            plotColorPalette: '#FF0000, #00FF88, #0088FF'
---
xychart
  title "Read Time"
    y-axis "Eclapsed (ms)"
    %% RDLE
    line [14441.1006, 16324.7944, 16264.1535, 16592.9209, 16411.6373, 16414.5378, 16274.7375, 16567.1659, 16288.4762, 16382.9809]
    %% RDTK .NET Standard 2.0
    line [3273.9261, 2793.1168, 2796.0169, 2750.7386, 2757.9804, 2734.5127, 2715.0270, 2765.0712, 2749.9744, 2764.9854]
    %% RDTK .NET 8.0
    line [1887.2656, 1353.3896, 1076.3732, 1121.0746, 1080.6883, 1074.4476, 1122.7722, 1091.6990, 1103.6302, 1149.2975]
Loading
---
config:
    xyChart:
        height: 300
    themeVariables:
        xyChart:
            plotColorPalette: '#FF0000, #00FF88, #0088FF'
---
xychart
  title "Write Time"
    y-axis "Eclapsed (ms)"
    %% RDLE
    line [242.5163, 280.5837, 243.9327, 238.8927, 244.9178, 243.3303, 251.8815, 243.9217, 331.3641, 265.0274]
    %% RDTK .NET Standard 2.0
    line [513.1026, 361.6694, 350.3818, 347.8336, 349.8539, 356.7689, 353.0014, 350.7653, 354.2552, 348.2180]
    %% RDTK .NET 8.0
    line [460.3911, 224.0186, 165.0900, 175.7229, 150.6010, 144.8973, 155.9880, 150.8031, 155.9035, 153.7161]
Loading

Platform and Language Interoperability

Cross-Platform Support

Thanks to .NET Standard 2.0 compatibility, RhythmBase runs seamlessly on multiple platforms:

  • Windows - Via .NET Framework 4.6.1+ or .NET Core/8.0+
  • Linux - Via .NET Core/8.0+ (with Mono compatibility)
  • macOS - Via .NET Core/8.0+

This means regardless of your operating system, you get a consistent development experience and API interface, avoiding common cross-platform incompatibility issues.

Multi-Language Support

Thanks to cross-language interoperability technologies in the .NET ecosystem, you can call RhythmBase from different programming languages:

C#, F#, VB.NET, C++/CLI - Native support

Python - Via the pythonnet library, you can use RhythmBase directly in Python, suitable for:

  • Writing automation scripts
  • Batch processing level files
  • Integrating with Python data analysis tools

Here are concrete code examples:

C# Example - Standard .NET development approach:

using RhythmBase.Global.Components.Vector;
using RhythmBase.Global.Settings;
using RhythmBase.RhythmDoctor.Components;
using RhythmBase.RhythmDoctor.Events;

LevelReadOrWriteSettings settings = new()
{
	UnreadableEventsHandling = UnreadableEventHandling.Store,
};
RDLevel rdlevel = RDLevel.Default;

foreach (Row row in rdlevel.Rows)
{
	MoveRow moveRow = new MoveRow()
	{
		Beat = new RDBeat(3),
		Position = new RDPointE(10, 20),
	};
}

rdlevel.SaveToFile("111.rdlevel");

Python Example - Using pythonnet to bridge .NET and Python ecosystems:

# Assembly loading operations
import pythonnet
pythonnet.load('coreclr')
import clr
clr.AddReference('RhythmBase')

from RhythmBase.Global.Components.Vector import *
from RhythmBase.Global.Settings import *
from RhythmBase.RhythmDoctor.Components import *
from RhythmBase.RhythmDoctor.Events import *

settings = LevelReadOrWriteSettings()
settings.UnreadableEventsHandling = UnreadableEventHandling.Store
rdlevel = RDLevel.Default

for row in rdlevel.Rows:
    move_row = MoveRow()
    move_row.Beat = RDBeat(3)
    move_row.Position = RDPointE(10,20)

rdlevel.SaveToFile('111.rdlevel')

This flexibility enables RhythmBase to integrate into various toolchains and workflows, regardless of your preferred programming language or development environment.

Advanced Features

Error Handling and Resilience

RhythmBase provides flexible error handling mechanisms:

  • Unreadable Event Mode - When encountering unrecognized events, choose to store raw data rather than throwing exceptions
  • Custom Error Handling - Full control over how to handle various exceptional situations

Type Safety and Compile-Time Checking

Benefits of C#'s strong type system:

  • Intellisense Support - IDE automatically suggests all available event properties and methods
  • Refactoring Support - Automatically updates related code when modifying event structures
  • Compile-Time Verification - Eliminates runtime type errors

Performance Optimization

  • Zero-Copy Serialization - Efficient binary format handling
  • Incremental Processing - Stream processing support for large level files

Extensible Design

  • Partial Classes and Extension Methods - Easy to extend functionality without modifying core library
  • Interface-Driven Design - Interface-based event classification for custom processing logic
  • Plugin Architecture Foundation - Solid foundation for building toolsets and extensions

Rich Data Structures and Algorithms

  • Generic Vector System - Support for multiple-precision point, size, and rectangle structures (floating-point, integer, expression, optional value)
  • Curve Interpolation Engine - Support for easing functions and custom curves for animation and numerical computation
  • Timeline Management System - Automatic generation and maintenance of level timelines supporting complex animation and event sequences
  • Collections and Iterators - Efficient collection implementations with LINQ query and lazy loading support

Complete Text and Serialization Support

  • RichText Engine - Strongly-typed rich text structures supporting styles, events, and range operations
  • JSON Serialization - High-performance serialization based on System.Text.Json supporting complex nested structures

About

A high-performance, dependency-free development library for parsing and editing Rhythm Doctor and Adofai levels.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages