Answer the question
In order to leave comments, you need to log in
How to store inventory slots in database (MySQL)?
Hello.
There is an inventory system in the game.
The inventory has fields:
InventorySlot container[48];
float capacity;
floatweight;
That is, the inventory has 48 slots as an array of objects of type InventorySlot, capacity (float) and weight (float).
The InventorySlot object has the following fields: int ItemID, int Amount.
Saving capacity and weight in the database is not a problem. But what about slots (an array of objects)?
Answer the question
In order to leave comments, you need to log in
The method is not entirely adequate. The best way is to make a many-to-many table and store it there. Another option is a JSON field and store the desired values there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question