# addisions/raycaster architecture

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

- Interactive diagram: https://gitdiagram.com/addisions/raycaster
- Repository: https://github.com/addisions/raycaster

## Overview

##### Project type and purpose
- This is a standalone, native desktop application written in C99: a minimalist 2.5D raycasting rendering engine inspired by early FPS games.

##### File structure
- Top-level files:
- raycaster.c – single C source containing initialization, input handling, game loop, raycasting logic, and rendering.
- Raycaster.layout – plain‐text map description (2D grid).
- Makefile.win, Raycaster.dev – Windows build scripts/IDE project.
- Raycaster.exe, raycaster.o – compiled binary and object.
- README.md – documentation.
- No subfolders: all code lives in one module. Configuration and build scripts are separate.

##### README for additional insights
- Core subsystems mentioned: map loading, player control (move/rotate/strafe), collision detection, raycasting, basic shading, GLUT render loop.
- Tech stack: C99, OpenGL (GLUT), no external engines.

##### Elements
- Blue rectangles – core modules (Raycasting Engine, Game State)
- Green rectangles – external libraries (GLUT/OpenGL)

##### Detail without overthinking
- Break the raycasting engine into its sub-steps for clarity.
- Distinguish initialization sequence from the per-frame loop.
- Optionally, show the build process at the bottom: compiler → linker → Raycaster.exe, to fully capture the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Initialization"
        Bootstrap["Bootstrap & Initialization"]:::core
        MapLoader["Map Loader"]:::core
        DataStore["Raycaster.layout"]:::data
        GameState["Game State"]:::core
    end

    subgraph "Main Loop"
        InputMgr["Input Manager"]:::core
        subgraph "Raycasting Engine"
            RayEngine["Raycasting Engine"]:::core
            RayGen["Ray Generator"]:::core
            Collision["Collision Detector"]:::core
            DistShade["Distance & Shading Calculator"]:::core
        end
        Renderer["Renderer"]:::core
    end

    ExternalLib["External Libraries & OS"]:::ext

    subgraph "Build & Docs"
        Build["Build Scripts / IDE Project"]:::ext
        Compiler["Compiler & Linker"]:::process
        Artifacts["Compiled Artifacts"]:::data
        Docs["Documentation"]:::data
    end

    Bootstrap --> MapLoader
    MapLoader --> GameState
    Bootstrap -->|"initialize GLUT"| ExternalLib
    ExternalLib -->|"enter Main Loop"| InputMgr
    InputMgr -->|"updates Game State"| GameState
    GameState -->|"frame data"| RayEngine
    RayEngine --> RayGen
    RayGen --> Collision
    Collision --> DistShade
    DistShade --> Renderer
    Renderer -->|"OpenGL draw calls"| ExternalLib
    Build --> Compiler
    Compiler --> Artifacts

    click Bootstrap "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click MapLoader "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click DataStore "https://github.com/addisions/raycaster/blob/main/Raycaster.layout"
    click InputMgr "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click GameState "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click RayEngine "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click RayGen "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click Collision "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click DistShade "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click Renderer "https://github.com/addisions/raycaster/blob/main/raycaster.c"
    click ExternalLib "https://github.com/addisions/raycaster/blob/main/Makefile.win"
    click ExternalLib "https://github.com/addisions/raycaster/blob/main/Raycaster.dev"
    click Build "https://github.com/addisions/raycaster/blob/main/Makefile.win"
    click Build "https://github.com/addisions/raycaster/blob/main/Raycaster.dev"
    click Artifacts "https://github.com/addisions/raycaster/blob/main/Raycaster.exe"
    click Artifacts "https://github.com/addisions/raycaster/blob/main/raycaster.o"
    click Docs "https://github.com/addisions/raycaster/blob/main/README.md"

    classDef core fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef ext fill:#d4edda,stroke:#333,stroke-width:1px;
    classDef data fill:#fff3cd,stroke:#333,stroke-width:1px;
    classDef process fill:#f8d7da,stroke:#333,stroke-width:1px;
```
