Blueprint or Struct for Game Items
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?
Thank you :)
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here