# travisvroman/kohi architecture

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

- Interactive diagram: https://gitdiagram.com/travisvroman/kohi
- Repository: https://github.com/travisvroman/kohi

## Overview

##### Project Type and Purpose
- The project is a game engine built from scratch using C with Vulkan for rendering. It also supports plugins (for audio using OpenAL, standard UI, etc.) and is structured as a modular engine with multiple shared libraries.
- The README makes it clear that this engine is both a learning resource (with tutorial and live stream aspects) and a basis for game development. The engine is built around clear separation between the core functionalities and plugin extensions.

##### Analyzing the File Structure
- There are several top-level directories each representing a component of the engine:
- kohi.core: Contains low-level, shared functionalities such as math libraries, containers, string utilities, memory management, and the platform layer.
- kohi.runtime: Contains the core engine logic and systems (renderer, audio, input, asset handling, scene management, etc.).
- Plugins (subdirectories starting with “kohi.plugin.”):
▪ kohi.plugin.audio.openal – the audio backend using OpenAL.
▪ kohi.plugin.renderer.vulkan – the Vulkan-based renderer plugin.
▪ kohi.plugin.ui.standard – the retained-mode UI plugin with controls.
▪ kohi.plugin.utils – utility plugin components.
- Application and Testbed Components:
▪ testbed.kapp – The main application consuming the engine, configuring plugins and libraries.
▪ testbed.klib – Contains game-specific functionalities and code (hot reloadable).
▪ Additional test components under kohi.core.tests.
- Tools:
▪ kohi.tools.versiongen and kohi.tools – command-line and utility tools used by the engine (e.g., version generation).
- Build and configuration scripts (Makefiles, build scripts for Windows/Linux/macOS) and configuration files give cues about the build environments and dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "Core Layer"
        core["kohi.core"]:::library
        tests["kohi.core.tests"]:::test
    end

    %% Engine Layer
    subgraph "Engine Layer"
        runtime["kohi.runtime"]:::library
    end

    %% Plugin Layer
    subgraph "Plugin Layer"
        audio["kohi.plugin.audio.openal"]:::plugin
        renderer["kohi.plugin.renderer.vulkan"]:::plugin
        ui["kohi.plugin.ui.standard"]:::plugin
        utils["kohi.plugin.utils"]:::plugin
    end

    %% Application Layer
    subgraph "Application Layer"
        testbed["testbed.kapp (Application)"]:::application
        game["testbed.klib (Game Code)"]:::application
    end

    %% Tools
    subgraph "Tools"
        versiongen["kohi.tools.versiongen"]:::tool
        tools["kohi.tools"]:::tool
    end

    %% Relationships
    runtime -->|"depends_on"| core
    tests -->|"tests"| core

    audio -->|"plugs_into"| runtime
    renderer -->|"plugs_into"| runtime
    ui -->|"plugs_into"| runtime
    utils -->|"plugs_into"| runtime

    testbed -->|"depends_on"| runtime
    testbed -->|"integrates"| game

    versiongen -->|"builds"| core
    versiongen -->|"builds"| runtime
    versiongen -->|"builds"| audio
    versiongen -->|"builds"| renderer
    versiongen -->|"builds"| ui
    versiongen -->|"builds"| utils

    tools -->|"assists"| runtime

    %% Styles
    classDef library fill:#f9c,stroke:#333,stroke-width:2px;
    classDef plugin fill:#9f6,stroke:#333,stroke-width:2px;
    classDef application fill:#fc6,stroke:#333,stroke-width:2px;
    classDef tool fill:#6cf,stroke:#333,stroke-width:2px;
    classDef test fill:#f66,stroke:#333,stroke-width:2px;

    %% Click Events
    click core "https://github.com/travisvroman/kohi/tree/main/kohi.core/"
    click tests "https://github.com/travisvroman/kohi/tree/main/kohi.core.tests/"
    click runtime "https://github.com/travisvroman/kohi/tree/main/kohi.runtime/"
    click audio "https://github.com/travisvroman/kohi/tree/main/kohi.plugin.audio.openal/"
    click renderer "https://github.com/travisvroman/kohi/tree/main/kohi.plugin.renderer.vulkan/"
    click ui "https://github.com/travisvroman/kohi/tree/main/kohi.plugin.ui.standard/"
    click utils "https://github.com/travisvroman/kohi/tree/main/kohi.plugin.utils/"
    click testbed "https://github.com/travisvroman/kohi/tree/main/testbed.kapp/"
    click game "https://github.com/travisvroman/kohi/tree/main/testbed.klib/"
    click versiongen "https://github.com/travisvroman/kohi/tree/main/kohi.tools.versiongen/"
    click tools "https://github.com/travisvroman/kohi/tree/main/kohi.tools/"
```
