# xeeynamo/sotn-decomp architecture

> Architecture diagram of the GitHub repository xeeynamo/sotn-decomp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xeeynamo/sotn-decomp
- Repository: https://github.com/xeeynamo/sotn-decomp

## Overview

##### Main Components Overview
The system should be divided into these major components:

a) Core Engine Components:
- Main Game Engine (DRA.BIN)
- Platform-specific Implementations (PSX, PSP, Saturn)
- Asset Management System
- Memory Management

b) Game Systems:
- Stage/Level Management
- Entity System
- Weapon System
- Familiar System
- Player Systems (Alucard/Richter)
- Boss Systems
- Collision System

**[PSX Implementation] [PSP Implementation] [Saturn Implementation]**

**[Asset Manager] [Memory Manager] [Input Handler]**
**[Sound Engine] [Rendering Engine] [CD System]**

**[Stage Manager] [Entity System] [Collision System]**
**[Player Controller] [Weapon System] [Familiar System]**

##### Specific Implementation Details

Subsystems based on the file structure:
**Stage System:**
**[Stage Manager] --> [Individual Stage Implementations]**
- (NO0.BIN, NO1.BIN, etc.)

**Familiar System:**
**[Familiar Manager] --> [Individual Familiar Types]**
- (TT_000.BIN, TT_001.BIN, etc.)

**Weapon System:**
**[Weapon Manager] --> [Individual Weapon Implementations]**
- (WEAPON0.BIN, etc.)

##### Development Tools Integration

Debug/development tools connection:
**[Debug Module] --> [Core Engine]**
**[Asset Tools] --> [Asset Manager]**
**[Build System] --> [All Components]**

##### Important Notes

- Modular nature of the stage system
- Clear separation between platform-specific and shared code
- Asset pipeline and build system integration
- Version-specific differences (US/JP/EU)
- Debug/development tool integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform Layer
    subgraph PlatformLayer["Platform Implementations"]
        PSX["PSX Implementation"]
        PC["PC Implementation"]
        Saturn["Saturn Implementation"]
    end

    %% Core Engine Layer
    subgraph CoreLayer["Core Engine Components"]
        MainEngine["Main Game Engine"]:::core
        AssetMgr["Asset Manager"]:::core
        MemMgr["Memory Manager"]:::core
        SoundEngine["Sound Engine"]:::core
        RenderEngine["Rendering Engine"]:::core
        CDSystem["CD System"]:::core
    end

    %% Game Systems Layer
    subgraph GameLayer["Game Systems"]
        StageSystem["Stage System"]:::game
        EntitySystem["Entity System"]:::game
        WeaponSystem["Weapon System"]:::game
        FamiliarSystem["Familiar System"]:::game
        BossSystem["Boss System"]:::game
        CollisionSystem["Collision System"]:::game
    end

    %% Development Tools
    subgraph DevTools["Development Tools"]
        DebugModule["Debug Module"]:::debug
        AssetTools["Asset Tools"]:::debug
        BuildSystem["Build System"]:::debug
    end

    %% Relationships
    PlatformLayer --> CoreLayer
    CoreLayer --> GameLayer
    
    AssetTools --> AssetMgr
    DebugModule --> MainEngine
    BuildSystem --> CoreLayer
    
    MainEngine --> StageSystem
    MainEngine --> EntitySystem
    MainEngine --> CollisionSystem
    
    EntitySystem --> WeaponSystem
    EntitySystem --> FamiliarSystem
    EntitySystem --> BossSystem
    
    %% Component Mappings
    click MainEngine "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/dra/"
    click PSX "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/main/psxsdk/"
    click PC "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/pc/"
    click Saturn "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/saturn/"
    click StageSystem "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/st/"
    click WeaponSystem "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/weapon/"
    click FamiliarSystem "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/servant/"
    click BossSystem "https://github.com/Xeeynamo/sotn-decomp/tree/master/src/boss/"
    click EntitySystem "https://github.com/Xeeynamo/sotn-decomp/blob/master/include/entity.h"
    click AssetTools "https://github.com/Xeeynamo/sotn-decomp/tree/master/tools/sotn-assets/"
    click MemMgr "https://github.com/Xeeynamo/sotn-decomp/blob/master/include/common.h"
    click CollisionSystem "https://github.com/Xeeynamo/sotn-decomp/blob/master/include/common.h"
    click DebugModule "https://github.com/Xeeynamo/sotn-decomp/tree/master/tools/sotn-debugmodule/"

    %% Styling
    classDef core fill:#3498db
    classDef platform fill:#2ecc71
    classDef game fill:#f1c40f
    classDef debug fill:#9b59b6
    
    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        PlatformComp["Platform Component"]:::platform
        GameComp["Game Component"]:::game
        DebugComp["Debug Tool"]:::debug
    end
```
