# mklabs/ue4-targetsystemplugin architecture

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

- Interactive diagram: https://gitdiagram.com/mklabs/ue4-targetsystemplugin
- Repository: https://github.com/mklabs/ue4-targetsystemplugin

## Overview

##### Project type and purpose
- This is an Unreal Engine 5 plugin (TargetSystem) written in C++ that implements a Dark-Souls–style camera lock-on/targeting system.
- It ships with its own code module, configuration files, Blueprint-exposed hooks, and sample Content (Blueprints, Maps, UI, Meshes, Materials).

##### File structure
- Top-level:
- .github/workflows → CI pipelines for Windows/Linux and release automation
- LICENSE, readme.md
- TargetSystem/TargetSystem.uplugin → Unreal plugin descriptor
- TargetSystem/Config → DefaultInput.ini, FilterPlugin.ini (engine ini overrides)
- TargetSystem/Content → Example assets (Blueprints, Meshes, Animations, Maps, UI widgets)
- TargetSystem/Source/TargetSystem → C++ module
- Private → implementation (.cpp)
- Public → API headers (.h)
- TargetSystem.Build.cs → build configuration

##### Key insights from README
- Plugin registers an ActorComponent (TargetSystemComponent) you attach to your character.
- Exposes Blueprint-overrideable functions/events.
- Relies on engine systems: Pawn/Actor querying, Line-of-Sight traces, Input bindings, UMG widget for lock-on indicator.

a. Engine Host
– UE5 Core Systems: Input Subsystem, Actor/Component System, Rendering, Physics, UMG
– Plugin Manager (loads .uplugin descriptor & module)
b. TargetSystem Plugin Module (C++ code)
– Module Initialization (register component, register input actions)
– TargetSystemComponent
- Input handling (BindAxis/BindAction)
- Target acquisition logic (closest pawn, distance checks, LOS checks)
- Camera rotation control
- Exposed Blueprint hooks (OnLockedOn, OnLockedOff)
– Targetable Interface (IP) for custom actors
– Logging subsystem (TargetSystemLog)
c. Configuration
– INI files override default thresholds (min/max distances, input mappings)
d. Content Assets
– Example Blueprints (BP_TargetSystemTestGameMode, Character)
– Example Input Mapping Context (IMC_Default.uasset)
– UI Widget (WBP_LockOn)
– Meshes, Materials, Animations used in example
e. External Dependencies
– Unreal Engine subsystems listed above

##### Relationships and interactions
- Engine → Plugin Loader reads TargetSystem.uplugin → loads C++ module
- Module Startup → Registers TargetSystemComponent type with engine
- Game Author places TargetSystemComponent on Pawn
- Engine Input Subsystem → On user input → invokes component’s input callbacks
- Component logic → queries World for Pawns implementing TargetableInterface → applies LOS trace via Physics → selects target
- Blueprint event bindings → UI or game logic responds to lock/unlock

