Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/121208651351461888
edited tags
Link
Jesse Dorsey
  • 2.9k
  • 4
  • 34
  • 59
Formatting, spelling, layout, changed title into a question.
Source Link

Storing How do I store Items in MySQL?

i'mI'm working to my first game containing items ( buildbuilt a small one before, strategy type but not very complicated  ). I was thinking something like this for the db design since it will be almost the same items in each shop i'm. I'm thinking of connecting the shop to user items ( notnot sure if you understand what i'm thinking of  ): shopname shopNameId, shopName shopCategory shopCategoryId, shopNameId shopCategoryName, shopItems shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

shopname
  shopNameId, shopName
shopCategory
 shopCategoryId, shopNameId shopCategoryName,
shopItems
 shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now; oneHandedWeapons oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ... otherAttributes,

oneHandedWeapons
 oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ...

oneHandedExtendedAttributes oneHandedExtendId, oneHandedWeaponId, ... otherAttritubesotherAttributes,

oneHandedExtendedAttributes
 oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types. This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no? I was thinking on a structure like this for a stash based on 10 slots. userStash userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10 now

userStash
userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10

now on each on slot i can insert the id of that item.

Now my questions:

  1. Is it ok how i did this  ?
  2. Do you see any problems?
  3. Do you have any advicesadvice?
  4. Can you give me another ideea / another example how should iI do this part  ?

Storing Items in MySQL

i'm working to my first game containing items ( build a small one before strategy type but not very complicated  ). I was thinking something like this for the db design since it will be almost the same items in each shop i'm thinking connecting the shop to user items ( not sure if you understand what i'm thinking of  ): shopname shopNameId, shopName shopCategory shopCategoryId, shopNameId shopCategoryName, shopItems shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now; oneHandedWeapons oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ... otherAttributes,

oneHandedExtendedAttributes oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types. This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no? I was thinking on a structure like this for a stash based on 10 slots. userStash userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10 now on each on slot i can insert the id of that item.

Now my questions:

  1. Is it ok how i did this  ?
  2. Do you see any problems?
  3. Do you have any advices?
  4. Can you give me another ideea / another example how should i do this part  ?

How do I store Items in MySQL?

I'm working to my first game containing items (built a small one before, strategy type but not very complicated). I was thinking something like this for the db design since it will be almost the same items in each shop. I'm thinking of connecting the shop to user items (not sure if you understand what i'm thinking of):

shopname
  shopNameId, shopName
shopCategory
 shopCategoryId, shopNameId shopCategoryName,
shopItems
 shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now;

oneHandedWeapons
 oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ...

otherAttributes,

oneHandedExtendedAttributes
 oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types. This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no? I was thinking on a structure like this for a stash based on 10 slots.

userStash
userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10

now on each on slot i can insert the id of that item.

Now my questions:

  1. Is it ok how i did this?
  2. Do you see any problems?
  3. Do you have any advice?
  4. Can you give me another ideea / another example how should I do this part?
Source Link
Bogdan
  • 155
  • 6

Storing Items in MySQL

i'm working to my first game containing items ( build a small one before strategy type but not very complicated ). I was thinking something like this for the db design since it will be almost the same items in each shop i'm thinking connecting the shop to user items ( not sure if you understand what i'm thinking of ): shopname shopNameId, shopName shopCategory shopCategoryId, shopNameId shopCategoryName, shopItems shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now; oneHandedWeapons oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ... otherAttributes,

oneHandedExtendedAttributes oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types. This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no? I was thinking on a structure like this for a stash based on 10 slots. userStash userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10 now on each on slot i can insert the id of that item.

Now my questions:

  1. Is it ok how i did this ?
  2. Do you see any problems?
  3. Do you have any advices?
  4. Can you give me another ideea / another example how should i do this part ?