Blueprint or Struct for Game Items

Hi Guys,

I have a bunch of items right now and i implement them Item blueprint class derives from actor class. But i saw so many times, people on forums(and most of the inventory tutorials) making items with structs. I am using bp’s in all over my project but i don’t know structs features over bp’s and don’t know how structs works generally.

So, at this point i confused.
Should i implement items with blueprint or structs?
Edit: Or should i add item_struct as variable in my blueprint class?

(assume that i have too many items and i am using hierarchy that derives all of my equipments(sword,armor), my materials(wood,ore), consumables(potions,water,foods) from main Item blueprint class)

Thank you :slight_smile:

This is a fairly common question and there are an ungodly number of ways to do it. Here is one of example of a fully implemented RPG that you can search through the C++ source to find out how he/they handle items. An old school way to do this is through a “data base” MySQL style (but I’d recommend using a DataTable for it) where you have ItemID, ItemName, ItemDescription, ItemValue, ItemWeight, ItemMaxStack, ItemType. Literally every possible property for every time of item. This uses some extra memory, because even if one type doesn’t use some form of information…you’re still storing it. For example, if you have weapons then all items will have a DamageAmount variable. Even though it sounds like a lot of wasted memory, it is still quite common even today. There used to be large posts on GameDev.net on this subject as well, so you could possible find more information there. Hope this helps.

Edit: I just noticed you were asking directly about blueprints vs structs. I’ll leave my above answer, but it is primarily C++ based. For blueprint vs structs, I’d go with a blueprint derived from UObject. This way you can use polymorphism to create each item type and store only the required information for that type. Remind me not to answer questions right after waking up, haha.

hahahah :)))
Thanks for the extra answer, that s really good information and i’ve been confused with storing items in unreal engine all the time. Yeah , i choose bps for polymorphism too.

Thanks again:) have a nice day :slight_smile:

If you could, just click the little check mark by my answer so others know this has been answered. Hope everything works out :slight_smile: