# 007havegone/ferraris architecture

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

- Interactive diagram: https://gitdiagram.com/007havegone/ferraris
- Repository: https://github.com/007havegone/ferraris

## Overview

##### Project Type and Purpose
- The README clearly states that Ferraris is a “personal primer Game Engine,” which means it is focused on delivering essential engine mechanics for game development.
- The project includes tools for graphics rendering, content management, and a dedicated editor, indicating both a runtime engine and development environment.

##### File Structure for Architectural Clues
- Top-Level Components:
- “Engine”: Contains the core game engine components including main entry points, core modules, systems for graphics (using Direct3D12), platform abstraction, and utilities.
- “EngineDLL”: Provides DLL wrappers for engine APIs, enabling modular integration or runtime linking.
- “ContentTools”: Likely a set of utilities for editing or managing game content (e.g., geometry and mesh primitives).
- “EngineTest”: Contains test code to validate functionality of engine components like shader compilation, rendering, etc.
- “FerrarisEditor”: A C# (WPF-based) project that acts as a game editor with various subcomponents (editors for geometry, world, assets, etc.), including project templates and a DLL wrapper to interact with the engine.
- Notable Subdirectories and Files:
- Under “Engine/Graphics/Direct3D12”: Detailed source files that clearly encapsulate Direct3D12 rendering specifics (e.g., interface, resources, shaders).
- “Engine/Core”: Contains the entry point (Main.cpp) and overall engine logic.
- “Engine/Components” and “Engine/EngineAPI”: Expose an API-based design for game entities, scripts, and transforms, suggesting an entity-component system (ECS) or similar pattern.
- The presence of multiple project files (.vcxproj for C++ and .csproj for C#) along with solution files (.sln) indicates a multi-project solution with clear separation of engine and editor responsibilities.

a. Main Components:
- Engine Core: Including the common utilities, engine core logic, and entry point.
- Graphics Subsystem: Representing the Direct3D12-based renderer (graphics interface, shaders, resources, and surface management).
- Content Tools: Handling geometry and primitive mesh generation or editing.
- Engine API / Modules: The component API (for entities, transforms, scripts) and DLL interface (EngineDLL) to provide modular access.
- Editor (FerrarisEditor): Which provides a GUI (using WPF) to manage projects, assets, and to invoke the engine's functionalities.
- Test Suite: EngineTest modules that ensure the engine’s features work as expected.
b. Relationships and Interactions:
- The Engine Core interacts directly with the Graphics and Platform components.
- The Engine API exposes functionality to both the runtime game entities and the editor via the DLL wrapper (“DllWrapper”) found in FerrarisEditor.
- The Editor communicates with the engine by invoking the DLL functions, managing projects, and providing editors for specific components (like GeometryEditor, WorldEditor, etc.).
- Content Tools might be used during development inside the editor or as standalone utilities to generate or modify game assets.
- Tests interact with core engine components to validate correct behavior (e.g., shader compilation tests in EngineTest).
c. Architectural Patterns and Design Principles:
- Modular / Layered Architecture: The separation into Engine Core, Graphics, API, and Editor suggests a clear modular approach.
- Entity-Component System: With directories for “Components” and engine API definitions for GameEntity, ScriptComponent, and TransformComponent.
- Abstraction Layers: In the graphics subsystem for Direct3D12, there are helper classes, interface wrappers, and common headers to abstract platform-specific details.
d. Technologies, Frameworks, and Libraries:
- Direct3D12 is the primary graphics technology.
- C++ is used for core engine development, with Visual Studio project files (.vcxproj) indicating a Windows-based development environment.
- C# (with XAML) is used for the editor, which likely uses WPF for its GUI.
- Usage of DLLs for engine modularity suggests an emphasis on dynamic linking and separation of concerns between engine and tools.

## Diagram (Mermaid)

```mermaid
flowchart TD
    EC["Engine Core"]:::engine
    GS["Graphics Subsystem"]:::graphics
    EAPI["Engine API"]:::api
    EDLL["Engine DLL"]:::api
    CT["Content Tools"]:::content
    FE["FerrarisEditor"]:::editor
    ET["EngineTest"]:::test

    EC -->|"calls"| GS
    EC -->|"exposes"| EAPI
    EAPI -->|"wrapped_by"| EDLL
    FE -->|"invokes"| EDLL
    FE -->|"uses"| CT
    ET -->|"validates"| EC

    click EC "https://github.com/007havegone/ferraris/tree/master/Engine/Core"
    click GS "https://github.com/007havegone/ferraris/tree/master/Engine/Graphics/Direct3D12"
    click EAPI "https://github.com/007havegone/ferraris/tree/master/Engine/EngineAPI"
    click EDLL "https://github.com/007havegone/ferraris/tree/master/EngineDLL"
    click CT "https://github.com/007havegone/ferraris/tree/master/ContentTools"
    click FE "https://github.com/007havegone/ferraris/tree/master/FerrarisEditor"
    click ET "https://github.com/007havegone/ferraris/tree/master/EngineTest"

    classDef engine fill:#AED6F1,stroke:#2E86C1,stroke-width:2px;
    classDef graphics fill:#ABEBC6,stroke:#229954,stroke-width:2px;
    classDef api fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef content fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef editor fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef test fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
```
