Object Management Subsystem ‐ Technical Specification - wwestlake/Steamforge GitHub Wiki

Object Management Subsystem - Technical Specification

Overview

The Object Management Subsystem is a centralized system responsible for managing all game objects (excluding NPCs). It provides functionality to spawn, track, save, and load objects in the game world and inventories. This system is implemented as a UGameInstanceSubsystem and extended in Blueprints.


Key Concepts

1. ObjectDescriptor

Defines a blueprint or template for instantiating an object.

struct FObjectDescriptor {
  FName DescriptorID;
  FText DisplayName;
  FText Description;
  TSubclassOf<AActor> ActorClass;
  UStaticMesh* Mesh;
  UTexture2D* Icon;
  FGameplayTagContainer Tags;
};

2. ObjectEntity

An in-world or inventory instance of an object.

struct FObjectEntity {
  FGuid InstanceID;
  FName DescriptorID;
  FTransform Transform;
  EObjectState State; // Placed, Inventory, Dropped
};

3. EObjectState

enum class EObjectState : uint8 {
  Placed,
  Inventory,
  Dropped
};

4. InventoryComponent

A component that allows an actor to hold items.

struct FInventorySlot {
  FName DescriptorID;
  int32 Quantity;
};

class UInventoryComponent : public UActorComponent {
  TArray<FInventorySlot> InventorySlots;
};

5. LootGeneratorComponent

Simulates loot drops from destructible objects.

struct FLootSlot {
  FName DescriptorID;
  float DropChance;
  int32 MinCount;
  int32 MaxCount;
};

class ULootGeneratorComponent : public UActorComponent {
  TArray<FLootSlot> LootTable;
};

Crafting System

Crafting Recipe Definition Table

Defines metadata and result for each recipe.

Column Type Description
RecipeID FName Unique identifier for the recipe
DisplayName FText Name shown in UI
Description FText UI description
CraftingStationTag GameplayTag Tag required to craft (e.g. Campfire)
CategoryTags GameplayTagContainer UI category filters
OutputItemDescriptorID FName ID of resulting item descriptor
OutputQuantity int32 Number of items produced

Crafting Ingredients Table

Links ingredients to recipes.

Column Type Description
RecipeID FName Links to recipe in definition table
ObjectDescriptorID FName Required item descriptor ID
Quantity int32 Quantity of the item required

Responsibilities

Object Management System

  • Load all ObjectDescriptors at game start.
  • Spawn ObjectEntity instances in the world or into inventories.
  • Track object state and location.
  • Handle save/load functionality.

Inventory

  • Maintain items and quantities.
  • Accept items from drops.
  • Communicate with Object Management System on item acquisition and removal.

Loot Generator

  • Drop items on destruction.
  • Communicate drops to Object Management System.

Crafting

  • Check inventory for ingredients.
  • Consume ingredients.
  • Create output item and notify Object Management System.

This specification defines the baseline for implementing an extensible and modular object and inventory system integrated with the world state.

⚠️ **GitHub.com Fallback** ⚠️