Framework Overview

Estimated reading time: 5 minutes

maplebirchFramework (package name: maplebirch, Chinese name: 秋枫白桦框架) is a modular mod development framework designed for Degrees of Lewdity (DOL) based on Sugarcube2 ModLoader. It provides a structured middle layer between ModLoader and individual mods, offering mod developers lifecycle management, shared services, and reusable tools.

Niche

ELK not loaded. Ensure /elk.bundled.js is loaded before the app.

The framework is distributed as .mod.zip and loaded by ModLoader at startup. The entry point is compiled to dist/inject_early.js and injected via the scriptFileList_inject_early mechanism. At runtime, it exposes the global instance window.maplebirch, a singleton of the MaplebirchCore class.

Runtime Dependencies

The framework declares the following hard dependencies, all of which must be loaded before maplebirch:

DependencyMinimum VersionPurpose
ModLoader>=2.0.0Core mod loader and lifecycle
ModLoaderGui>=1.0.0GUI panel host
ModSubUiAngularJs>=1.0.0AngularJS component registration (settings UI)
ConflictChecker>=1.0.0Mod conflict detection
BeautySelectorAddon>=2.0.0BSA image pipeline (NPC sidebar)
ReplacePatcher>=1.0.0Passage content replacement
TweeReplacer>=1.0.0Twee passage replacement
GameVersion>=0.5.7.0Game version detection

Core Capabilities

The framework provides the following core modules:

  • AddonPlugin System — Integrated with ModLoader lifecycle, handles automatic loading of scripts, NPCs, audio, and framework configuration
  • Variable Management — Unified V.maplebirch namespace with default values and version migration support
  • Character Rendering — body / head / face / clothing layer system, hair color gradients, mask generation
  • Named NPCs — NPC registration and data management, sidebar model rendering, clothing system, scheduling
  • Combat System — Combat actions, reactions, voice registration, combat button generation
  • Dynamic Events — Time, state, weather event management and time travel
  • Audio Management — Howler.js-based audio playback, playlist management
  • Tool Collection — Console, random system, macros, HTML utilities, region management and other practical tools
  • GUI Control — AngularJS settings UI, module enable/disable control
  • Internationalization — Multi-language support (EN/CN), automatic translation file import
  • Event Buson / off / once / after / trigger event system
  • Persistent Storage — IndexedDB settings persistence
  • Logging System — Leveled logging (DEBUG / INFO / WARN / ERROR)

Global Access Paths

All features are accessed through the window.maplebirch singleton:

Access PathTypeDescription
maplebirch.addonAddonPluginPlugin system and lifecycle hooks
maplebirch.dynamicDynamicManagerDynamic events (time/state/weather)
maplebirch.toolToolCollectionTool collection (console/random/macros/HTML/regions etc.)
maplebirch.audioAudioManagerAudio playback and management
maplebirch.varVariablesVariable management and migration
maplebirch.charCharacterCharacter rendering layer system
maplebirch.npcNPCManagerNamed NPC system
maplebirch.combatCombatManagerCombat system
maplebirch.guiGUIControlGUI settings panel
maplebirch.langLanguageManagerInternationalization and translation
maplebirch.idbIndexedDBServiceIndexedDB storage
maplebirch.loggerLoggerLogging service
maplebirch.tracerEventEmitterEvent bus

The following convenience properties are also exposed:

PropertyDescription
maplebirch.yamljs-yaml library (frozen)
maplebirch.howler{ Howl, Howler } object (frozen)
maplebirch.lodashlodash-es library
maplebirch.SugarCubeSugarCube2 engine object
maplebirch.LanguageCurrent language (getter/setter)
maplebirch.LogLevelLog level (getter/setter)
maplebirch.gameVersionCurrent game version

Modules & Features

Feature highlights

  • Numeric clampingnumber() utility for range, rounding, step, and percent (Utilities)
  • Mask rotation — Character and NPC sidebar masks support rotation angle (mask and options)
  • Combat multi-slot — Combat buttons can use an array of actionType to show in multiple slots (Combat)
  • Zone injection — Use keys such as MobileStats to inject into mobile stats and other areas (Zones Manager)
  • Stat and grace display — Macros such as statChange and grace for numeric output (SugarCube macros)
  • Pronouns with ModI18N — When used with ModI18N, the framework corrects pronoun (his/hers) display for vanilla NPCs (Named NPC)

Next Steps