I'm making a game and in that game there are different types of items (weapons, armor, potions, etc.) each type has different statistics that need to be stored in a database.
I was thinking of making a "weapons" table, an "armor" table and etc. but struggle to think of a good way to relate them all.
To display a list of all items to the player it would be easy to just hardcode a select query of every table and aggregate somehow in the code afterwards, but what design patterns / options are there for storing what items the player would have in his inventory.
The only thing I could think of is to have a table which would hold an ID which would correlate to an item type / table. In that way I could store a player inventory's data in the database as key value pairs, for example ( "24, 3", "54, 1" ) which, let's say for the sake of the example would translate as item with ID "24" in table with ID "3", which would be "potions", etc.
However I feel like this can be improved and is ineffective.
I plan to use EF Core for the game.
So, let's say I have 3 item types: weapons, armor and potions. They have the following properties:
weapon - weight, cost, damage, damageType, minStr
armor - weight, cost, armorPoints, bodySlot, hardness
potion - cost, type, effect, effectAmount