# pedropp222/nracer architecture

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

- Interactive diagram: https://gitdiagram.com/pedropp222/nracer
- Repository: https://github.com/pedropp222/nracer

## Overview

##### Project type and purpose
- This is a Unity‐based 3D racing game (Codename “NRacer” / “Decayed Wheels”).
- Purpose: provide players with multiple tracks, vehicles, AI opponents, UI menus, save/load, and custom assets (cars, tracks, shaders).

##### File structure
- Top‐level: Assets/, ProjectSettings/, README.md.
- Assets/ contains subfolders:
- Scripts/NRacer – organized by Controllers, Dados (data models), Debug, GameMode, UI, Vehicle, Save.
- Prefabs/ – reusable GameObjects for cars, environment, UI.
- Scenes/ – gameplay and menu scenes (not enumerated but implied).
- Materials/, Shaders/, Models/, Sounds/ – art & asset pipeline.
- Plugins/, Standard Assets/, TextMesh Pro – third‐party packages.
- Configuration: JogoInputs.inputactions indicates the new Unity Input System.
- No explicit backend or network services—entirely client‐side, component‐based game architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Game Logic Layer
    subgraph "Game Logic" 
        style GameLogicLayer fill:#D0E6FF,stroke:#333,stroke-width:1px
        Controllers["Controllers"]:::logic
        GameMode["GameMode Manager"]:::logic
        AISystem["AI System"]:::logic
        SaveSystem["Save/Load System"]:::logic
        DataModels[(Data Models)]:::logic
        DebugTools["Debug Tools"]:::logic
    end

    %% UI Layer
    UI["UI Layer"]:::ui

    %% Input Layer
    InputAsset["JogoInputs.inputactions"]:::assets
    GestorInputsJogo["GestorInputsJogo.cs"]:::logic

    %% Unity Engine
    subgraph "Unity Engine"
        style EngineLayer fill:#DDDDDD,stroke:#333,stroke-width:1px
        Physics["Physics Engine"]:::engine
        Rendering["Rendering Engine"]:::engine
        Serialization["Serialization"]:::engine
        InputSystemCore["Input System"]:::engine
    end

    %% Asset Repository
    subgraph "Asset Repository"
        style AssetLayer fill:#FFE5B4,stroke:#333,stroke-width:1px
        Prefabs["Prefabs"]:::assets
        Models["Models & CarData & PistaData"]:::assets
        Materials["Materials"]:::assets
        Shaders["Shaders"]:::assets
        Sounds["Sounds"]:::assets
    end

    %% Third-party Packages
    subgraph "Third-party Packages"
        style ThirdPartyLayer fill:#E6E6FA,stroke:#333,stroke-width:1px
        TextMeshPro["TextMesh Pro"]:::third
        StandardAssets["Standard Assets"]:::third
        DOTween["DOTween Settings"]:::third
    end

    %% Relationships
    InputAsset -->|generates bindings| InputSystemCore
    InputSystemCore -->|events| GestorInputsJogo
    GestorInputsJogo -->|player input| Controllers
    Controllers -->|controls| Physics
    Physics -->|collision data| Controllers
    Controllers -->|invokes| AISystem
    AISystem -->|AI commands| Controllers
    Controllers -->|updates| UI
    GameMode -->|manages flow| Controllers
    Controllers -->|serialize state| SaveSystem
    SaveSystem -->|loads data models| DataModels
    DataModels -->|used by| Controllers
    DataModels -->|used by| GameMode
    DataModels -->|used by| SaveSystem
    Prefabs -->|instantiation| Controllers
    Models -->|data assets| DataModels
    Materials -->|render assets| Rendering
    Shaders -->|render assets| Rendering
    Sounds -->|audio assets| Controllers
    TextMeshPro -->|UI text| UI
    StandardAssets -->|utilities| Controllers
    DOTween -->|animations| UI
    Rendering -->|draws| UI
    Serialization -->|save/load| SaveSystem

    %% Click Events
    click Controllers "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/Controllers/"
    click GameMode "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/GameMode/"
    click AISystem "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/Vehicle/AI/"
    click SaveSystem "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/Save/"
    click DataModels "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/Dados/"
    click UI "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/UI/"
    click InputAsset "https://github.com/pedropp222/nracer/blob/main/Assets/JogoInputs.inputactions"
    click GestorInputsJogo "https://github.com/pedropp222/nracer/blob/main/Assets/Scripts/NRacer/Controllers/Input/GestorInputsJogo.cs"
    click Prefabs "https://github.com/pedropp222/nracer/tree/main/Assets/Prefabs/"
    click Models "https://github.com/pedropp222/nracer/tree/main/Assets/CarData/"
    click Models "https://github.com/pedropp222/nracer/tree/main/Assets/PistaData/"
    click Models "https://github.com/pedropp222/nracer/tree/main/Assets/Models/"
    click Materials "https://github.com/pedropp222/nracer/tree/main/Assets/Materials/"
    click Shaders "https://github.com/pedropp222/nracer/tree/main/Assets/Shaders/"
    click Shaders "https://github.com/pedropp222/nracer/tree/main/Assets/Ciconia Studio/Shaders/"
    click Sounds "https://github.com/pedropp222/nracer/tree/main/Assets/Sounds/"
    click DebugTools "https://github.com/pedropp222/nracer/tree/main/Assets/Scripts/NRacer/Debug/"
    click TextMeshPro "https://github.com/pedropp222/nracer/tree/main/Assets/TextMesh Pro/"
    click StandardAssets "https://github.com/pedropp222/nracer/tree/main/Assets/Standard Assets/"
    click DOTween "https://github.com/pedropp222/nracer/blob/main/Assets/Resources/DOTweenSettings.asset"

    %% Styles
    classDef engine fill:#CCCCCC,stroke:#333,stroke-width:1px
    classDef logic fill:#A8CFFF,stroke:#333,stroke-width:1px
    classDef ui fill:#CFFFCF,stroke:#333,stroke-width:1px
    classDef assets fill:#FFD799,stroke:#333,stroke-width:1px
    classDef third fill:#D8BFD8,stroke:#333,stroke-width:1px
```
