I'm working on my inventory system, and it's split into two parts: the actual data, which is all that exists of an item 90% of the time, is a struct with nothing more than an ID number and a count. Accessory to that struct is a much more comprehensive class, AItemObject, which contains the item's name, description, pointers to the desired static mesh and sprites to display it in menus or in-game, and the code to handle the player attempting to pick it up off of the ground. In theory, the idea is to save memory by only looking up desired data from an AItemObject at need, and making do with the ItemStruct the rest of the time.
Where I'm having trouble is figuring out how Unreal intends developers to store data outside of memory. The most rudimentary possible approach would be to make a class AItemDatabase which simply has an array of AItemObject, but that would result in the game always retaining one instance of every single item in the game loaded in memory, which is heinously wasteful. Storing data in excell and importing it as a CSV seems like another common option, but I would really like to retain the ability to edit my item database in the editor, so I could manually assign whatever mesh references and enums I end up needing.
So is there a third option I'm not seeing? It doesn't seem like storing and retrieving objects by index would be that hard, but I'm not seeing many obvious options.
Where I'm having trouble is figuring out how Unreal intends developers to store data outside of memory. The most rudimentary possible approach would be to make a class AItemDatabase which simply has an array of AItemObject, but that would result in the game always retaining one instance of every single item in the game loaded in memory, which is heinously wasteful. Storing data in excell and importing it as a CSV seems like another common option, but I would really like to retain the ability to edit my item database in the editor, so I could manually assign whatever mesh references and enums I end up needing.
So is there a third option I'm not seeing? It doesn't seem like storing and retrieving objects by index would be that hard, but I'm not seeing many obvious options.
Comment