# ozawataiki/gameengine architecture

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

- Interactive diagram: https://gitdiagram.com/ozawataiki/gameengine
- Repository: https://github.com/ozawataiki/gameengine

## Overview

##### Project Type and Purpose
- This is a native C++ DirectX-based Game Engine with an accompanying Sample application and Python-based level‐editor tools.
- It exposes a modular engine core (windowing, rendering, debug), cross‐platform subsystems (audio, input, timing, math, utilities), a feature layer (collision, model, lighting, post-effects, UI, etc.), external libraries (Assimp, DirectXTex, ImGui, stb, nlohmann::json), and resource assets (shaders, models, textures, sounds).

##### File Structure Analysis
Top-level modules:
- Engine/Core: low-level DXCommon (device/PSO/SRV/RTV managers), WinApp (window/message loop)
- Engine/System: OS/event subsystems (Audio, Input, Time)
- Engine/Framework: application framework, batch renderer, layer system
- Engine/Features: domain features (Animation, Camera, Collision, Effect, Event, Json, Light, Model, PostEffects, Scene, Sprite, TextRenderer, UI, UVTransform, WaveformDisplay)
- Engine/Math: linear algebra, random, easing curves
- Engine/Utility: string/file-dialog helpers
- Engine/Debug: ImGui integration, leak checker, helpers
- Engine/Externals: 3rd-party libs and their build artifacts
- Engine/Resources: HLSL shaders and asset pipelines
- Sample: a demo project consuming Engine as a library
- Tool/level_editor: Python scripts for scene export and collider handling

##### README Insights
- Build badges only; no direct architecture description.
- Reliance on GitHub Actions for Debug/Release builds suggests CI/CD integration but does not change runtime architecture.

