# volfin/mcs architecture

> Architecture diagram of the GitHub repository volfin/mcs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/volfin/mcs
- Repository: https://github.com/volfin/mcs

## Overview

##### Project Type and Purpose
- The project’s primary purpose is to power the MCS Avatar system (a character and asset management framework for Unity).
- Its modular structure means it is comprised of several managed .NET projects (MCS_Core, MCS_Importer, MCS_Utilities) and support directories (BuildTools, Scripts, Shaders).
- The README clarifies that the DLLs and resources (scripts, shaders) are aimed at integration within a Unity project, and the build order and dependency chain must be depicted.

##### File Structure
- Top-level projects and directories include:
- BuildTools: Utility for copying and structuring files for the Unity project.
- MCS_Core: The heart of the avatar system containing numerous subdirectories (Character, ContentLibrary, CoreServices, Costuming, Foundations, Item, Utility, and even an experimental section). This part handles the core logic, character models, asset loading, and service management.
- MCS_Importer: Contains code related to importing assets (like textures, models, and dependencies) into the system.
- MCS_Utilities: Provides supporting libraries such as KDTree implementations, morph extraction utilities, and other helper functions.
- Scripts and Shaders: Provide editor scripts, sample codes, shader implementations – crucial for Unity integration.
- There are also configuration or metadata files such as solution files (.sln) and project files (.csproj) which confirm the project’s structure as several inter-dependent assemblies.

##### Components and Their Relationships
- Core Assemblies:
- MCS_Importer: Positioned adjacent to MCS_Core, showing that it depends on the Core’s schema for importing and converting external assets.
- MCS_Utilities: Represent these as supporting modules providing additional algorithms (e.g., KDTree, morph extraction) used by both Core and Importer.
- BuildTools: Acts as a deployment and packaging tool that gathers DLLs and moves them into the proper Unity project locations.
- Unity Integration:
- A separate block should illustrate how compiled DLLs, editor scripts, shaders, and content libraries are deployed into the Unity project (Assets/MCS/Code/Plugins, Assets/MCS/Resources/Shaders, etc.).
- The external dependencies (UnityEngine.dll, UnityEditor.dll) must be mentioned as required references.

