# pardcode/cpp-3d-game-tutorial-series architecture

> Architecture diagram of the GitHub repository pardcode/cpp-3d-game-tutorial-series, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pardcode/cpp-3d-game-tutorial-series
- Repository: https://github.com/pardcode/cpp-3d-game-tutorial-series

## Overview

- Game System / Entity Management – Represent modules such as CXGame, CXEntity, and derived classes (e.g., CameraEntity, MeshEntity, LightEntity). These components handle game logic, entity creation, and event callbacks.
- Graphics Engine – Highlight components managing rendering including CXGraphicsEngine, CXShader, CXSwapChain, constant buffers, vertex/index buffers, and the use of DirectX 11. Also include shaders found in the assets directory (HLSL files) as key parts.
- Resource Management – Include components found under Resource (CXResourceManager, CXMaterial, CXMesh, CXTexture, etc.) that load and manage game assets.
- Windowing System – Represent the CXWindow module that encapsulates native windows and event handling.
- Math Utilities – Indicate modules in the Math directory (e.g., CXVec2, CXVec3, CXMat4) that are used across the engine for transformations and calculations.
- Samples / Example Projects – Show that the framework is extended with sample projects (SpaceShooterGame, EmptyProject) which depend on the framework libraries (illustrating the separation between framework core and applications built using it).

##### Relationships and Interactions
- The Game System uses input from the Input Manager and data from the Resource Manager.
- The Windowing System provides the rendering context and handles system events that propagate to the Input Manager.
- That the Resource Manager loads assets (shaders, textures, meshes) from the assets folder and feeds into the Graphics Engine and Game System.

##### Architectural Patterns and Design Principles
- Modular separation seen in the file structure, suggesting a loosely coupled design—each major subsystem (Game, Graphics, Input, Resource, Window) being a distinct component.
- Event-based logic in the Game System (with callbacks like onCreate and onUpdate) and the use of templating to create and manage entities.
- That the project is designed with low-level control in mind, which is why every component has its own dedicated directory and API.

##### Relevant Technologies and Frameworks
- C++ 17 – Emphasize that the project uses modern C++ standards.
- DirectX 11 – Mark this as the graphics API powering the rendering engine.
- Visual Studio Build Tools – Since the project includes Visual Studio solution files (.sln, .vcxproj) use this to underscore the development environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Engine"
        direction TB
        subgraph "Graphics Engine"
            direction TB
            GEHeader["Graphics Headers"]:::engine
            GESource["Graphics Sources"]:::engine
            GEShaders["Shaders"]:::engine
        end
        subgraph "Input Manager"
            direction TB
            IMHeader["Input Header"]:::engine
            IMSource["Input Source"]:::engine
        end
        subgraph "Resource Management"
            direction TB
            RMHeader["Resource Headers"]:::engine
            RMSource["Resource Sources"]:::engine
        end
        subgraph "Windowing System"
            direction TB
            WSHeader["Window Header"]:::engine
            WSSource["Window Source"]:::engine
        end
        subgraph "Math Utilities"
            direction TB
            MU["Math Headers"]:::util
        end
    end

    subgraph "Game System / Entity Management"
        direction TB
        GSHeader["Game Headers"]:::game
        GSSource["Game Sources"]:::game
    end

    subgraph "Sample Projects"
        direction TB
        EP["Empty Project"]:::sample
        SSG["Space Shooter Game"]:::sample
    end

    subgraph "Technologies"
        direction TB
        DX["DirectX 11"]:::tech
        HLSL["HLSL"]:::tech
        CPP["C++ 17"]:::tech
    end

    %% Relationships
    WSHeader -->|"events"| IMHeader
    IMHeader -->|"input"| GSHeader
    GSHeader -->|"drawCalls"| GEHeader
    RMHeader -->|"assets"| GEHeader
    RMHeader -->|"gameResources"| GSHeader
    MU -->|"math"| GSHeader
    MU -->|"math"| GEHeader
    GEHeader -->|"uses"| GEShaders
    EP -->|"uses"| GSHeader
    EP -->|"uses"| GEHeader
    SSG -->|"uses"| GSHeader
    SSG -->|"uses"| GEHeader
    GEHeader -->|"DirectX11"| DX
    GEShaders -->|"writtenin"| HLSL

    %% Click Events for Game System / Entity Management
    click GSHeader "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/include/CX3D/Game"
    click GSSource "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/source/CX3D/Game"

    %% Click Events for Graphics Engine
    click GEHeader "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/include/CX3D/Graphics"
    click GESource "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/source/CX3D/Graphics"
    click GEShaders "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/assets/Shaders"

    %% Click Events for Input Manager
    click IMHeader "https://github.com/pardcode/cpp-3d-game-tutorial-series/blob/master/CX3D/include/CX3D/Input/CXInputManager.h"
    click IMSource "https://github.com/pardcode/cpp-3d-game-tutorial-series/blob/master/CX3D/source/CX3D/Input/CXInputManager.cpp"

    %% Click Events for Resource Management
    click RMHeader "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/include/CX3D/Resource"
    click RMSource "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/source/CX3D/Resource"

    %% Click Events for Windowing System
    click WSHeader "https://github.com/pardcode/cpp-3d-game-tutorial-series/blob/master/CX3D/include/CX3D/Window/CXWindow.h"
    click WSSource "https://github.com/pardcode/cpp-3d-game-tutorial-series/blob/master/CX3D/source/CX3D/Window/CXWindow.cpp"

    %% Click Event for Math Utilities
    click MU "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/CX3D/include/CX3D/Math"

    %% Click Events for Sample Projects
    click EP "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/Samples/EmptyProject"
    click SSG "https://github.com/pardcode/cpp-3d-game-tutorial-series/tree/master/Samples/SpaceShooterGame"

    %% Styles
    classDef engine fill:#f9f,stroke:#333,stroke-width:2px
    classDef game fill:#ccf,stroke:#333,stroke-width:2px
    classDef sample fill:#cfc,stroke:#333,stroke-width:2px
    classDef util fill:#ffc,stroke:#333,stroke-width:2px
    classDef tech fill:#dff,stroke:#333,stroke-width:2px
```
