How rwmoddingch/randombuff works
Project Type and Purpose
• This is a Unity-based game mod (Random Buff) composed of multiple C# class-library projects that are injected into the host game via a mod-loader (Harmony patches). Its goal is to add roguelike-style “buff” cards, menus, quests and UI to the game.
• The solution also includes auxiliary modules (BombExpand, BuildInBuff, ExpeditionExtend, LobotomyCorporationPack) each implementing sets of buffs and missions, plus a WinForms tool (MultiLayerHelper) for generating code or configuration.
File‐Structure Analysis
Top‐level projects and folders:
• RandomBuff.sln – main solution
• RandomBuff/RandomBuff.csproj – core mod plugin
• RandomBuffUtils/RandomBuffUtils.csproj – utility library used by core and modules
• BombExpand, BuildInBuff, ExpeditionExtend, LobotomyCorporationPack – extension-module projects, each exposing new Buff classes and mission hooks
• MultiLayerHelper – WinForms app for generating code or configuration artifacts
• buffinfos – JSON metadata (buff definitions, quests, templates) read by the mod at startup
• – SDKConfig.json and publicized assemblies listing for hooking
• tools – Lua/batch scripts to automate code/data generation
README Insights
• Points to template repo, API docs and Wiki for details on adding new buffs
A. Main Components
1. Host Game Engine (Unity)
2. Mod Loader / Harmony Patch Engine
3. RandomBuff Core Plugin
– Entry point (BuffEntry)
– Buff registration (BuffRegister, BuffBuilder)
– Hook orchestrator (CoreHooks, InGameCoreHooks)
4. RandomBuffUtils Library
– Helpers for scene hooking, asset loading, particle systems, game‐object extension
5. Extension Modules
– BombExpand
– BuildInBuff
– ExpeditionExtend
– LobotomyCorporationPack
(Each module contains C# “Buff” classes and Mission hooks)
6. Data Stores
– buffinfos JSON files (buff definitions, quest configs, templates)
7. UI Subsystems
– BuffMenu (in‐game menu pages)
– Cardpedia (information browser)
– HUD (BuffHud, NotificationManager)
8. Tools
– MultiLayerHelper (WinForms app reading SDKConfig.json & publicized assemblies to generate stubs)
– Lua scripts / generate.bat for scaffolding
B. Relationships and Data Flows
• At game launch, the Mod Loader injects RandomBuff Core via Harmony.
• RandomBuffCore reads SDKConfig.json and publicized assemblies list (include/) to know which modules to load.
• Core plugin loads each module assembly (BombExpand.dll, BuildInBuff.dll, etc.).
• Core reads buffinfos/*.json and buffassets asset bundles to populate BuffStaticData.
• Modules register their Buff classes and Mission hooks via BuffRegister/MissionRegister.
• Core builds all Buff objects (BuffBuilder) and registers timers, events, UI hooks.
• UI Subsystems (BuffMenu, Cardpedia, HUD) subscribe to Core’s events to render menus/cards.
C. Architectural Patterns & Principles
• Plugin‐based modular architecture: core + extension assemblies
• Event‐driven / observer pattern for in‐game hooks
• Factory/Builder pattern for Buff object creation
• Separation of concerns: Core logic vs. UI rendering vs. Data loading vs. Module implementations
• Utility library (RandomBuffUtils) for cross‐cutting concerns (asset loading, patch helpers)
D. Key Technologies & Frameworks
• C# / .NET (class libraries, WinForms)
• Unity AssetBundle system (buffassets)
• JSON configuration files (buffinfos)
• Harmony (runtime method‐patching, include/publicized_assemblies)
• Lua & batch scripts for code/data generation