# heartlessld/ue4_protobuf architecture

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

- Interactive diagram: https://gitdiagram.com/heartlessld/ue4_protobuf
- Repository: https://github.com/heartlessld/ue4_protobuf

## Overview

##### Project type and purpose
- This is an Unreal Engine 4 (UE4) plugin project (“UE4_Protobuf”) providing a simple integration of Google Protobuf into a UE4 game module.
- The README succinctly states “ue4 google protobuf simple plugin,” confirming that the core purpose is to allow `.proto`–based message serialization/deserialization in a UE4 environment.

##### File structure
- Top-level:
– Config: UE4 ini files for editor, engine and game settings.
– Content: Unreal assets (.umap, .uasset) used by the game.
– Plugins/Protobuf: the Protobuf integration plugin.
– Source/UE4_Proto: the game module that consumes Protobuf messages.
– UE4_Proto.uproject: the UE4 project descriptor.
- Plugins/Protobuf substructure:
– Protobuf.uplugin: plugin descriptor.
– Source/Protobuf: C++ wrapper code exposing Protobuf functionality to UE4.
– ThirdParty/include + lib: the full Google Protobuf C++ library and headers.
- Source/UE4_Proto:
– Build targets (.Target.cs files) for runtime and editor.
– Private/Public folders for game code (MyActor, GameModeBase).
– proto folder containing both `.proto` definitions and generated `.pb.cc/.pb.h` files.
- Build scripts:
– `*.Build.cs` files in both plugin and module manage include paths and link the Protobuf libraries.

##### README for additional insights
- No further architecture details beyond “simple plugin,” but the file tree reveals a two-component architecture: the standalone Protobuf plugin and the UE4 game module that uses it.

##### Elements
– Clear labels for each component (e.g., “Protobuf Plugin,” “UE4_Proto Module,” “Third-party Protobuf Lib”).
- From UE4 Engine → Plugin load
- From Plugin wrapper → Third-party library
- From Game Module → Plugin APIs
- From `.proto` files → generated `.pb.cc/.pb.h` → game code
- Orange/gray for third-party libraries

