# foxssake/netfox architecture

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

- Interactive diagram: https://gitdiagram.com/foxssake/netfox
- Repository: https://github.com/foxssake/netfox

## Overview

##### Main Components Structure

a. Core (netfox)
- Network Time Synchronization
- Rollback System
- Property Synchronization
- State Management
- Interpolation System

b. Noray Integration (netfox.noray)
- Connection Management
- Protocol Handling
- Handshake System

c. Extras (netfox.extras)
- Input Management
- Weapon Systems
- State Machine
- Window Management

d. Internals (netfox.internals)
- Logging System
- Ring Buffer
- Set Operations
- Editor Utilities

##### Detailed Component Breakdown

Core Systems Layer:
**[Network Time Synchronizer] → [Network Clock] → [Tick Interpolator]**
- ↓
**[State Synchronizer] ← [Property Cache] → [Property Snapshot]**
- ↓
**[Network Rollback] ← [Rollback Synchronizer]**

Integration Layer:
**[Noray Protocol Handler] → [Packet Handshake]**
- ↓
**[Network Events] → [Network Performance]**

Game Features Layer:
**[Base Net Input] → [Network Weapon System]**
- ↓
**[Rewindable State Machine]**

##### Implementation Details

Technical features:
- Property Path System
- Network Time Management
- State Machine Implementation
- Weapon System Architecture

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef core fill:#2374ab,color:#fff,stroke:#333
    classDef network fill:#32936f,color:#fff,stroke:#333
    classDef utility fill:#706f6f,color:#fff,stroke:#333
    classDef game fill:#f26419,color:#fff,stroke:#333

    %% Core Systems Layer
    subgraph CoreSystems["Core Systems"]
        NTS["Network Time Synchronizer"]
        NC["Network Clock"]
        TI["Tick Interpolator"]
        SS["State Synchronizer"]
        PC["Property Cache"]
        PS["Property Snapshot"]
        NR["Network Rollback"]
        RS["Rollback Synchronizer"]
        NE["Network Events"]
        NP["Network Performance"]
    end

    %% Integration Layer
    subgraph Integration["Noray Integration"]
        NPH["Noray Protocol Handler"]
        PH["Packet Handshake"]
        NCore["Noray Core"]
    end

    %% Game Features Layer
    subgraph GameFeatures["Game Features"]
        BNI["Base Net Input"]
        NWS["Network Weapon System"]
        RSM["Rewindable State Machine"]
        WT["Window Tiler"]
    end

    %% Internals Layer
    subgraph Internals["Internal Utilities"]
        LS["Logging System"]
        RB["Ring Buffer"]
        SO["Set Operations"]
        EU["Editor Utilities"]
    end

    %% Relationships
    NTS --> NC
    NC --> TI
    SS --> PC
    PC --> PS
    NR --> RS
    NPH --> PH
    NPH --> NCore
    BNI --> NWS
    BNI --> RSM

    %% Cross-layer Dependencies
    PC -.-> LS
    NTS -.-> RB
    SS -.-> SO
    NPH -.-> NCore
    NE --> NP

    %% Click Events
    click NTS "https://github.com/foxssake/netfox/blob/main/addons/netfox/network-time-synchronizer.gd"
    click NC "https://github.com/foxssake/netfox/blob/main/addons/netfox/time/network-clocks.gd"
    click NR "https://github.com/foxssake/netfox/blob/main/addons/netfox/rollback/network-rollback.gd"
    click PC "https://github.com/foxssake/netfox/blob/main/addons/netfox/properties/property-cache.gd"
    click SS "https://github.com/foxssake/netfox/blob/main/addons/netfox/state-synchronizer.gd"
    click TI "https://github.com/foxssake/netfox/blob/main/addons/netfox/tick-interpolator.gd"
    click NPH "https://github.com/foxssake/netfox/blob/main/addons/netfox.noray/protocol-handler.gd"
    click PH "https://github.com/foxssake/netfox/blob/main/addons/netfox.noray/packet-handshake.gd"
    click NCore "https://github.com/foxssake/netfox/blob/main/addons/netfox.noray/noray.gd"
    click BNI "https://github.com/foxssake/netfox/blob/main/addons/netfox.extras/base-net-input.gd"
    click NWS "https://github.com/foxssake/netfox/blob/main/addons/netfox.extras/weapon/network-weapon.gd"
    click RSM "https://github.com/foxssake/netfox/blob/main/addons/netfox.extras/state-machine/rewindable-state-machine.gd"
    click WT "https://github.com/foxssake/netfox/blob/main/addons/netfox.extras/window-tiler.gd"
    click LS "https://github.com/foxssake/netfox/blob/main/addons/netfox.internals/logger.gd"
    click RB "https://github.com/foxssake/netfox/blob/main/addons/netfox.internals/ring-buffer.gd"
    click SO "https://github.com/foxssake/netfox/blob/main/addons/netfox.internals/set.gd"
    click EU "https://github.com/foxssake/netfox/blob/main/addons/netfox.internals/editor-utils.gd"
    click NE "https://github.com/foxssake/netfox/blob/main/addons/netfox/network-events.gd"
    click NP "https://github.com/foxssake/netfox/blob/main/addons/netfox/network-performance.gd"

    %% Style Applications
    class NTS,NC,TI,SS,PC,PS,NR,RS core
    class NPH,PH,NCore network
    class LS,RB,SO,EU utility
    class BNI,NWS,RSM,WT game
```
