Inventory Discussion: Object Items vs. Actor Items

I realize that this thread is a few month old by now but man that’s one bad advice, if I ever heard one…
So let me put my 2 cents in there:

As always in programming there’s usually not the one solution for everything and a few things to consider.
If you want to use and object or an actor depends a lot on the game (or inventory) you want to make.
E.g for most single player shooter, Actors should be fine. (Similar to the shootergame example). If you have an RPG with a big inventory, you may want to consider objects, though since they are not that performance heavy. There are probably a few optimizations to be done for unused actors but I guess a simple UObject or struct will always be better. Add network replication and it will only get worse for actors and at that point you may want to consider splitting your items up a little bit.
Personally I like to have my static data in DataAssets that are simply referenced by the Item, otherwise you’ll end up with hundreds of M4s all with the same firerate, max ammo, spread values etc copied everywhere (and with that lots of wasted memory)
Now if you have a e.g. crafting system that allows to craft items with some kind of quality these stats may be different from item to item, so there could still be the need to actually do that for some values. You could always calculate the actual values from the base dataAsset and some quality value but I’d say, just save them in your item and be done with it.
And last but not least, you probably want to have different actors for pickup items anyway. They will most likely not need a skeletal mesh like some weapon or usable device might need and instead can just use a static representation.

In Conclusion, I’d say the bigger and more elaborate the gamedesign the more it makes sense to split all that stuff up. Have DataAssets for static data, item-objects for the inventory items, and actor for pickups-items and anything that the player can equip. But don’t overdo it from the start (always keep Yagni in mind^^)

4 Likes