Designing tables for storing various requirements and stats for multiplayer game

后端 未结 13 1350
感情败类
感情败类 2021-01-30 00:41

Original Question:

Hello,

I am creating very simple hobby project - browser based multiplayer game. I am stuck at designing tables for storing information abou

13条回答
  •  無奈伤痛
    2021-01-30 01:10

    If i was designing a database for such a situation, i might do something like this:

    Quest
        [quest properties like name and description]
        reqItemsID
        reqSkillsID
        reqPlayerTypesID
    RequiredItems
        ID
        item
    RequiredSkills
        ID
        skill
    RequiredPlayerTypes
        ID
        type
    

    In this, the ID's map to the respective tables then you retrieve all entries under that ID to get the list of required items, skills, what have you. If you allow dynamic creation of items then you should have a mapping to another table that contains all possible items.

    Another thing to keep in mind is normalization. There's a long article here but i've condensed the first three levels into the following more or less:

    • first normal form means that there are no database entries where a specific field has more than one item in it
    • second normal form means that if you have a composite primary key all other fields are fully dependent on the entire key not just parts of it in each table
    • third normal is where you have no non-key fields that are dependent on other non-key fields in any table

    [Disclaimer: i have very little experience with SQL databases, and am new to this field. I just hope i'm of help.]

提交回复
热议问题