Hi, I'm kind of a newbie to the whole 'DataStore' thing, so I have a question.
If I created a game that involves a player inventory (for storing hats, weapons, and other items), how could I save that inventory with DataStore? (for different places in a universe) And if I had character creation, how could I save a player's character(s)?
Thank you, -Nen
As a rewording to eLunate's answer to help you understand:
Represent every "item" in your inventory with a numerical ID Give each item properties or whatever you want, also represented by values
save these values in a table
when you start the game, you just sort through that table and insert those items into the inventory based on the ID and properties of that item; essentially "interpret" the values that you saved.
Once you know what you want to save, saving your stuff is fairly trivial. Serialization works like this: You describe the item you want to save, rather than saving every single bit of data.
In an inventory example, you have to consider how you want to save the Inventory. Is it a bunch of slots? We can use a table to represent that, and each slot can be a new entry. What's in the slot? If it's an item, we have to consider how we can describe that item:
Save all the details you need, but not the actual item. When you load it again, you can use those details to rebuild all of the items in the inventory.