Skip to content

Base Components

Overview

The Base Components are the foundational ActorComponents that attach to core Unreal actors (GameMode, GameState, Pawn, PlayerState, PlayerController) and provide shared behavior for the ModularInventoryPlus plugin. They handle initialization order (e.g. waiting for PlayerState), save/load integration, and a consistent base for client vs server controller components.

Key traits:

  • UMIPBasePawnComponent – Lives on the Pawn; broadcasts when the component is "ready" (PlayerState valid). Other pawn components use OnPawnComponentReadyDelegate to run logic after the controller/state are set.
  • UMIPBaseSaveableComponent – Implements ISaveableLoadableObjectInterface and ISaveIdentifierInterface; integrates with the save system and supports deferred execution via IMIPWithPendingFunctionsInterface until PlayerState is ready.
  • UMIPBasePlayerControllerComponent – Base for all PC components; supports bClientOnly, provides GetMIPPC() and GetClassTag(). Inherits from a chat base component.
  • UMIPBaseGameModeComponent / UMIPBaseGameStateComponent – Thin bases for GameMode and GameState; GameMode component hooks PostLogin/Logout for server save flow.
  • UMIPBasePlayerLevelBasedFeatureComponent – Saveable feature that runs server RPC actions with optional action progress bar, required/blocked tags, and DoThisFeature override.

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPBasePawnComponent Public/BaseComponents/MIPBasePawnComponent.h
UMIPBaseGameModeComponent Public/BaseComponents/MIPBaseGameModeComponent.h
UMIPBaseGameStateComponent Public/BaseComponents/MIPBaseGameStateComponent.h
UMIPBasePlayerStateComponent Public/BaseComponents/MIPBasePlayerStateComponent.h
UMIPBaseSaveableComponent Public/BaseComponents/AutoSave/MIPBaseSaveableComponent.h
UMIPBasePlayerControllerComponent Public/BaseComponents/Player/MIPBasePlayerControllerComponent.h
UMIPClientPlayerControllerComponent Public/BaseComponents/Player/MIPClientPlayerControllerComponent.h
UMIPBasePlayerLevelBasedFeatureComponent Public/BaseComponents/Player/LevelFeature/MIPBasePlayerLevelBasedFeatureComponent.h

Component Hierarchy (attachment)

AGameModeBase
└── UMIPBaseGameModeComponent          (e.g. for save iteration)

AGameStateBase
└── UMIPBaseGameStateComponent        (minimal base)

APawn (player pawn)
└── UMIPBasePawnComponent             → OnPawnComponentReadyDelegate when PlayerState valid

APlayerState
└── UMIPBasePlayerStateComponent     → GetPlayerPawn(), GetPC(), GetOwnerPS()
└── UMIPBaseSaveableComponent         → Save identifier, accessibility tag, LoadThisUObject, MarkComponentForSave

APlayerController
└── UMIPBasePlayerControllerComponent (base; abstract)
    ├── UMIPClientPlayerControllerComponent   (client-only branch)
    └── [Server-side PC components extend base]

UMIPBaseSaveableComponent (on Pawn/PS/PC as needed)
└── UMIPBasePlayerLevelBasedFeatureComponent  → TryDoThisFeature, ServerDoThisFeature, action progress bar

UMIPBasePawnComponent

  • Attachment: Pawn (player).
  • Delegates: OnPawnComponentReadyDelegate – broadcast when PlayerState is valid and component is ready.
  • Helpers: GetPC(), GetPS(), GetOwnerPawn(), GetPawnComponentReady(), HasAuthority().
  • Blueprint events: OnPawnComponentReady, BindDelegates, OnPlayerStateValid. Listens to controller change to set up delegates when the pawn receives a controller.

UMIPBaseSaveableComponent

  • Interfaces: ISaveableLoadableObjectInterface (LoadThisUObject, LoadThisUObjectFromJsonObject), ISaveIdentifierInterface (GetSaveIdentifier, GetListIdentifier), IMIPWithPendingFunctionsInterface (GetWithPendingFunctionsObject).
  • Delegates: OnSaveableComponentLoadedDelegate, OnSaveableComponentPostLoadedDelegate.
  • Config: UniqueSaveIdentifier (FGameplayTag), AccessibilityTag (e.g. Character vs Family), DatabaseVersion / FileVersion for migration.
  • Helpers: GetPC(), GetGM(), GetServerSaveComponent(), MarkComponentForSave(), GetAccessibilityTag(). Use PendingFunctionsObject and InvokeAllPendingFunctions() to defer work until after PlayerState is ready (see class comment for Client RPC ordering).

UMIPBasePlayerControllerComponent

  • Attachment: PlayerController.
  • Properties: bClientOnly – if true, component only exists on client.
  • Helpers: GetClassTag(), GetMIPPC().
  • Blueprint events: ClientBeginPlay. Base for load/save, inventory, and other PC-scoped components.

UMIPBaseGameModeComponent

  • Attachment: GameMode.
  • Flow: BeginPlayBindDelegates; on PostLogin adds the player to server logic (e.g. save handler); on Logout runs cleanup/save.
  • Override points: OnGameModePostLoginEvent, OnGameModeLogoutEvent.

UMIPBasePlayerLevelBasedFeatureComponent

  • Base: UMIPBaseSaveableComponent.
  • Flow: TryDoThisFeature(InTag) → optional action progress bar → ServerDoThisFeatureDoThisFeature (BlueprintNativeEvent). Pre-checks: ApplyBeforeDoThisFeature, CanDoThisFeature; tags: RequiredTags, BlockedTags, ActionProgressBarTag.
  • Helpers: GetActionProgressBarInfo(), GetActionProgressBarDuration(). Uses UMIPActionProgressBarSettings for progress bar config.

Integration

  • Save system uses UMIPBaseSaveableComponent for all persistable components (save ID, accessibility, load/save callbacks).
  • Pawn components that need PlayerState wait on UMIPBasePawnComponent::OnPawnComponentReadyDelegate.
  • Server save flow is driven by UMIPBaseGameModeComponent (PostLogin/Logout) and the server save component that extends it.