Inventory is the quite frequent thing in video games. They vary from few equipables (Doom like) to complex systems (Like Skyrim) with lots of stats, weight, etc.
But what is the best way to create the inventory?
Obviously, if in your game you only can change current weapon, few variables is enough. But I’m talking about more complicated, universal and flexible system…
I already created inventory using structure array.
Pros: Flexible (possible to change values for any object (for example Condition)). Easy to save. Easy to manage in multiplayer
Cons: If you have few item types that means structure should contain all existing variables for every item. You will have weapons values on your food and vice versa (Main reason I have abandoned it)
Then I created reference array
Pros: Flexible. Quite easy workflow
Cons: More difficult to manage in multiplayer. It worked fine until i get to the moment when I got to save it then load (references don’t like being saved)
I though about something like storing items IDs, but how to get the values of the items?
What inventory storing do you use in your project?