# akazdayo/musicarcade2 architecture

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

- Interactive diagram: https://gitdiagram.com/akazdayo/musicarcade2
- Repository: https://github.com/akazdayo/musicarcade2

## Overview

Key Components to Include in the System Design:

##### Core Game Architecture
- Main game states (MusicState and PlayState)
- Core game components (Notes, Judge, KeyMap)
- LoadMusic component to show music data handling

##### Platform-Specific Layers
- Create two separate deployment targets:
a. HTML5 Build (Web Platform)
b. Desktop Build (Electron wrapper)
- How the core game interfaces with each platform

##### Asset Management System
- Separation between:
- Music data (JSON files)
- Chart data (CSV files)
- Image assets

##### Server Component
- Python server component
- How it interfaces with the main game for URL-based chart loading

##### Use a Layered Architecture Approach
Top Layer: User Interface (Platform-specific)
Middle Layer: Game Core (Haxe Flixel Components)
Bottom Layer: Asset Management and Server

##### Component Relationships

Specific Elements to Include:

##### Core Game Components
**Main.hx → MusicState.hx → PlayState.hx**
- ↓
**Notes.hx ← Judge.hx**
- ↓
**KeyMap.hx**

##### Asset Flow
**assets/data/charts ←→ LoadMusic.hx**
**assets/images ←→ Judge.hx**
**music/*.json ←→ LoadMusic.hx**

##### Platform Deployment
**Haxe Flixel Core**
- ↙         ↘
**HTML5 Build   Desktop Build (Electron)**

##### Server Integration
**Python Server (main.py)**
- ↕
**URL-based Chart Loading**
- ↕
**Game Core**

##### Build process flow
- Lime build system
- Desktop packaging with Electron
##### Entry points
- Web entry
- Desktop entry (main.js)
- Server entry (main.py)

Level of Detail:

- Keep high-level components visible but include subcomponents where critical
- Major data flows but avoid cluttering with implementation details
- Technology stack labels:
- Haxe Flixel
- Electron
- Python
- Asset formats (JSON, CSV)

- Clear component hierarchy
- Multiple relationship types
- Export to high-resolution formats

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Platform
        Web["HTML5 Build"]
        Desktop["Desktop Build"]:::desktop
        click Desktop "https://github.com/akazdayo/MusicArcade2/blob/main/desktop/main.js"
    end

    subgraph "Game Core"
        Main["Main Game Entry"]:::core
        click Main "https://github.com/akazdayo/MusicArcade2/blob/main/source/Main.hx"
        
        MusicState["Music State"]:::core
        click MusicState "https://github.com/akazdayo/MusicArcade2/blob/main/source/MusicState.hx"
        
        PlayState["Play State"]:::core
        click PlayState "https://github.com/akazdayo/MusicArcade2/blob/main/source/PlayState.hx"
        
        Notes["Notes System"]:::core
        click Notes "https://github.com/akazdayo/MusicArcade2/blob/main/source/Notes.hx"
        
        Judge["Judge System"]:::core
        click Judge "https://github.com/akazdayo/MusicArcade2/blob/main/source/Judge.hx"
        
        KeyMap["Key Mapping"]:::core
        click KeyMap "https://github.com/akazdayo/MusicArcade2/blob/main/source/KeyMap.hx"
        
        LoadMusic["Music Loader"]:::core
        click LoadMusic "https://github.com/akazdayo/MusicArcade2/blob/main/source/LoadMusic.hx"
        
        AssetPaths["Asset Paths Manager"]:::core
        click AssetPaths "https://github.com/akazdayo/MusicArcade2/blob/main/source/AssetPaths.hx"
    end

    subgraph "Asset Management"
        Charts["Chart Data"]:::asset
        click Charts "https://github.com/akazdayo/MusicArcade2/tree/main/assets/data/charts"
        
        JudgeImages["Judge Images"]:::asset
        click JudgeImages "https://github.com/akazdayo/MusicArcade2/tree/main/assets/images/judge"
        
        MusicData["Music Data"]:::asset
        click MusicData "https://github.com/akazdayo/MusicArcade2/tree/main/music"
    end

    subgraph "Server Layer"
        PyServer["Python Server"]:::server
        click PyServer "https://github.com/akazdayo/MusicArcade2/blob/main/server/src/main.py"
    end

    ProjectConfig["Project Configuration"]:::config
    click ProjectConfig "https://github.com/akazdayo/MusicArcade2/blob/main/Project.xml"

    %% Relationships
    Main --> MusicState
    MusicState --> PlayState
    PlayState --> Notes
    PlayState --> Judge
    PlayState --> KeyMap
    PlayState --> LoadMusic
    LoadMusic --> AssetPaths
    AssetPaths --> Charts
    AssetPaths --> JudgeImages
    AssetPaths --> MusicData
    
    PyServer -.-> LoadMusic
    
    Main --> Web
    Main --> Desktop
    
    ProjectConfig --> Main

    %% Styles
    classDef core fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef asset fill:#f9d79b,stroke:#333,stroke-width:2px
    classDef server fill:#c39bd3,stroke:#333,stroke-width:2px
    classDef desktop fill:#7dcea0,stroke:#333,stroke-width:2px
    classDef config fill:#aeb6bf,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        AssetComp["Asset Component"]:::asset
        ServerComp["Server Component"]:::server
        DesktopComp["Desktop Component"]:::desktop
        ConfigComp["Configuration"]:::config
    end
```
