x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 :)

Product Version: UE 4.9
Tags:
more ▼

asked Nov 14 '15 at 12:26 PM in Blueprint Scripting

avatar image

skyechuu
7 6 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Nov 14 '15 at 01:41 PM

avatar image

zacharymwade
554 27 4 25

avatar image skyechuu Nov 14 '15 at 03:39 PM

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 :)

avatar image zacharymwade Nov 14 '15 at 03:54 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question