# teamflos/phira architecture

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

- Interactive diagram: https://gitdiagram.com/teamflos/phira
- Repository: https://github.com/teamflos/phira

## Overview

##### Project Type & Purpose
- This is a game project, more specifically a rhythm or music game engine/client.
- It is built in Rust and targets multiple platforms.
- The README indicates that end users can download releases from GitHub and other app stores, while the codebase is organized into several submodules to handle graphics and audio (assets, shaders), localization (“locales”), scene management, particle effects, and multimedia processing.

##### Key Components
a. Game Client (“phira” directory):
- Contains core game loop, UI pages (e.g., login, library, settings, multiplayer), scene management (various scenes like chapter, chart_order, event, song, unlock), and client-side models.
- Holds resource management, animations, and event handling.
b. Monitor & Launcher (“phira-monitor” and “phira-main” directories):
- “phira-monitor” appears to include modules for cloud-related functions and process launching. It likely provides runtime monitoring or debugging support.
- “phira-main” is a simpler binary entry point (with its own main.rs) that perhaps serves as a launch environment or wrapper.
c. Multimedia and Core Libraries (the “prpr” family):
- “prpr-avc”: Handles multimedia codecs, frame processing, and video-related functions (e.g., avformat, codec, swr, sws, shaders). This is likely supporting video or specialized effects within the game.
- “prpr-l10n”: Deals with localization (managing different language files, language identification, and translation-related tools). This spans across many languages structured in the “locales” directories.
- “prpr-pbc”: Appears to be a standalone binary or module (its “main.rs” entry) which might serve as another tool integrated into the solution.
- “prpr”: This module contains core game logic, rendering, parsing (of game-related script files), physics (animations, particles), and UI components.
d. Assets & Locales:
- The “assets” directory includes sound files (.ogg) and other resources, while the “locales” directories inside “phira”, “prpr” and possibly others handle internationalization.
e. Build & Deployment:
- The presence of configuration files (Cargo.toml, Cargo.lock), build scripts (build_wasm.sh), and CI configurations (in .github/workflows) indicates a well-defined build and deployment process.

##### Relationships & Interactions
- The Game Client (Phira) depends on the “prpr” libraries for core functionalities like parsing, shader effects, audio/video handling, and UI components.
- The Monitor and Main components likely interact by launching or supervising the client runtime, or may represent different runtime modes/environments.
- The localization modules (“prpr-l10n” and the many “locales” folders) integrate into the core client to provide language support.
- Assets are consumed by various modules (client rendering, audio playback, and scenes) to deliver game content.
- The multimedia processing parts ("prpr-avc") provide codec and shader functionalities which are fed into the game’s rendering pipeline.

##### Architectural Patterns & Design Principles
- Modular Architecture: Each subproject (phira, phira-monitor, prpr, prpr-avc, etc.) encapsulates a specific domain of functionality.
- Separation of Concerns: For example, the game engine logic is separated from localization, multimedia, and build/deployment aspects.
- Cross-Platform Design: The structure and build scripts suggest proper handling of multiple platforms using Rust’s cargo system.
- Multi-language Support: Extensive locale folders reveal an emphasis on internationalization.
- Use of Build Automation and CI: Presence of GitHub workflow files and a build script for Wasm shows attention to automated testing and deployment pipelines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Deployment Infrastructure
    subgraph "Build & Deployment"
        BD1("Build & Deployment\nInfrastructure"):::infra
    end

    %% Core Libraries
    subgraph "Core Libraries (prpr Family)"
        PPR("Core Game Logic & Rendering (prpr)"):::core
        PPRAVC("Multimedia Processing (prpr-avc)"):::multimedia
        PPRL10N("Localization Library (prpr-l10n)"):::localization
        PPRPBC("Auxiliary Binary (prpr-pbc)"):::aux
    end

    %% Runtime Components
    subgraph "Runtime Components"
        PMON("Monitor Component (Phira-Monitor)"):::monitor
        PMAIN("Launcher Component (Phira-Main)"):::launcher
    end

    %% Game Client
    subgraph "Game Client"
        GC("Game Client (Phira)"):::game
    end

    %% Assets & Resources
    Assets("Assets & Resource Files"):::assets

    %% Relationships
    BD1 -->|"supports"| GC
    BD1 -->|"supports"| PMON
    BD1 -->|"supports"| PMAIN
    BD1 -->|"supports"| PPR
    BD1 -->|"supports"| PPRAVC
    BD1 -->|"supports"| PPRL10N
    BD1 -->|"supports"| PPRPBC

    GC -->|"uses"| PPR
    GC -->|"integrates"| PPRAVC
    GC -->|"localization"| PPRL10N

    PMON -->|"monitors/launches"| GC
    PMAIN -->|"launches"| GC

    Assets -->|"feeds"| GC

    %% Click Events
    click GC "https://github.com/teamflos/phira/tree/main/phira/"
    click PMON "https://github.com/teamflos/phira/tree/main/phira-monitor/"
    click PMAIN "https://github.com/teamflos/phira/tree/main/phira-main/"
    click PPRAVC "https://github.com/teamflos/phira/tree/main/prpr-avc/"
    click PPRL10N "https://github.com/teamflos/phira/tree/main/prpr-l10n/"
    click PPRPBC "https://github.com/teamflos/phira/tree/main/prpr-pbc/"
    click PPR "https://github.com/teamflos/phira/tree/main/prpr/"
    click Assets "https://github.com/teamflos/phira/tree/main/assets/"
    click BD1 "https://github.com/teamflos/phira/tree/main/.github/workflows/"

    %% Styles
    classDef game fill:#f9c,stroke:#333,stroke-width:2px;
    classDef monitor fill:#ccf,stroke:#333,stroke-width:2px;
    classDef launcher fill:#cfc,stroke:#333,stroke-width:2px;
    classDef core fill:#fc9,stroke:#333,stroke-width:2px;
    classDef multimedia fill:#9cf,stroke:#333,stroke-width:2px;
    classDef localization fill:#cff,stroke:#333,stroke-width:2px;
    classDef aux fill:#c9f,stroke:#333,stroke-width:2px;
    classDef assets fill:#ff9,stroke:#333,stroke-width:2px;
    classDef infra fill:#ddd,stroke:#333,stroke-width:2px;
```
