Creating a database for a basic game
Posted: Thu Jan 05, 2023 7:05 am
I'm creating a database for a basic web game.
To isolate my issue, assume there are two tables that reference each other as seen below.
The issue is with the inventory column, which is used to store numerous ids from the Item database. First and foremost, I'm not sure if holding several id values in a single column is a smart design approach. Alternately, split into three tables as follows:
Now that Inventory is no longer a column, it may have numerous ids, but how do I associate this collection of inventory data with a certain player? This website that if I want to have numerous 'daggers' in my inventory, I need to add a field to the inventory table. Is that right?
Each player, as in other RPG games, has their own inventory where they may keep their things and conduct the following actions.
To isolate my issue, assume there are two tables that reference each other as seen below.
Code: Select all
Player ( p_id, p_name, inventory(multiple i_id) )
Item ( i_id, i_name )
Code: Select all
Player ( p_id, p_name )
Item ( i_id, i_name )
Inventory ( i_id )
Each player, as in other RPG games, has their own inventory where they may keep their things and conduct the following actions.