I’m trying to build an “Escape from Tarkov” style inventory to really investigate what I can do with a heavy component centered design while learning UMG system. An inventory like this works in this way I imagine:
(for a backpack)
-Character has an InventoryComponent where the EquipSlots reside. Items are not directly stored here.
-ItemActor has a PickupComponent which is a child of an InteractComponent. This allows you to look for an InteractComponent to determine if something can be Interacted with…ie DoorActor/ItemActor/PlayerActor/ContainerActor all child of AActor…
* PickupComponent wll allow this item to go into an Inventory. Holds all properties related to Inventory; item size, weight, if it’s stackable, etc.*
-ItemActor has an EquipComponent which will show “Equip” action through context menus in the UI and tell InventoryComponent where it should be equipped.
-ItemActor has an ItemStorageComponent which will hold “contents” or references to the ItemActors in inventory.
ItemActor in this case is a very bland class housing only a Name property. You can make many different types of Items by combining different custom UActorComponents.
What I do not like in game systems design, is things like Epic’s implementation of ACharacter and UCharacterMovementComponent. The Character and CharacterMovementComponent are completely coupled and dependent on each other. You cannot use CharacterMovementComponent on anything other than derived classes of ACharacter. Character even has basic “DoCrouch” style logic while the Component itself has the actual Crouch implementation. In my dream world, the MovementComonent would move or crouch the Object without caring what it is. The Object shouldn’t even need to know about the Component. Maybe even receive player input events instead of Input being performed on the Character itself cutting out the need to call events ON CharacterMovement from Character…
An example of this would be “WeaponHandler” component attached to your Character which holds input event for “Reload”. Essentially, a character without a WeaponHandler does not know how to Reload or Shoot a gun.