##### Architectural Patterns and Design Principles
- Modular Separation: The clear division between Core, Importer, and Utilities supports a modular architecture.
- Layered Architecture: There is a separation between content management (asset loading, character models), business logic (character management, core services), and integration tools (importers, build tools).
- Extensibility: The project structure (especially the experimental area and separate scripting directories) encourages users to extend or modify aspects of the avatar system.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Modules
    MCSUtilMain["MCS_Utilities"]:::utilities
    MCSImporterMain["MCS_Importer"]:::importer
    MCSCoreMain["MCS_Core"]:::core
    BuildToolsMain["BuildTools"]:::buildtools
    ScriptsMain["Scripts"]:::scripts
    ShadersMain["Shaders"]:::shaders
    UnityIntegration["Unity Project (Assets/MCS/Code/Plugins,Assets/MCS/Resources/Shaders)"]:::unity
    UnityDependencies["Unity References (UnityEngine.dll,UnityEditor.dll)"]:::external

    %% Inter-module Dependencies
    MCSUtilMain --> MCSImporterMain
    MCSUtilMain --> MCSCoreMain
    MCSImporterMain --> MCSCoreMain
    UnityDependencies --> MCSCoreMain
    MCSCoreMain --> BuildToolsMain
    BuildToolsMain --> UnityIntegration
    ScriptsMain --> UnityIntegration
    ShadersMain --> UnityIntegration

    %% MCS_Utilities Submodules
    MCSUtilMain -.-> UT_KDTree["KDTree"]:::utilities
    MCSUtilMain -.-> UT_Morph["Morph"]:::utilities
    MCSUtilMain -.-> UT_MorphExtraction["MorphExtraction"]:::utilities

    %% MCS_Importer Submodules
    MCSImporterMain -.-> IMP_AssetManager["AssetManager"]:::importer
    MCSImporterMain -.-> IMP_Importer["Importer"]:::importer

    %% MCS_Core Submodules
    MCSCoreMain -.-> CORE_Character["Character"]:::core
    MCSCoreMain -.-> CORE_ContentLibrary["ContentLibrary"]:::core
    MCSCoreMain -.-> CORE_CoreServices["CoreServices"]:::core
    MCSCoreMain -.-> CORE_Costuming["Costuming"]:::core
    MCSCoreMain -.-> CORE_Foundations["Foundations"]:::core
    MCSCoreMain -.-> CORE_Item["Item"]:::core
    MCSCoreMain -.-> CORE_Utility["Utility"]:::core
    MCSCoreMain -.-> CORE_Experimental["Experimental"]:::core

    %% BuildTools Submodules
    BuildToolsMain -.-> BT_csproj["BuildTools.csproj"]:::buildtools
    BuildToolsMain -.-> BT_Program["Program.cs"]:::buildtools

    %% Scripts Submodules
    ScriptsMain -.-> SCRIPTS_Editor["Editor"]:::scripts
    ScriptsMain -.-> SCRIPTS_AttachmentPoints["AttachmentPoints"]:::scripts
    ScriptsMain -.-> SCRIPTS_Samples["Samples"]:::scripts

    %% Shaders Submodules
    ShadersMain -.-> SHADERS_Hair["Hair"]:::shaders
    ShadersMain -.-> SHADERS_Skin["Skin"]:::shaders
    ShadersMain -.-> SHADERS_Standard["Standard"]:::shaders
    ShadersMain -.-> SHADERS_UniqueShadow["UniqueShadow"]:::shaders

    %% Click Events for MCS_Utilities
    click MCSUtilMain "https://github.com/volfin/mcs/tree/master/MCS_Utilities"
    click UT_KDTree "https://github.com/volfin/mcs/tree/master/MCS_Utilities/KDTree"
    click UT_Morph "https://github.com/volfin/mcs/tree/master/MCS_Utilities/Morph"
    click UT_MorphExtraction "https://github.com/volfin/mcs/tree/master/MCS_Utilities/MorphExtraction"

    %% Click Events for MCS_Importer
    click MCSImporterMain "https://github.com/volfin/mcs/tree/master/MCS_Importer"
    click IMP_AssetManager "https://github.com/volfin/mcs/tree/master/MCS_Importer/AssetManager"
    click IMP_Importer "https://github.com/volfin/mcs/tree/master/MCS_Importer/Importer"

    %% Click Events for MCS_Core
    click MCSCoreMain "https://github.com/volfin/mcs/tree/master/MCS_Core"
    click CORE_Character "https://github.com/volfin/mcs/tree/master/MCS_Core/Character"
    click CORE_ContentLibrary "https://github.com/volfin/mcs/tree/master/MCS_Core/ContentLibrary"
    click CORE_CoreServices "https://github.com/volfin/mcs/tree/master/MCS_Core/CoreServices"
    click CORE_Costuming "https://github.com/volfin/mcs/tree/master/MCS_Core/Costuming"
    click CORE_Foundations "https://github.com/volfin/mcs/tree/master/MCS_Core/Foundations"
    click CORE_Item "https://github.com/volfin/mcs/tree/master/MCS_Core/Item"
    click CORE_Utility "https://github.com/volfin/mcs/tree/master/MCS_Core/Utility"
    click CORE_Experimental "https://github.com/volfin/mcs/tree/master/MCS_Core/_Experimental"

    %% Click Events for BuildTools
    click BuildToolsMain "https://github.com/volfin/mcs/tree/master/BuildTools"
    click BT_csproj "https://github.com/volfin/mcs/blob/master/BuildTools/BuildTools.csproj"
    click BT_Program "https://github.com/volfin/mcs/blob/master/BuildTools/Program.cs"

    %% Click Events for Scripts
    click ScriptsMain "https://github.com/volfin/mcs/tree/master/Scripts"
    click SCRIPTS_Editor "https://github.com/volfin/mcs/tree/master/Scripts/Editor"
    click SCRIPTS_AttachmentPoints "https://github.com/volfin/mcs/tree/master/Scripts/AttachmentPoints"
    click SCRIPTS_Samples "https://github.com/volfin/mcs/tree/master/Scripts/Samples"

    %% Click Events for Shaders
    click ShadersMain "https://github.com/volfin/mcs/tree/master/Shaders"
    click SHADERS_Hair "https://github.com/volfin/mcs/tree/master/Shaders/Hair"
    click SHADERS_Skin "https://github.com/volfin/mcs/tree/master/Shaders/Skin"
    click SHADERS_Standard "https://github.com/volfin/mcs/tree/master/Shaders/Standard"
    click SHADERS_UniqueShadow "https://github.com/volfin/mcs/tree/master/Shaders/UniqueShadow"

    %% Styles
    classDef core fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef importer fill:#F5B7B1,stroke:#CB4335,stroke-width:2px;
    classDef utilities fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef buildtools fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef scripts fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef shaders fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px;
    classDef unity fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#F0F3F4,stroke:#AAB7B8,stroke-width:2px;
```
