Arc Inventory 2.0
Welcome to Arc Inventory 2.0!
Arc Inventory 2.0 is a massive rework of inventory data layout, moving Item Definitions from a inheritance based model to a more data oriented design. Arc Inventory is faster, more flexible, easier to extend than ever before.
The primary feature of Arc Inventory 2.0 is the introduction of the Modular Inventory Component, replacing the old inheritance model. The 1.0 inventory subclasses have become Inventory Processors, which are component-like objects that exist on the Modular Inventory. The 1.0 item definition subclasses have been broken up into Item Fragments, or item subobjects that hold units of data, and can be placed on either an Item Definition or an Item Stack.
Check out the Arc Inventory 1.0 to 2.0 Migration Guide!
Modular Inventory & Item Processors
The hierarchy of Inventory Components in 1.0 has been removed and entirely replaced by the Modular Inventory Component, featuring a number of improvements.
Improved Inventory Events
Arc Inventory 1.0 had a number of events to bind to depending on the class of the Inventory Component. The Modular Inventory now has a single event that can be listened to, providing a centralized handling of reactable inventory events and better replication of events.
Improved Dynamic Attribute Set Handling
Dynamic Attribute Sets in 1.0 were a bit buggy and dangerous to use. Arc Inventory 2.0 fixes a number of issues around them, including clearing Attribute Modifier Aggregators when attribute sets are removed and ensuring no Gameplay Effects apply to any attribute that is being removed. You can now safely use dynamic attribute sets!
The Modular Inventory improves networking performance, making better use of FFastArraySerializer, reducing replication events, and improved subobject handling.
NOTE: Push Model networking is in progress and still unsupported as of the 2.0 release. Expect it shortly!
The hierarchy of inherited Inventory components has been removed, and the functionality of each inventory component has been replaced with the new Inventory Processors. Processors are stateful, replicated subobjects that handle gameplay functionality for the inventory. Processors can create or remove Inventory Slots, Take actions when items are added or removed to slots, and much, much more. Processors can be created in C++ or Blueprint, have a number of overridable events, and can be deeply customized for your game's inventory needs.
Arc Inventory 2.0 ships with all the functionality of the 1.0 inventories as processors:
The Bag Processor creates a list of item slots on the modular inventory, and manages those slot's tags and filters. Similar to the 1.0 Bag Inventory, 2.0 supports multiple bags on one inventory, and dynamically resizable bags!
The Equipment Processor watches a set of item slots on the inventory, and applies Gameplay Abilities, Gameplay Effects, and Attribute Sets to the owning actor when items are placed into those slots, or removed when items are removed.
The Active Processor manages a list of potentially active items, and manages placing Gameplay Abilities, Gameplay Effects, and Attribute Sets onto the owning actor when an item is made active.
Modular Item Stack & Item Stack Fragments
One of the key features of Arc Inventory 2.0, Modular Item Fragments allow for users to store a wide array of data types on item stacks. In 2.0, the hierarchy of Item Definitions and Item Stack classes have been removed and replaced with the Modular Item Stack.
Item Data has been migrated to new Item Stack Fragments, which can be stored on either the Item Stack or in new Modular Item Definitions. Instead of getting the item definition from an item stack and casting it to the proper type, you now simply query for an Item Fragment.
Modular Items now support fully dynamic item data. While this is not recommended in Multiplayer due to the replication cost, you can create custom items entirely from dynamically spawned fragments on an item stack, no Item Definition needed!
Sub Items on an Item Stack can now override data on a parent item stack. Simply include an instance of the same type and tags as a parent item's fragment, and the child's version will be returned in a query instead of the parent's version!
New Item Definitions
Modular Item Stacks make use of a new form of Item Definition, the Modular Item Definition. Modular Item Definitions are Data-Asset derived objects that hold a list of Fragments. Users no longer need to look up the Item Definition to retrieve data from it, as Fragment Queries will access it if it exists.
While the primary method of giving an Item Stack fragments is to use an Item Definition, Modular Item Stacks support adding fragments to an item in a dynamic fashion. Dynamic Fragments are fully replicated and can represent dynamic data on an Item Stack. Dynamic Fragments can override fragments added by an Item Definition, allowing for the creation of custom properties on items.
Additionally, while not recommended in multiplayer, an item can be created entirely out of dynamic fragments! No Item Definition needed!
Item Data is now retrieved via Item Fragment Queries. The Item Stack exposes a number of query methods to retrieve item fragments from a given item stack. Fragment Queries are available in both C++ and Blueprint!
The FindFirstFragment query will return the first fragment it can find from either the Children Items, Dynamic Fragments, or Item Definition in that order! You can use this to override item properties either using dynamic fragments or child items like Perks, Attachments, or Randomized Properties.
Item Stat Tags
Similar to Lyra, Modular Item Stacks now support "Item Stat Tags", or a mapping of Tag=>Int32. These Stat Tags can be used for various properties like Stack Size, Durability, or whatever you need. They are supported in multiplayer and notified using the Modular Inventory's new event system!
Arc Inventory 2.0 ships with a number of built in fragments, but you can create your own in Blueprint or C++ if you need more for your items.
Built in fragments include: * Skeletal Mesh Fragment * Static Mesh Fragment * Text Fragment * Texture Fragment * Item Card Fragment * Ability Fragment * Rarity Fragment * Stackability Fragment
- Added a new UArcItemStackBase base class, used to share functionality between 1.0 UArcItemStack and 2.0 UArcItemStackModular. Almost every base-class Inventory Component function returns and uses UArcItemStackBase
- Added Mutable and Immutable accessors for Item Slots, reducing the need to replicate item slots as often. If you do not need to modify any of the properties of an ItemSlot, accessing it via the const GetItemSlot() function will no longer trigger a replication of the slot.
- Improved removing dynamic attribute sets, fixing crashes related to removing attributes that a gameplay effect is referencing.
- All tags used internally by ArcInventory are now native tags. You no longer need to add any tags to your project to use ArcInventory.
- Improved Active Item Replication in extremely poor network conditions, fixing issues such as 'switch to pending item slot' arriving long after BeginPlay in poor network conditions leading to clients having an invalid active item.
- Properly send notifications when an item is looted but stacks with an item already in the inventory.
- Fixed incorrect inventory events firing after a drag and drop action
ShowDebug Inventory, displaying more useful information and following the HUD's debug target (allowing the debugging of other inventories, not just the currently controlled pawn's)
- Fixed a number of compile errors when Unity builds are off.
- Added an EventTag property to LootItem, allowing users to pass information as to why an item was looted.
Arc Inventory Example
The Inventory Example has been rewritten for Arc Inventory 2.0, and now runs on Unreal Engine 5.0!
You can get it here: https://drive.google.com/file/d/1p3AgfIiSpDTTwt0kQ_2z4odG4h_QSYuN/view?usp=share_link
- Reworked folder structure to be easier to find example content
- Added support for Enhanced Input across the whole example.
- Provided an Enhanced Input extension for Arc Inventory so that active abilities can be bound to Enhanced Input actions.
The Chest and Inventory Manipulation tutorials are not implemented in the new example. Expect them soon!
A huge thank you to Puny Human engineers Mike Z, Steeve, Voltaire, Daniel, and Trikeri for various bug fixes and feature implementations.