# ozawataiki/rhythmproject architecture

> Architecture diagram of the GitHub repository ozawataiki/rhythmproject, 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/rhythmproject
- Repository: https://github.com/ozawataiki/rhythmproject

## Overview

##### Project Type and Purpose
- This is a native C++ rhythm‐game application built on top of a small in-house engine.
- The “Application” folder contains the game logic, UI, resource definitions (JSON, models, shaders, audio), and a Visual Studio solution.
- The top-level “Engine” folder (not expanded here) holds reusable engine components (framework, rendering, audio, scene factory, particle factory, etc.).
- CI (GitHub Actions) is configured via DebugBuild.yml and ReleaseBuild.yml.

##### File Structure Analysis
- Top Level
- .github/workflows: CI pipelines
- Application: game project (VS solution, resources, source code)
- Engine: core engine code
- Application/Resources
- Data (game rules, beat-maps, animations, UI layouts)
- Primitives, Shader (HLSL), Sounds, fonts, images, models
- Application/Source/Application
- Modular folders per feature: BeatMapEditor, BeatMapLoader, BeatsManager, Core, Effects, FeedBack, GameEnvironment, GameMusic, GameUI, Input, Lane, Note, OptionMenu, PauseMenu, Result, Scene (with subfolders for transitions), Setting, SpectrumRing, TitleCamera/UI
- Application/Source/Essential
- SampleFramework, SceneFactory, ParticleModifierFactory
- Patterns visible
- Command pattern in BeatMapEditor/Command
- Factory pattern in Essential/SceneFactory & ParticleModifierFactory
- Scene-based state management

##### README Insights

a. Main Components
– Engine Subsystems
- Framework & Initialization (SampleFramework)
- Renderer (Direct3D, HLSL shaders)
- Audio System (wave playback, metronome)
- Resource Manager (loads JSON, models, textures, shaders, audio)
- SceneFactory & ParticleModifierFactory (factories for scenes and effects)
– Application Modules
- Scene Manager (Title, Select, Game, Editor, Result scenes + transitions)
- Core Game Loop & GameCore
- BeatMap Loader & BeatsManager (loads map, schedules beats)
- Input Manager (captures key/tap events)
- GameMusic (synchronizes audio playback)
- NotesSystem & Judging (spawn notes, compute hit/miss)
- Effects & Feedback (tap effects, judge text/sound, hold effects, lane/vignette)
- UI Layer (Game UI, Pause Menu, Settings, Result UI, Editor UI)
- BeatMap Editor (UI + command history for creating maps)
b. Relationships & Data Flow
– On startup, SampleFramework initializes Engine (render, audio, resource manager)
– SceneFactory → TitleScene (UI) → user input triggers transitions → GameScene
– GameScene: ResourceManager loads Data/Models/Shaders/Sounds → BeatsManager & GameMusic start
– InputManager feeds tap events → NotesSystem → Judge → Feedback & Effects → Renderer draws frames
– UI Module overlays score, settings, pause menu → user commands via Input → passes to Core/GameScene
– BeatMapEditor scene interacts with command pattern → ResourceManager saves JSON maps
– ResultScene displays summary using ResultData + UI
– Scene transitions controlled by SceneTrans (FSM)
c. Architectural Patterns & Principles
– Layered architecture: Engine layer vs Application layer
– Factory pattern for scenes and particle modifiers
– Command pattern for editor undo/redo
– Single Responsibility: each folder handles one domain (Input, Audio, UI, Effects, Scenes)
– Event-driven flow: Input → GameCore → Effects/Feedback → UI → Renderer
d. Key Technologies & Frameworks
– C++17, Visual Studio C++ project
– Direct3D 11/12 with HLSL shaders
– ImGui (for editor tools; see imgui.ini)
– JSON for Data definitions
– GitHub Actions for CI

##### Essential Details to Capture
– Initialization sequence (main → SampleFramework → initialize render/audio)
– Scene lifecycle and transitions
– Real-time loop: input → logic → audio sync → effects → render → UI
– Resource loading pipeline separate from runtime modules
– Editor as a special scene using command pattern

## Diagram (Mermaid)

