How illusionmods/hsplugins works
1. Repository purpose
- This repo is a suite of BepInEx game-studio plugins for Illusion titles.
- It is not one app; it is a multi-plugin monorepo with shared code and per-game builds.
- The main product boundary is: game runtime on one side, plugin DLLs loaded into BepInEx on the other.
2. Top-level architecture
- The codebase is split into:
- shared cores (*.Core, ToolBox, UIUtility, BonesFramework, etc.)
- plugin frontends / game-specific projects (HSPE, HS2PE, KKPE, KKSPE, Timeline.*, VideoExport.*, etc.)
- supporting tools in Other/
- Most features are implemented once in a shared core, then exposed through per-game wrapper projects.
3. Game-specific plugin variants
- Many folders are separate builds for different games:
- HS, HS2, KK, KKS, AI
- These variants usually share the same feature code but differ in:
- game-specific types and APIs
- resource bundles
- compatibility patches
- packaging into distinct DLLs and release zips
- This is the repo’s main partitioning axis.
4. Shared feature cores
- Several subsystems are written as reusable “core” assemblies:
- Core.PoseEditor
- Timeline.Core
- UsefulStuff.Core
- VideoExport.Core
- NodesConstraints.Core
- CollidersDebug.Core
- ToolBox, UIUtility, BonesFramework
- These cores contain the bulk of the business logic and UI behavior.
- Per-game projects mostly bind these cores to a specific game’s runtime and class names.
5. Plugin families and their responsibilities
- Pose editing / studio control: HSPE, HS2PE, KKPE, KKSPE, AIPE, Core.PoseEditor
- Timeline/animation editing: Timeline.*
- Video/screenshot export: VideoExport.*
- Lighting and rendering tools: LightingEditor, RendererEditor, HSLRE, HSIBL, FogEditor, CameraEditor
- Accessory and wardrobe extensions: MoreAccessories*
- Utility/quality-of-life: UsefulStuff.Core, HSExtSave, NodesConstraints.*, CollidersDebug.*, HSStandard, HSSuimono
- Each family is a separate architectural boundary with its own config, resources, and compatibility patches.
6. Runtime integration pattern
- The plugins are loaded through BepInEx and interact with the game via:
- Harmony patches for runtime interception
- direct calls into game/editor APIs
- custom Unity UI components and windows
- The code frequently reacts to studio events, camera events, and character/pose state changes.
- A common flow is: game state change → patch/event hook → core logic updates models/UI → Unity scene changes.
7. UI and interaction layer
- UIUtility and ToolBox provide reusable building blocks for:
- movable windows
- context menus
- looped list views
- drag/scroll/pointer handlers
- localization/translation helpers
- Many plugins depend on these shared UI abstractions instead of duplicating UI code.
- This layer is a key diagram boundary between plugin logic and in-game Unity UI.
8. Data and configuration flow
- The fork moved configuration to BepInEx config rather than custom XML files.
- Several plugins also load embedded Unity asset bundles from Resources/*.unity3d.
- User-facing content is stored under UserData according to the README.
- So the typical data path is:
- packaged plugin DLL + embedded resources
- runtime config from BepInEx
- user content/assets from UserData
- game state from the running studio/game.
9. External/runtime dependencies that matter
- The architecture depends materially on:
- BepInEx 5 for plugin loading
- Harmony for patching
- Unity runtime/editor APIs
- in some plugins, external media tools bundled in repo, such as ffmpeg and gifski under VideoExport.Core
- ILMerge/MSBuild packaging support is part of the build architecture, indicating that some projects are merged or packaged into release-ready assemblies.
10. Build and packaging structure
- The repository uses multiple .sln, .csproj, .shproj, and .projitems files to share code across projects.
- Directory.Build.props, ILMerge.*, and packages.config files show a centralized build setup for shared dependencies.
- Release artifacts are assembled per game, and the README points to CI-built nightly artifacts and per-game release zips.
- The repo therefore has a clear separation between source composition and distribution packaging.
11. Support tooling and auxiliary apps
- Other/KKImageConverter and Other/PackPlugins are standalone tools rather than studio plugins.
- They support the ecosystem by converting image assets and packaging releases/profiles.
- These tools are adjacent to, but architecturally separate from, the runtime plugins.
12. How to draw the diagram
- At the center, place the running game / studio and BepInEx + Harmony as the host boundary.
- Around that, show shared cores feeding multiple game-specific plugin assemblies.
- From the cores, branch to feature families like pose editing, timeline, rendering, accessories, export, and utility.
- Add side inputs for Unity resource bundles, BepInEx config, and UserData.
- Add build/package outputs as per-game DLL sets and release zips produced by CI.
Main entry points: Directory.Build.props Build system · Core.PoseEditor Pose core · Timeline.Core Timeline core · VideoExport.Core Video core
Components 21
Runtime host
Game studio runtime, BepInEx loading, and Harmony patching boundary
- Game studio · Running Illusion title / studio process that hosts plugins
- BepInEx · Loads plugin DLLs and configuration at runtime
- Harmony · Runtime interception layer used by many plugins
Shared cores
Reusable assemblies and cross-game feature cores
- Pose core · Shared pose editor logic, controllers, and modules
Core.PoseEditor - Timeline core · Shared animation/timeline model and interpolation engine
Timeline.Core - UsefulStuff core · Reusable quality-of-life features and studio helpers
UsefulStuff.Core - Video core · Screenshot and video export pipeline with encoders
VideoExport.Core - Node constraints · Constraint and camera-event shared core
NodesConstraints.Core - Colliders debug · Shared colliders debugging logic
CollidersDebug.Core
Game plugins
Per-game plugin frontends and compatibility variants
- HSPE · High-School studio pose editor frontend
HSPE - Other pose builds · HS2PE, KKPE, KKSPE, AIPE per-game pose editor builds
- Timeline builds · Per-game Timeline frontends for HS2, KK, and KKS
- Video builds · Per-game VideoExport frontends for AI, HS2, KK, and KKS
- Utility plugins · Lighting, rendering, accessories, export, and studio QoL plugins
- MoreAccessories · Accessory extension family with per-game variants and patches
MoreAccessories
UI layer
Shared UI utilities used by many plugins
Tools
Standalone support applications
- Pack tools · Standalone tools for asset conversion and release packaging
Other/KKImageConverter
Build & packaging
Shared build setup, merge tasks, and release assembly
- Build system · Shared props, ILMerge task, CI workflow, and release scripts
Directory.Build.props
External deps
Bundled third-party runtime tools and assets
- Bundles & config · Embedded Unity bundles, BepInEx config, and UserData content
- ffmpeg/gifski · Bundled external encoders used by video export
VideoExport.Core/ffmpeg
Connections 29
- Game studio → BepInEx: hosts · Game runtime loads BepInEx plugins
- BepInEx → Harmony: enables · Plugins patch game behavior through Harmony
- BepInEx → Pose core: loads · BepInEx loads shared pose core into the runtime
- BepInEx → Timeline core: loads · Timeline features attach to the runtime through BepInEx
- BepInEx → UsefulStuff core: loads · QoL features are injected as plugins
- BepInEx → Video core: loads · Video export runtime is plugin-driven
- BepInEx → Node constraints: loads · Constraint features run inside the game process
- BepInEx → Colliders debug: loads · Debug tools load as runtime plugins
- ToolBox → Pose core: supports · Shared helpers underpin pose editor implementation
- ToolBox → Timeline core: supports · Common config and translation helpers
- UIUtility → Pose core: ui · Windowing and list widgets used by pose editor
- UIUtility → Timeline core: ui · Shared UI controls for timeline editing
- UIUtility → Utility plugins: ui · Common interaction layer for many frontends
- Pose core → HSPE: frontend · HSPE is the HS-specific wrapper around the shared core
- Pose core → Other pose builds: variants · Shared pose editor core is wrapped for HS2, KK, KKS, and AI
- Timeline core → Timeline builds: variants · Timeline core is packaged for multiple games
- Video core → Video builds: variants · Video export core is wrapped per game
- UsefulStuff core → Utility plugins: powers · Shared QoL feature core feeds studio plugins
- MoreAccessories → Utility plugins: family · Accessory extension family sits beside other utility plugins
- Bundles & config → HSPE: bundles · Plugin-specific Unity bundles and config are loaded at runtime
- Bundles & config → Pose core: bundles · Shared pose editor resources are embedded per game
- Bundles & config → Video core: assets · Runtime uses packaged resources and user content
- ffmpeg/gifski → Video core: encodes · ffmpeg and gifski support export formats
- Build system → HSPE: builds · Centralized props and merge settings produce release DLLs
- Build system → Other pose builds: builds · Shared build setup emits per-game variants
- Build system → Timeline builds: builds · Per-game timeline assemblies are produced from shared sources
- Build system → Video builds: builds · Per-game video export assemblies are packaged
- Build system → Pack tools: packages · CI and packaging utilities assemble release zips
- Pack tools → Build system: consumes · Standalone packer consumes release profiles and archives