# Proper Inventory Implementation

**URL:** <https://forums.unrealengine.com/t/proper-inventory-implementation/2112939>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [November 9, 2024, 3:26pm UTC](https://forums.unrealengine.com/t/proper-inventory-implementation/2112939 "2024-11-09T15:26:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OMFGSAM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMFGSAM](https://forums.unrealengine.com/u/OMFGSAM)\
**Post date:** [November 9, 2024, 3:26pm UTC](https://forums.unrealengine.com/t/proper-inventory-implementation/2112939/1 "2024-11-09T15:26:47Z")

</div>

Hello Everyone,

I am developing my new game and by basis of it is a complex inventory system that is combination of Arma 3 inventory system with resident evil’s tetris inventory system. What my question is, I want to know if my implementation is correct. I am a web dev for 7 years so I know about programming and OOP basics, but I was wondering if there is a better solution to this.

**FUNCTIONALITY:**

To build a tetris like system, I followed [this video](https://www.youtube.com/watch?v=sFGl-WNpGZM) to build the tetris system, then I build the other inventory section, such as if I get close to objects on the ground they will autopopulate the list of the other inventory section, that can either be world, a character or a treasure.

Next is to implement functionality of equipment and changing inventory tetris grid whether I select backpack, vest or clothes inventory option.

 ![Desktop Screenshot 2024.11.09 - 18.27.09.84](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/5/c8583cec89a4929e71b81ae9196f54dec4e62ab9.png)

My question is regarding the implementation of this system. I am currently relying heavily on DataTables and Structs and they sometimes cause me alot of pain. Most of the time, rather than doing something new, I am putting out fires. I will now talk about implementation.

**IMPLEMENTATION:**

First, to have items in real world, I have actors:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/5/c/b5c08f3b8f441bf0f51707ec566db4d3a13753fc.png)

\_Item is the parent Item object. it is being used to move items around so I wont be redoing it again and again. All \_Item does is setMaterial, and ModifyQuantity which is common among all the Items. Now to the important part. It also has a variable called ST\_Item. ST\_Item is the heart of the Inventory. a Struct that basically is basis for all the items in the inventory. Problem is, I am not sure about its implementation.

ST\_Item struct:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/b/b/cbbed66c2847721b236edae2d8ec78c8bd7f41e9.png)

if you are wondering why am I defining all the structs of each item type in the ST Item, thats basically it, I dont know how to handle this apart from this way. Everywhere, I am using ItemType to check what Struct would I need to use.

This is causing its own problems. For example, a vest and backpack can have their own ST Items, but it wont let me do that and keep saying variable is invalid, so I had to create a copy of ST\_Item without Vest and Backpack Struct, meaning I cannot have those in my inventory themselves hurting the flexibility of my inventory system.

Backpack struct:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/d/f6d6ede244d52eded603cf26abdca0c23d36e2fb.png)

Modular ST\_Item struct:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/4/63493ebcc017fa96b9821b2f50e242acfc75f726.png)

Now, when I am going to implement the Equipment section, I would need Struct for each of the different items, Torch, Compass, Map and Radio. SImilar to ST\_Item, I would need to define them in EquipmentStruct. I wanted to know if this is the correct approach and if there is no other way to do this properly.

I am from JS background so It sees a bit weird to me to work with OOP, but any suggestion would be great. Thank you!
