Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2008
    Posts
    4

    Question about Best Practice...

    I am working on the Schema for an Online video game.

    Among all the DB tables are two specific tables called: heroes and skills.

    The Heroes table will contain the general make of a user's playable character.

    Heroes will be something like:
    hero_id
    hero_name
    hero_level
    hero_type
    ...

    The Skills table will contain the definitions for all possible skills in the game.

    The Skills table will be something like:
    skill_id
    skill_name
    skill_type
    ...

    Every character will have a max of 10 unqiue skill, and then a possible 10 common skills for a constant max of 20 skills per hero.

    Would it be better to Store the hero skill information on the hero table like:
    hero_skill_0, hero_skill_1, hero_skill_2, ..., hero_skill_9
    hero_common_skill_0, hero_common_skill_1, hero_common_skill_2, ..., hero_common_skill_9

    OR

    Have a third table called: HeroSkills which is simply something like:
    hero_skills_id
    hero_id
    skill_id
    skill_level

    I believe that having a 3rd table would be best practice... but my concern is in the 0.000001% chance the game gets big. With a lot of players the HeroSkills table will be 20 times larger then the heroes table, but will also be getting alot more transactions.

    So what do you think.

    Thanks in advance for the help,
    Rich

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    separate table

    here's a simple test: using the 20 numbered columns model, write the sql query that finds all players that have both skills 9 and 37
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2008
    Posts
    4
    Point taken,

    Thanks for the fast reply!

    -Rich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •