# gatitodev/fnf-healthengine architecture

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

- Interactive diagram: https://gitdiagram.com/gatitodev/fnf-healthengine
- Repository: https://github.com/gatitodev/fnf-healthengine

## Overview

##### Overall project purpose and type
- This is a full game engine, meant for modding an existing rhythm game (Friday Night Funkin'). It provides the source code (in the “source” folder), assets (art, assets, songs, fonts, etc.), and build scripts to compile the game.
- The engine integrates with HaxeFlixel and several libraries (flixel-addons, flixel-ui, hscript, newgrounds, polymod, discord_rpc). The README gives installation and build instructions, hinting that the codebase is modular and geared toward extensibility for mod developers.

##### Key architectural components
- Engine Core: Represented by the “source” directory that includes various Haxe classes (e.g., Main.hx, PlayState.hx, MainMenuState.hx, OptionsMenu.hx). These components handle game state transitions, player input, rendering, audio, and game logic.
- Asset Management: The “assets” directory holds subdirectories for art, fonts, music, songs, and preloading data. It’s central for loading and managing the visual and audio resources.
- Build & Deployment: The project’s build scripts (in the “art” folder as batch files) and configuration files (e.g., Project.xml, hxformat.json) point to a build system that compiles the engine (using Lime and HaxeFlixel targeting Windows, HTML5, etc.).
- External Integrations: Note the use of Discord RPC, Newgrounds integration, and Git-based haxelib installations. This shows connectivity to online services and version control for enhancements or features.

##### Relationships and interactions between components
- “Engine Core” with “Asset Manager”, which feeds in assets (images, sounds, fonts, preloaded data) required by various states.
- A “Mod Loader” or “Modding Interface” component that shows how modded game content (from “example_mods” and mod files) is integrated into the core engine.
- “Build & Deployment” as a separate layer where build scripts (lime commands, project configurations) trigger the compilation and packaging of the entire system.

##### Architectural patterns and design principles
- Separation of concerns: The clear division between game logic (in source files), asset management (in the assets directory), and mod integration.
- Modular design: The source code is split across many components and game states, which suggests a state machine and component-based approach.
- Extensibility: Through mod files and integration with tools like Polymod, the design supports easy insertion of new content.
- Dependency management: The use of haxelib and external libraries represents an external dependency injection style common in HaxeFlixel projects.

- At the bottom, you have the build environment and external libraries.
- The middle layer is the engine’s core game logic and modules (represented by numerous source files).
- The top layer concerns assets and modding capabilities which feed into the engine.
- Overlay or side sections can illustrate external integration points (such as Discord or Newgrounds) and the deployment/build process.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Asset and Modding Layer"
        A("Asset Manager"):::asset
        M1("Modding Docs"):::mod
        M2("Example Mods"):::mod
    end

    subgraph "Core Engine"
        EC("Engine Core"):::core
    end

    subgraph "Deployment and External Layer"
        B1("Project Config"):::build
        B2("Build Scripts"):::build
        E1("Discord Integration"):::external
        E2("Newgrounds Integration"):::external
    end

    A -->|"loads"| EC
    M1 -->|"injects"| EC
    M2 -->|"injects"| EC
    B1 -->|"builds"| EC
    B2 -->|"builds"| EC
    E1 -->|"integrates"| EC
    E2 -->|"integrates"| EC

    click EC "https://github.com/gatitodev/fnf-healthengine/tree/master/source"
    click A "https://github.com/gatitodev/fnf-healthengine/tree/master/assets"
    click M1 "https://github.com/gatitodev/fnf-healthengine/blob/master/Modding.md"
    click M2 "https://github.com/gatitodev/fnf-healthengine/tree/master/example_mods"
    click B1 "https://github.com/gatitodev/fnf-healthengine/blob/master/Project.xml"
    click B2 "https://github.com/gatitodev/fnf-healthengine/blob/master/art/build-Itch-WINDOWS.bat"
    click E1 "https://github.com/gatitodev/fnf-healthengine/blob/master/source/Discord.hx"
    click E2 "https://github.com/gatitodev/fnf-healthengine/blob/master/source/NGio.hx"

    classDef core fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef asset fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef mod fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef build fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef external fill:#ffccff,stroke:#cc00cc,stroke-width:2px;
```