##### Architectural patterns and design principles
- Modular plugin architecture (Unreal’s module/plugin pattern)
- Component-based design (ActorComponent extension)
- Interface-driven targeting (Targetable Interface for extensibility)
- Data-driven configuration (INI overrides + Blueprint parameters)
- Separation of concerns: Input handling, targeting logic, camera control, UI rendering

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Engine Host
    subgraph "UE5 Core Engine" 
        direction TB
        InputSubsystem["Input Subsystem"]:::engine
        ActorSystem["Actor/Component System"]:::engine
        Physics["Physics"]:::engine
        Rendering["Rendering"]:::engine
        UMG["UMG"]:::engine
    end

    PluginLoader["Plugin Loader"]:::engine
    UE5Start["UE5 Startup"]:::engine

    UE5Start -->|"Loads Plugins"| PluginLoader
    PluginLoader -->|"Reads TargetSystem.uplugin"| PluginDescriptor
    click PluginDescriptor "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/TargetSystem.uplugin"

    %% Plugin Module
    subgraph "TargetSystem Plugin Module (C++)"
        direction TB
        ModuleBuild["TargetSystem.Build.cs"]:::code
        click ModuleBuild "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/TargetSystem.Build.cs"
        ModuleEntry["TargetSystem.cpp"]:::code
        click ModuleEntry "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Private/TargetSystem.cpp"
        ModuleInit["Module Initialization"]:::code

        TargetSystemComponent["TargetSystemComponent"]:::code
        click TargetSystemComponent "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Public/TargetSystemComponent.h"
        click TargetSystemComponent "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Private/TargetSystemComponent.cpp"

        TargetableInterface["ITargetable Interface"]:::code
        click TargetableInterface "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Public/TargetSystemTargetableInterface.h"
        click TargetableInterface "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Private/TargetSystemTargetableInterface.cpp"

        LoggingSubsystem["TargetSystemLog"]:::code
        click LoggingSubsystem "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Public/TargetSystemLog.h"
        click LoggingSubsystem "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Source/TargetSystem/Private/TargetSystemLog.cpp"
    end

    PluginDescriptor --> ModuleBuild
    ModuleBuild --> ModuleEntry --> ModuleInit
    ModuleInit -->|"Register Component"| TargetSystemComponent
    ModuleInit -->|"Register Interface"| TargetableInterface
    ModuleInit -->|"Initialize Logging"| LoggingSubsystem

    %% Configuration
    subgraph "Configuration (INI Files)"
        direction TB
        DefaultInput["DefaultInput.ini"]:::config
        click DefaultInput "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Config/DefaultInput.ini"
        FilterPlugin["FilterPlugin.ini"]:::config
        click FilterPlugin "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Config/FilterPlugin.ini"
    end

    %% Content Assets
    subgraph "Content Assets (uasset)"
        direction TB
        BPGameMode["BP_TargetSystemTestGameMode.uasset"]:::asset
        click BPGameMode "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/BP_TargetSystemTestGameMode.uasset"
        BPCharacter["BP_TargetSystem_Character.uasset"]:::asset
        click BPCharacter "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/BP_TargetSystem_Character.uasset"
        Map1["TargetSystemTestMap.umap"]:::asset
        click Map1 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Maps/TargetSystemTestMap.umap"
        Map2["TargetSystemTest_SplitScreen_Map.umap"]:::asset
        click Map2 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Maps/TargetSystemTest_SplitScreen_Map.umap"
        IMC["IMC_Default.uasset"]:::asset
        click IMC "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/Input/IMC_Default.uasset"
        IA1["IA_LockOn.uasset"]:::asset
        click IA1 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/Input/Actions/IA_LockOn.uasset"
        IA2["IA_Move.uasset"]:::asset
        click IA2 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/Input/Actions/IA_Move.uasset"
        IA3["IA_Look.uasset"]:::asset
        click IA3 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/Input/Actions/IA_Look.uasset"
        IA4["IA_Jump.uasset"]:::asset
        click IA4 "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/Example/Input/Actions/IA_Jump.uasset"
        Widget["WBP_LockOn.uasset"]:::asset
        click Widget "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/UI/WBP_LockOn.uasset"
        Icon["LockOnIcon.uasset"]:::asset
        click Icon "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/TargetSystem/Content/UI/Assets/LockOnIcon.uasset"
        Resources["Resources (Icons/Metadata)"]:::asset
        click Resources "https://github.com/mklabs/ue4-targetsystemplugin/tree/main/TargetSystem/Resources"
    end

    %% Dependencies
    EngineSubsystems[/"Engine Subsystems"/]:::engine
    EngineSubsystems --> InputSubsystem
    EngineSubsystems --> ActorSystem
    EngineSubsystems --> Physics
    EngineSubsystems --> UMG

    %% Runtime Flow
    InputSubsystem -->|"BindInput"| TargetSystemComponent
    ActorSystem --> TargetSystemComponent
    TargetSystemComponent -->|"LineTrace"| Physics
    Physics -->|"Returns Hit"| TargetSystemComponent
    TargetSystemComponent -->|"SetViewRotation"| Rendering
    TargetSystemComponent -->|"Update Widget"| UMG
    TargetSystemComponent -->|"Emit OnLockedOn/Off"| BlueprintEvents
    BlueprintEvents((Blueprint Events)):::asset

    %% Config usage
    DefaultInput -->|"Overrides Thresholds & Mappings"| TargetSystemComponent
    FilterPlugin -->|"Filters Plugin Settings"| TargetSystemComponent

    %% Content usage
    BPGameMode -->|"Spawn Pawn with Component"| TargetSystemComponent
    BPCharacter --> TargetSystemComponent
    IMC -->|"Provides Input Mapping"| InputSubsystem
    Widget --> UMG
    Icon --> Widget

    %% CI Pipelines
    subgraph "CI Pipelines (.github/workflows)"
        direction TB
        PRLinux["pr-linux.yml"]:::config
        click PRLinux "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/.github/workflows/pr-linux.yml"
        PRWindows["pr-windows.yml"]:::config
        click PRWindows "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/.github/workflows/pr-windows.yml"
        ReleaseCI["release.yml"]:::config
        click ReleaseCI "https://github.com/mklabs/ue4-targetsystemplugin/blob/main/.github/workflows/release.yml"
    end

    %% Styles
    classDef engine fill:#dddddd,stroke:#888888,color:#333333;
    classDef code fill:#e0f7fa,stroke:#006064,color:#004d40;
    classDef config fill:#e8f5e9,stroke:#2e7d32,color:#1b5e20;
    classDef asset fill:#fff3e0,stroke:#ef6c00,color:#e65100;
```