##### Detail without over-splitting
- Distinct layer (Engine, Plugin interface, 3rd-party lib, game module, assets/config).
- Avoid unnecessary micro-components; group related source files under their appropriate module.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UE4 Host Layer
    subgraph "UE4 Host" 
        direction TB
        UE4Engine["UE4 Engine"]:::host
        UE4Editor["UE4 Editor"]:::host
        UE4Project["UE4_Proto.uproject"]:::host
    end

    %% Config & Content Assets
    subgraph "Config & Content" 
        direction TB
        ConfigEditor["DefaultEditor.ini"]:::assets
        ConfigEngine["DefaultEngine.ini"]:::assets
        ConfigGame["DefaultGame.ini"]:::assets
        Map["NewMap.umap"]:::assets
        AssetData["NewMap_BuiltData.uasset"]:::assets
    end

    %% Protobuf Plugin Module
    subgraph "Protobuf Plugin" 
        direction TB
        PluginDesc["Protobuf.uplugin"]:::plugin
        PluginBuild["Protobuf.Build.cs"]:::plugin
        ProtobufH["Protobuf.h"]:::plugin
        ProtobufCpp["Protobuf.cpp"]:::plugin
        subgraph "Third-Party Protobuf" 
            direction TB
            ThirdPartyHeaders["include/google/protobuf/*"]:::thirdparty
            ThirdPartyLib["libprotobuf*.lib"]:::thirdparty
        end
    end

    %% Game Module UE4_Proto
    subgraph "Game Module: UE4_Proto" 
        direction TB
        subgraph "Build Targets" 
            direction TB
            TargetGame["UE4_Proto.Target.cs"]:::gamemodule
            TargetEditor["UE4_ProtoEditor.Target.cs"]:::gamemodule
        end
        BuildGame["UE4_Proto.Build.cs"]:::gamemodule
        subgraph "Public Interface" 
            direction TB
            PubMyActor["MyActor.h"]:::gamemodule
            PubModuleH["UE4_Proto.h"]:::gamemodule
        end
        subgraph "Private Logic" 
            direction TB
            PrivMyActorCpp["MyActor.cpp"]:::gamemodule
            PrivModuleCpp["UE4_Proto.cpp"]:::gamemodule
            PrivGMBaseCpp["UE4_ProtoGameModeBase.cpp"]:::gamemodule
            PrivGMBaseH["UE4_ProtoGameModeBase.h"]:::gamemodule
        end
        subgraph "Proto Definitions & Generated" 
            direction TB
            ProtoDef["test.proto"]:::gamemodule
            ProtoH["test.pb.h"]:::gamemodule
            ProtoCpp["test.pb.cc"]:::gamemodule
        end
    end

    %% Build & Runtime Flows
    UE4Engine --> UE4Project
    UE4Editor --> UE4Project
    UE4Engine --> PluginDesc
    UE4Editor --> PluginDesc
    PluginDesc --> PluginBuild
    PluginBuild --> ThirdPartyHeaders
    PluginBuild --> ThirdPartyLib
    BuildGame --> PluginBuild
    BuildGame --> UE4Engine
    ProtoDef --> ProtoH
    ProtoDef --> ProtoCpp
    BuildGame --> ProtoDef
    PubMyActor --> ProtobufH
    PrivMyActorCpp --> ProtobufH
    PubModuleH --> ProtobufH

    %% Asset Dependencies
    UE4Engine --> ConfigEditor
    UE4Engine --> ConfigEngine
    UE4Engine --> ConfigGame
    UE4Engine --> Map
    UE4Engine --> AssetData

    %% Click Events
    click UE4Project "https://github.com/heartlessld/ue4_protobuf/blob/main/UE4_Proto.uproject"
    click ConfigEditor "https://github.com/heartlessld/ue4_protobuf/blob/main/Config/DefaultEditor.ini"
    click ConfigEngine "https://github.com/heartlessld/ue4_protobuf/blob/main/Config/DefaultEngine.ini"
    click ConfigGame "https://github.com/heartlessld/ue4_protobuf/blob/main/Config/DefaultGame.ini"
    click Map "https://github.com/heartlessld/ue4_protobuf/blob/main/Content/NewMap.umap"
    click AssetData "https://github.com/heartlessld/ue4_protobuf/blob/main/Content/NewMap_BuiltData.uasset"
    click PluginDesc "https://github.com/heartlessld/ue4_protobuf/blob/main/Plugins/Protobuf/Protobuf.uplugin"
    click PluginBuild "https://github.com/heartlessld/ue4_protobuf/blob/main/Plugins/Protobuf/Source/Protobuf/Protobuf.Build.cs"
    click ProtobufH "https://github.com/heartlessld/ue4_protobuf/blob/main/Plugins/Protobuf/Source/Protobuf/Public/Protobuf.h"
    click ProtobufCpp "https://github.com/heartlessld/ue4_protobuf/blob/main/Plugins/Protobuf/Source/Protobuf/Private/Protobuf.cpp"
    click ThirdPartyHeaders "https://github.com/heartlessld/ue4_protobuf/tree/main/Plugins/Protobuf/ThirdParty/include/google/protobuf/*"
    click ThirdPartyLib "https://github.com/heartlessld/ue4_protobuf/blob/main/Plugins/Protobuf/ThirdParty/lib/libprotobuf*.lib"
    click TargetGame "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto.Target.cs"
    click TargetEditor "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_ProtoEditor.Target.cs"
    click BuildGame "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/UE4_Proto.Build.cs"
    click PubMyActor "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/Public/MyActor.h"
    click PubModuleH "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/Public/UE4_Proto.h"
    click PrivMyActorCpp "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/Private/MyActor.cpp"
    click PrivModuleCpp "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/UE4_Proto.cpp"
    click PrivGMBaseCpp "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/UE4_ProtoGameModeBase.cpp"
    click PrivGMBaseH "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/UE4_ProtoGameModeBase.h"
    click ProtoDef "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/proto/test.proto"
    click ProtoH "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/proto/test.pb.h"
    click ProtoCpp "https://github.com/heartlessld/ue4_protobuf/blob/main/Source/UE4_Proto/proto/test.pb.cc"

    %% Styles
    classDef host fill:#e3f2fd,stroke:#2196f3,color:#0d47a1,stroke-width:2px;
    classDef plugin fill:#e8f5e9,stroke:#4caf50,color:#1b5e20,stroke-width:2px;
    classDef thirdparty fill:#f3e5f5,stroke:#9c27b0,color:#4a148c,stroke-width:2px,stroke-dasharray: 5 5;
    classDef gamemodule fill:#fff3e0,stroke:#fb8c00,color:#e65100,stroke-width:2px;
    classDef assets fill:#eceff1,stroke:#607d8b,color:#263238,stroke-width:2px,stroke-dasharray: 2 2;
```