##### Final Recommendations
- Be granular: break each feature group into its major subcomponents (e.g., CollisionManager, ParticleEmitter, SceneManager).
- Confirm with the code owners that any newly exposed subsystems (e.g., UVTransformAnimation, WaveformDisplay) are represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core & System (Blue)
    subgraph "Core & System"
        direction TB
        A["Application Entry\n(main.cpp)"]:::core
        B["Windowing & OS Loop\n(WinApp)"]:::core
        C["Rendering Core\n(DXCommon)"]:::core
        D["Audio System"]:::core
        E["Input System"]:::core
        F["Time System"]:::core
    end

    %% Framework (Blue)
    subgraph "Framework"
        direction TB
        G["Application Framework"]:::core
        H["Batch2D Renderer"]:::core
        I["Layer System"]:::core
    end

    %% Features (Green)
    subgraph "Feature Modules"
        direction TB
        J["Scene Manager"]:::feature
        K["Animation"]:::feature
        L["Collision"]:::feature
        M["Model Loader & Renderer"]:::feature
        N["Lighting System"]:::feature
        O["Particle & Effects"]:::feature
        P["UI Module"]:::feature
        Q["Post-Processing"]:::feature
        R["Sprite Renderer"]:::feature
        S["Text Renderer"]:::feature
        T["UV Transform & Animation"]:::feature
        U["Waveform Display"]:::feature
        V["Audio Spectrum"]:::feature
        W["Event Manager"]:::feature
        X["JSON Binder & Loader"]:::feature
    end

    %% Resources & Externals (Orange)
    subgraph "Resources & Externals"
        direction TB
        Y["HLSL Shaders"]:::external
        Z["Assimp Model Import"]:::external
        AA["DirectXTex Texture"]:::external
        AB["stb_truetype"]:::external
        AC["nlohmann::json"]:::external
    end

    %% Debug & Tools (Gray)
    subgraph "Debug & Editor Tools"
        direction TB
        AD["ImGui Debug Layer"]:::debug
        AE["Leak Checker"]:::debug
        AF["Python Level Editor Tools"]:::tools
    end

    %% Sample Application (Gray)
    subgraph "Sample Application"
        direction TB
        AG["Sample App Entry"]:::tools
        AH["Sample Framework"]:::tools
        AI["Sample Scene & Factories"]:::tools
    end

    %% Initialization Flow
    A --> B
    B --> G
    G --> I

    %% Game Loop Phases
    subgraph "Game Loop"
        direction TB
        E --> W
        F --> W
        W -->|"update"| J
        W -->|"update"| K
        W -->|"update"| L
        W -->|"update"| M
        W -->|"update"| N
        W -->|"update"| O
        W -->|"update"| P
        W -->|"update"| Q
        W -->|"update"| R
        W -->|"update"| S
        W -->|"update"| T
        W -->|"update"| U
        W -->|"update"| V
        W -->|"update"| X
        W -->|"update"| AF
        W --> G
    end

    %% Rendering Pipeline
    subgraph "Rendering Pipeline"
        direction TB
        M --> H
        N --> H
        O --> H
        P --> H
        R --> H
        S --> H
        H --> C
        C -->|"Command Lists"| GPU["GPU"]:::external
    end

    %% Resource Loading
    X --> M
    X --> P
    X --> S
    X --> J
    Z --> M
    AA --> M
    Y --> C

    %% Audio Flow
    D -->|"plays via XAudio2"| AF
    AF -->|"audio spectrum data"| V

    %% Debug & Tools Integration
    AD --> C
    AD --> H
    AE --> C
    AF --> X

    %% Sample & Tools Usage
    AG --> G
    AG --> J
    AF --> X

    %% External Libraries Dependencies
    Z --> C
    AA --> C
    AC --> X
    AB --> S

    %% Click Events
    click A "https://github.com/ozawataiki/gameengine/blob/master/Engine/main.cpp"
    click B "https://github.com/ozawataiki/gameengine/blob/master/Engine/Core/WinApp/WinApp.cpp"
    click C "https://github.com/ozawataiki/gameengine/blob/master/Engine/Core/DXCommon/DXCommon.cpp"
    click D "https://github.com/ozawataiki/gameengine/blob/master/Engine/System/Audio/AudioSystem.cpp"
    click E "https://github.com/ozawataiki/gameengine/blob/master/Engine/System/Input/Input.cpp"
    click F "https://github.com/ozawataiki/gameengine/blob/master/Engine/System/Time/GameTime.cpp"
    click G "https://github.com/ozawataiki/gameengine/blob/master/Engine/Framework/Framework.cpp"
    click H "https://github.com/ozawataiki/gameengine/blob/master/Engine/Framework/Batch2DRenderer.cpp"
    click I "https://github.com/ozawataiki/gameengine/blob/master/Engine/Framework/LayerSystem/LayerSystem.cpp"
    click J "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Scene/Manager/SceneManager.cpp"
    click K "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Animation/Sequence/AnimationSequence.cpp"
    click L "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Collision/Manager/CollisionManager.cpp"
    click M "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Model/Manager/ModelManager.cpp"
    click N "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Light/System/LightingSystem.cpp"
    click O "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Effect/Emitter/Emitter.cpp"
    click P "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/UI/UIBase.cpp"
    click Q "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/PostEffects/PostEffects.cpp"
    click R "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Sprite/Sprite.cpp"
    click S "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/TextRenderer/TextRenderer.cpp"
    click T "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/UVTransform/UVTransform.cpp"
    click U "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/WaveformDisplay/WaveformDisplay.cpp"
    click V "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/AudioSpectrum/AudioSpectrum.cpp"
    click W "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Event/EventManager.cpp"
    click X "https://github.com/ozawataiki/gameengine/blob/master/Engine/Features/Json/JsonBinder.cpp"
    click Y "https://github.com/ozawataiki/gameengine/blob/master/Engine/Resources/Shader/example.hlsl"
    click Z "https://github.com/ozawataiki/gameengine/tree/master/Engine/Externals/assimp/include"
    click AA "https://github.com/ozawataiki/gameengine/blob/master/Engine/Externals/DirectXTex/DirectXTex.cpp"
    click AB "https://github.com/ozawataiki/gameengine/blob/master/Engine/Externals/stb/stb_truetype.h"
    click AC "https://github.com/ozawataiki/gameengine/blob/master/Engine/Externals/nlohmann/json.hpp"
    click AD "https://github.com/ozawataiki/gameengine/blob/master/Engine/Debug/ImGuiManager.cpp"
    click AE "https://github.com/ozawataiki/gameengine/blob/master/Engine/Core/DXCommon/LeakChecker/D3DResourceLeakChecker.cpp"
    click AF "https://github.com/ozawataiki/gameengine/blob/master/Tool/level_editor/export_scene.py"
    click AG "https://github.com/ozawataiki/gameengine/blob/master/Sample/main.cpp"
    click AH "https://github.com/ozawataiki/gameengine/blob/master/Sample/SampleFramework.cpp"
    click AI "https://github.com/ozawataiki/gameengine/blob/master/Sample/SceneFactory.cpp"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085
    classDef feature fill:#d4edda,stroke:#155724,color:#155724
    classDef external fill:#ffeeba,stroke:#856404,color:#856404
    classDef debug fill:#f8f9fa,stroke:#6c757d,color:#6c757d
    classDef tools fill:#e2e3e5,stroke:#818182,color:#818182
```
