# heavenlode/hlnc architecture

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

- Interactive diagram: https://gitdiagram.com/heavenlode/hlnc
- Repository: https://github.com/heavenlode/hlnc

## Overview

Core Architecture Components:

##### Network Core Layer
- NetworkRunner (Central coordinator)
- NetworkNode3D (Base networked object)
- NetworkProperty (Property synchronization)
- WorldRunner (Multiple world management)

##### Serialization Layer
- HLBuffer (Buffer management)
- HLBytes (Byte serialization)
- Custom Serializers
- DespawnSerializer
- NetworkPropertiesSerializer
- SpawnSerializer
- State Serializers

##### Utility Components
- NetworkTransform
- NetworkAnimationPlayer
- NetworkVisibility
- TickTimer

##### -on Systems
- Blastoff System
- Lazy Loading System
- Questing System

**┌─────────────────────────────────────────────────┐**
- Game Layer                     │
- ┬───────────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────┐**
- NetworkRunner                     │
- (Tick Management & Network Coordination)       │
- ┬─────────────────┬──────────────────┬───┘
- ↓                 ↓                  ↓
**┌───────────────┐ ┌──────────────┐ ┌────────────────┐**
- NetworkNode3D │ │Serialization │ │    Add-ons     │
- System     │ │    Layer     │ │    System      │
- ┬───────┘ └──────┬───────┘ └────────┬───────┘
- ↓                ↓                   ↓

##### Data Flow Representation
- Tick-based synchronization flow
- Server-client communication
- Property synchronization paths

##### Detailed Component Breakdown
**NetworkRunner**
- Tick Management
- State Authority
- Input Authority
- World Management

**Serialization Layer**
- Buffer Management
- Byte Serialization
- Custom Serializers

**NetworkNode3D**
- Property Sync
- Network Identity
- Authority Management

##### Key Features to Highlight
- Tick-aligned system
- Single state authority (server)
- Input authority
- Data interpolation
- Interest management
- Multiple world support

##### Connection Points
- Integration with Godot engine
- UDP packet management
- Property change propagation

##### -on system integration points

Remember to:
- Detailed component relationships
- Clear data flow paths
- Security and performance considerations

This system design should provide a clear understanding of HLNC's architecture while maintaining the necessary technical depth for implementation and maintenance.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph GameLayer["Game Layer"]
        Game[Game Logic]
    end

    subgraph CoreLayer["Network Core Layer"]
        NR[NetworkRunner]:::core
        NN[NetworkNode3D]:::core
        NP[NetworkProperty]:::core
        WR[WorldRunner]:::core
    end

    subgraph SerializationLayer["Serialization Layer"]
        HLB[HLBuffer]:::serialization
        HLBY[HLBytes]:::serialization
        subgraph Serializers["Custom Serializers"]
            DS[DespawnSerializer]:::serialization
            NPS[NetworkPropertiesSerializer]:::serialization
            SS[SpawnSerializer]:::serialization
        end
    end

    subgraph UtilityLayer["Utility Components"]
        NT[NetworkTransform]:::utility
        NAP[NetworkAnimationPlayer]:::utility
        NV[NetworkVisibility]:::utility
        TT[TickTimer]:::utility
    end

    subgraph AddonsLayer["Add-on Systems"]
        BS[Blastoff System]:::addon
        LLS[Lazy Loading System]:::addon
        QS[Questing System]:::addon
    end

    Game --> NR
    NR --> NN
    NR --> WR
    NN --> NP
    
    NR --> HLB
    HLB --> HLBY
    HLBY --> DS
    HLBY --> NPS
    HLBY --> SS
    
    NN --> NT
    NN --> NAP
    NN --> NV
    NR --> TT
    
    NR --> BS
    NR --> LLS
    NR --> QS

    %% Click events for file navigation
    click NR "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/NetworkRunner.cs"
    click NN "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/NetworkNode3D.cs"
    click NP "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/NetworkProperty.cs"
    click WR "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/WorldRunner.cs"
    
    click HLB "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/Serialization/HLBuffer.cs"
    click HLBY "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/Serialization/HLBytes.cs"
    click DS "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/Serialization/Serializers/DespawnSerializer.cs"
    click NPS "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/Serialization/Serializers/NetworkPropertiesSerializer.cs"
    click SS "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Core/Serialization/Serializers/SpawnSerializer.cs"
    
    click NT "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Addons/NetworkTransform/NetworkTransform.cs"
    click NAP "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Addons/NetworkAnimationPlayer/NetworkAnimationPlayer.cs"
    click NV "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Addons/NetworkVisibility/NetworkVisibility.cs"
    click TT "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Addons/TickTimer/TickTimer.cs"
    
    click BS "https://github.com/Heavenlode/HLNC/blob/main/addons/HLNC/Addons/Blastoff/IBlastoffDriver.cs"
    click LLS "https://github.com/Heavenlode/HLNC/tree/main/addons/HLNC/Addons/Lazy"
    click QS "https://github.com/Heavenlode/HLNC/tree/main/addons/HLNC/Addons/Questing"

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef serialization fill:#4CAF50,stroke:#2E7D32,color:white
    classDef utility fill:#FF9800,stroke:#EF6C00,color:white
    classDef addon fill:#9C27B0,stroke:#6A1B9A,color:white

    %% Legend
    subgraph Legend
        C[Core Components]:::core
        S[Serialization Components]:::serialization
        U[Utility Components]:::utility
        A[Add-on Systems]:::addon
    end
```
