Download

A few advanced questions...

I have a few questions. I’m pretty far in my game, and I’m approaching systems that have to tie in together. I’ve learned by a combination of video tutorials, and taking projects from the marketplace apart and learning that way. I have reached pretty far, but a few of these issues are not so much stumping me as much as it is me not knowing the best approach. I’ll start with my inventory system. Before I get too far ahead of myself, my game has a small online co-op component. You can also craft modular weapons and build your own structures.

  1. I am trying to organize the inventory system best I can while trying to keep it efficient. In every example I can think of while writing this, the inventory item structures have been overbloated, I feel? The item structures contain every variable that any item that could possibly be in the inventory were in the single structure (A). Here is what I am thinking, and I got the idea from using the linking structure for inventory items in The Elder Scrolls Online. When you link an item, it’s an array of items in a single bracket. So I am thinking about designing the inventory system in a similar way. It’s all reduced down to numbers that break into the defined components. This would mean I would either have to have a structure for each item type(B), or simply an array of integers/bytes(C). Probably integers since a lot of the data may end up as an array, but saving it as bytes - - I could keep the customization options in the structure as enumerations for the bytes to translate into.

1st digit: Item type. This is actually to determine which data table to draw the number from.
2nd digit: index to the appropriate item when looking up the data table. From here, we gather relevant data such as mesh type, and anything else.
Remaining digits: Allows customization for the more modular items, including composition.

Seeing it typed up, I could even make a structure with the first two integers being separate and the rest of them being an array of integers so it saves on having to parse the array before being able to pull up the rest of the information.

A) So would it be better to have a structure of the solid shared components housed, with the unused components remaining blank?

B) Have each structure defined for each item type, and then the inventory component can keep an array of each structure. However, to organize it all into one: The inventory component’s exposure to the user could simply be two integers: the first to the appropriate structure type, the second the index in the inventory array for that structure.

C) Would the integer method be too intensive because it has to translate the numbers into final data?

So what are your thoughts on this? I’ll edit this or add another post with the next question. One issue at a time, haha. Also, I am using the Gameplay Ability System, if that makes any difference. Thank you for your time and consideration in your assistance with this matter.