# ecsolticia/rayndercast architecture

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

- Interactive diagram: https://gitdiagram.com/ecsolticia/rayndercast
- Repository: https://github.com/ecsolticia/rayndercast

## Overview

##### Project type and purpose
- From the file tree and “# RaynderCast” title, we see this is a C++ raycasting engine/library.
- It exposes core raycasting and rendering functionality (map loading, player movement, ray-casting logic, 2D/3D rendering, HUD overlay), and supplies example/test applications under test_projects.

##### File structure
- Top-level files
– CMakeLists.txt and cmake/…: build configuration and install packaging.
– build_and_install, build_debug: convenience scripts for building in different modes.
- /raynder: public headers (raynder.h, types.h) – this is the API boundary.
- src: implementation split into:
– map.cpp/h: world representation and collision map.
– player.cpp/h: player position, orientation, movement logic.
– raycaster.cpp/h: the core ray-casting algorithm.
– renderer/: 2D/3D rendering code and HUD overlays.
- test_projects: two sample executables demonstrating library integration via their own CMakeLists and simple test.cpp.

##### README for additional insights
- The README is currently minimal, so we rely on folder names to infer architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Layer
    subgraph "Application Layer"
        App1["Test Executable: test_project"]:::application
        App2["Test Executable: test_project_on_system"]:::application
    end

    %% Public API
    subgraph "Public API"
        API1["raynder.h"]:::api
        API2["types.h"]:::api
    end

    %% Library Modules
    subgraph "Library Modules"
        Entrypoint["Main Entry: raynder.cpp"]:::module

        subgraph "Map Module"
            MapImpl["map.cpp"]:::module
            MapHdr["map.h"]:::module
        end

        subgraph "Player Module"
            PlayerImpl["player.cpp"]:::module
            PlayerHdr["player.h"]:::module
        end

        subgraph "RayCaster Module"
            RayImpl["raycaster.cpp"]:::module
            RayHdr["raycaster.h"]:::module
        end

        subgraph "Renderer Module"
            RendererCore["renderer.cpp"]:::module
            RendererHdr["renderer.h"]:::module
            HUD["renderer_hud.cpp"]:::module
        end
    end

    %% Build System
    subgraph "Build System"
        CMakeLists["CMakeLists.txt"]:::build
        Scripts["build_and_install / build_debug"]:::build
        CMakeMods["cmake/RaynderCastConfig.cmake.in"]:::build
    end

    %% External Dependencies
    subgraph "External Dependencies"
        Std["C++ Standard Library"]:::external
        OS["OS Windowing"]:::external
        Graphics["OpenGL/SDL"]:::external
    end

    %% Runtime Flow
    App1 -->|uses API| API1
    App2 -->|uses API| API1
    API1 -->|calls| Entrypoint
    Entrypoint -->|loads| MapImpl
    Entrypoint -->|controls| PlayerImpl
    Entrypoint -->|casts rays| RayImpl
    RayImpl -->|hit data| RendererCore
    RendererCore -->|draws HUD| HUD
    RendererCore -->|renders| Graphics
    HUD -->|overlay| Graphics
    PlayerImpl -->|input from| OS
    App1 -->|windowing| OS
    App2 -->|windowing| OS

    %% Build-time dependencies
    CMakeLists --> API1
    CMakeLists --> Entrypoint
    CMakeLists --> MapImpl
    CMakeLists --> PlayerImpl
    CMakeLists --> RayImpl
    CMakeLists --> RendererCore
    CMakeLists --> Scripts
    CMakeLists --> CMakeMods

    %% Styles
    classDef application fill:#ffe4e1,stroke:#ff7f50;
    classDef api fill:#f0e68c,stroke:#bdb76b;
    classDef module fill:#add8e6,stroke:#1e90ff;
    classDef build fill:#d3d3d3,stroke:#696969;
    classDef external fill:#fafad2,stroke:#ffd700;

    %% Click Events
    click App1 "https://github.com/ecsolticia/rayndercast/blob/main/test_projects/test_project/test.cpp"
    click App2 "https://github.com/ecsolticia/rayndercast/blob/main/test_projects/test_project_on_system/test.cpp"
    click API1 "https://github.com/ecsolticia/rayndercast/blob/main/include/raynder/raynder.h"
    click API2 "https://github.com/ecsolticia/rayndercast/blob/main/include/raynder/types.h"
    click CMakeLists "https://github.com/ecsolticia/rayndercast/blob/main/CMakeLists.txt"
    click Scripts "https://github.com/ecsolticia/rayndercast/tree/main/build_and_install"
    click Scripts "https://github.com/ecsolticia/rayndercast/tree/main/build_debug"
    click CMakeMods "https://github.com/ecsolticia/rayndercast/blob/main/cmake/RaynderCastConfig.cmake.in"
    click MapImpl "https://github.com/ecsolticia/rayndercast/blob/main/src/map.cpp"
    click MapHdr "https://github.com/ecsolticia/rayndercast/blob/main/src/map.h"
    click PlayerImpl "https://github.com/ecsolticia/rayndercast/blob/main/src/player.cpp"
    click PlayerHdr "https://github.com/ecsolticia/rayndercast/blob/main/src/player.h"
    click RayImpl "https://github.com/ecsolticia/rayndercast/blob/main/src/raycaster.cpp"
    click RayHdr "https://github.com/ecsolticia/rayndercast/blob/main/src/raycaster.h"
    click Entrypoint "https://github.com/ecsolticia/rayndercast/blob/main/src/raynder.cpp"
    click RendererCore "https://github.com/ecsolticia/rayndercast/blob/main/src/renderer/renderer.cpp"
    click RendererHdr "https://github.com/ecsolticia/rayndercast/blob/main/src/renderer/renderer.h"
    click HUD "https://github.com/ecsolticia/rayndercast/blob/main/src/renderer/renderer_hud.cpp"
```
