0

I am creating a game and need to think of an underlying datamodel to use in a SQL database, running on InnoDB engine.

The main entities will be accounts, slots and characters. Every account has minimal one slot, possibly many more. And each slot can hold one character, but does not always have a character.

More information:

  • Players will log into the game using the accounts.
  • As time progresses they get more (character slots), starting off with one slot.
  • In every slot they can put a character which may die at some point. If there is no character placed yet or a character is dead, then at that given time the slot will be empty.
  • A player can control the characters individually, while being logged in through the main account.

Structure without relations:

  • accounts (accountId, ...account data)
  • slots (accountId, slotId, ...slot data)
  • characters (characterId, ...character data)

Simple relations:

  • account_slots (accountId, slotId)
  • slots_characters (accountId, slotId, characterId)

Notes:

  • accountId will be a unique key to accounts.
  • slotId will not be a unique key to slots, it will be a number 1..maximum, however (accountId, slotId) will be unique.
  • characterId will be a unique key to characters.

Do you think this is a correct model, even though it still needs ot be finetuned?

Now I want to add the correct relations between the tables with as few relations as possible, if a relation can be captured by adding a column to a table, then it should be done.

Regards.

skiwi
  • 66,971
  • 31
  • 131
  • 216
  • 1
    Can you provide an example of what these represent and what will be done with them? – Hart CO Jul 01 '13 at 19:53
  • @GoatCO I've provded more information, I hope that's the information you were looking for. – skiwi Jul 01 '13 at 19:58
  • slots could be an int attribute of account just update as needed. character could be directly related to an account - the owner of the character. – T I Jul 01 '13 at 20:00
  • @TI Sorry that I haven't mentioned it this explicitely, but slots will have additional data aswell so cannot put them somewhere else, they are really their own entity. – skiwi Jul 01 '13 at 20:01
  • 1
    The model looks fine, except that there doesn't appear to a need actually implement account_slot() physically, since you already have account_id in slot. – Darius X. Jul 01 '13 at 20:35

0 Answers0