Hi folks,
I’m coding for an RPG system and I’m unsure what data I should put in which table. currently I have 2 tables, one for character statistics (appearance, age, pros/cons, etc.) that almost never change, and one for ability details (ability name, how to test, further details).
there will be one table that links the ability table with the character table (adding the ability value for the character.
and my question now is, where should I place the character data that change on a regular basis (like experience points, equipment, etc.)? I could put it in the character table, but that is already quite packed ...
any ideas are appreciated.
Dormi
[MongoDB] RPG DB Design
Page 1 of 13 Replies - 1392 Views - Last Post: 23 September 2013 - 07:25 AM
Replies To: [MongoDB] RPG DB Design
#2
Re: [MongoDB] RPG DB Design
Posted 23 September 2013 - 05:04 AM
You could put the information in a character_data table that is in a one-to-one relationship with the character table (the character_id is a primary key in both tables).
When you create a new character (in the character table) you could also insert a new (initially empty) row in the character_data table. Otherwise, you would have to keep using the equivalent of INSERT ON DUPLICATE UPDATE all over the shop, when adding/updating character-data.
When you create a new character (in the character table) you could also insert a new (initially empty) row in the character_data table. Otherwise, you would have to keep using the equivalent of INSERT ON DUPLICATE UPDATE all over the shop, when adding/updating character-data.
This post has been edited by andrewsw: 23 September 2013 - 05:08 AM
#3
Re: [MongoDB] RPG DB Design
Posted 23 September 2013 - 05:05 AM
yea, I guess it will end up like that.
#4
Re: [MongoDB] RPG DB Design
Posted 23 September 2013 - 07:25 AM
extended question: should I use nested documents or rather merge multiple tables?
(note that I can only update one at a time)
i.e.
vs.
(note that I can only update one at a time)
i.e.
var charTalentSchema = new Schema({ talentid: { type: IDREF, required: true }, wert: { type: Number, required: true, min: -3, max: 35 }, Spezialisierungen: [String] }); var charDataSchema = new Schema({ charid: IDREF, SF: { Kampf: [String], Manöver: [String], allgemein: [String], magisch: [String], geweiht: [String] } AP: { alle: { type: Number, min: 0, required: true }, frei: { type: Number, required: true } }, Talente: { Kampf: [charTalentSchema], körperlich: [charTalentSchema], Gesellschaft: [charTalentSchema], Natur: [charTalentSchema], Wissen: [charTalentSchema], Handwerk: [charTalentSchema], Sprachen: [charTalentSchema], Schriften: [charTalentSchema], Meta: [charTalentSchema] } });
vs.
var charDataSchema = new Schema({ charid: IDREF, SF: { Kampf: [String], Manöver: [String], allgemein: [String], magisch: [String], geweiht: [String] } AP: { alle: { type: Number, min: 0, required: true }, frei: { type: Number, required: true } } }); var charTalentSchema = new Schema({ charid: IDREF, talentid: IDREF, wert: { type: Number, min: -3, max: 35 }, spezialisierungen: [String] });
Page 1 of 1