```mermaid
graph TD
    %% Engine Layer
    subgraph "Engine Layer"
        direction TB
        SF["SampleFramework"]:::engine
        Renderer["Renderer (Direct3D, HLSL)"]:::engine
        Audio["Audio System"]:::engine
        RM["Resource Manager"]:::engine
        SFty["SceneFactory"]:::engine
        PMF["ParticleModifierFactory"]:::engine
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        APP_MAIN["main.cpp"]:::app

        subgraph "Initialization & Core"
            direction TB
            GC["GameCore (Core Loop)"]:::app
        end

        subgraph "Scenes (FSM)"
            direction TB
            Title["TitleScene"]:::scene
            Select["SelectScene"]:::scene
            Game["GameScene"]:::scene
            Result["ResultScene"]:::scene
            Editor["EditorScene"]:::scene
            Transitions["SceneTrans (FSM)"]:::scene
        end

        subgraph "Game Modules"
            direction TB
            BML["BeatMapLoader"]:::app
            BMD["BeatMapData"]:::data
            BMGR["BeatsManager"]:::app
            IM["Input Manager"]:::app
            IDT["InputData"]:::data
            GM["GameMusic"]:::app
            NS["NotesSystem"]:::app
            subgraph "Judging"
                direction TB
                NJ["NoteJudge"]:::app
                JL["JudgeLine"]:::app
                JR["JudgeResult"]:::app
                JT["JudgeType"]:::app
            end
            Effects["Effects"]:::effect
            Feedback["Feedback"]:::effect
            UI["UI Layer"]:::ui
            EditorTool["BeatMap Editor"]:::ui
        end

        subgraph "Data Resources"
            direction TB
            JSON["JSON/Data"]:::data
            Models["Models"]:::data
            Shaders["Shaders"]:::data
            AudioRes["Audio Files"]:::data
        end
    end

    %% Relationships
    APP_MAIN -->|initializes| SF
    SF -->|init| Renderer
    SF -->|init| Audio
    SF -->|init| RM
    RM -->|provides| BML
    RM -->|provides| BMGR
    RM -->|loads| JSON
    RM -->|loads| Models
    RM -->|loads| Shaders
    RM -->|loads| AudioRes

    APP_MAIN -->|starts| GC
    GC -->|uses| SFty
    GC -->|uses| PMF

    SFty -->|creates| Title
    SFty -->|creates| Select
    SFty -->|creates| Game
    SFty -->|creates| Result
    SFty -->|creates| Editor

    Title -->|on input| Transitions
    Select -->|on input| Transitions
    Game -->|on input| Transitions
    Editor -->|on input| Transitions
    Transitions -->|to scenes| Title

    Game -->|loads| BML
    BML -->|reads| BMD
    Game -->|starts| BMGR
    Game -->|starts| GM
    Game -->|uses| IM
    IM -->|feeds events| NS
    NS -->|spawns| NotesSystem
    NS -->|calls| NJ
    NJ -->|evaluates| JR
    JR -->|outputs| Feedback
    Feedback -->|renders| Renderer
    Effects -->|renders| Renderer
    UI -->|overlays| Renderer
    EditorTool -->|uses| RM
    EditorTool -->|uses| PMF

    %% Click Events
    click SF "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Essential/SampleFramework.cpp"
    click SFty "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Essential/SceneFactory.cpp"
    click PMF "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Essential/ParticleModifierFactory.cpp"
    click GC "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Core/GameCore.cpp"
    click BML "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/BeatMapLoader/BeatMapLoader.cpp"
    click BMD "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/BeatMapLoader/BeatMapData.h"
    click BMGR "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/BeatsManager/BeatManager.cpp"
    click IM "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Input/GameInputManager.cpp"
    click IDT "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Input/InputData.h"
    click GM "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/GameMusic/GameMusic.cpp"
    click NS "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Note/NotesSystem.cpp"
    click NJ "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Note/Judge/NoteJudge.cpp"
    click JL "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Note/Judge/JudgeLine.cpp"
    click JR "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Note/Judge/JudgeResult.cpp"
    click JT "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/Note/Judge/JudgeType.cpp"
    click Effects "https://github.com/ozawataiki/rhythmproject/tree/master/Application/Source/Application/Effects"
    click Feedback "https://github.com/ozawataiki/rhythmproject/tree/master/Application/Source/Application/FeedBack"
    click UI "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/GameUI/GameUI.cpp"
    click EditorTool "https://github.com/ozawataiki/rhythmproject/blob/master/Application/Source/Application/BeatMapEditor/BeatMapEditor.cpp"
    click APP_MAIN "https://github.com/ozawataiki/rhythmproject/blob/master/Application/main.cpp"

    %% Styles
    classDef engine fill:#add8e6,stroke:#000,stroke-width:1px
    classDef app fill:#98fb98,stroke:#000,stroke-width:1px
    classDef ui fill:#ffa500,stroke:#000,stroke-width:1px
    classDef effect fill:#ffa500,stroke:#000,stroke-width:1px
    classDef scene fill:#ffdead,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
    classDef data fill:#d3d3d3,stroke:#000,stroke-width:1px,shape:cylinder
```
