Brian W Posted November 17, 2008 Share Posted November 17, 2008 I play a home made table top RPG with a few friends. The game is still in child hood stages of development but I am trying to get a few more things stable with our online resources. The project I would like to tackle at the moment is stores. I have items, weapons, armor, ect. to put into the store, but I'm not sure what the best way is to tack the stuff into the store as inventory Stores will have anywhere from a few items to hundreds of items. I will be creating store fronts that have individual stock, so I need it to be pretty simple to add and remove inventory. I don't need this done for me, just would like some help with the structure. Any input appreciated, thanks. Quote Link to comment Share on other sites More sharing options...
btherl Posted November 17, 2008 Share Posted November 17, 2008 Here's a standard database style structure Table "items" Column 1: Integer identifier "item_id" Column 2: Text item name "item_name" Column 3: Enum item type "item_type" Column 4: Integer item value "item_value" (or could be floating point) You might want to add additional item attributes to that table like damage, charges, wearable locations, and so on. Table "stores" Column 1: Integer identifier "store_id" Column 2: Text store name "store_name" And additional store attributes in that table, but NOT the items .. Table "store_inventory" Column 1: Integer identifier "store_id" Column 2: Integer identifier "item_id" Column 3: Integer item count "inventory_count" This table has one row for each item that a store has in stock. Does that makes sense? An item's identifying characteristics go in the "items" table. A store's identifying characteristics go in the "stores" table. Then a third table links stores and items to provide inventory information. Quote Link to comment Share on other sites More sharing options...
Brian W Posted November 17, 2008 Author Share Posted November 17, 2008 That makes since and that was how I was thinking I'd end up doing it, but I was just wondering if there was a better route. But I guess that probably is the very best way to do it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.