   Skill System Design And Storage Means
  i was wondering the most common ways to design a skill system in a way that you could easily handle the managing and relations of this in database and code.  the way i currently have my design is like this:Items TableIDNumber  Name   Description    Craftable  1    Silk Shirt  Shirt Of Silk  True2    Silk Cloth  Cloth of Silk  False3    Silk Thread Thread of Silk FalseSkillsRequired  MaterialsRequired  Material1x1,1x2,1x32x2,8x3  FalseTrueTrueSkills TableIDNumber   Name  Description1Tailoring  blahso, basically my skills and materials in relation to my items are in the form of quantityxidnumber and comma delimited.the way i have this set up doesnt allow me to directly create a relationship that would allow me to view, for example, the items that can be crafted using tailoring.the delimiting may be off base, any information or help is appretiated. 
  Well you could do a few things.One thing you might consider doing...Make a materials table (material-id, name), a item table (item-id, name, material-id, description, craftable) and finally a skill table (skill-id, name, description).That should let you do what you want.You can do some neat stuff to compress those ids, like use one bit of the id for a boolean flag for craftability. ;  hmmm, it depends on if you can visual a table in three dimensions. Now the x axis is the item axis, the y axis is the material axis, and z axis is the skill axis.  if you want to find all items that can be made from silk you return any items that have values in the silk column. If you want to know what is need to make a silk shirt you return all items with values in the silk shirt row. If you want to find all the tailoring items you return all items that have values in the tailoring plane.   A B C  A B C0 0 0 00 1 0 01 0 0 01 1 0 02 0 1 12 0 0 0   Tailoring   SpinningA=SilkB=Silk ThreadC=Silk Cloth0=Silk Thread1=Silk Cloth2=Silk ShirtSo looking up the table tells you that to make a silk shirt you need tailoring, 1 silk cloth, and 1 silk thread.To make silk thread you need spinning and 1 silk.make any sense?   -----------------------------------------------------Writer, Programer, Cook, I'm a Jack of all TradesCurrent Design projectChaos Factor Design Document [edited by - TechnoGoth on July 30, 2003 9:00:34 PM];  i followed every bit of that... but, i still dont understand how you could do the actual design based on that. ;  The design shouldn't be difficult, you could store all the data in a three dimensional array. With three sets of enumerated types.   enum cItems {SILK_THREAD=2, SILK_CLOTH=3, SILK_SHIRT=4;}enum cMaterials {SILK=1;}enum cSkills {TAILORING=1, SPINNING=2;}#define TOTALMATERIALS 3#define TOTALITEMS 3#define TOTALSKILLS 2short itemconstruction[TOTALMATERIALS][TOTALITEMS][TOTALSKILLS];all your item construction data would be held in that array. It would probably be easiest to have a data file from which all the item construction data is read. Then you access the array whenever you need that information.    -----------------------------------------------------Writer, Programer, Cook, I'm a Jack of all TradesCurrent Design projectChaos Factor Design Document  [edited by - TechnoGoth on July 30, 2003 10:46:13 PM];  i dont think you understand what im wanting here... this will be large scale...  i wont be hardcoding anything... ;  How big is large scale give me an idea, here are you talking about few hundred records a few thousand? How many skills, items and materials are there?If you know an exact number and its in the hundreds you could use an array. That reads all the data from a file or has it generated at runtime.    Or you could have it read from a random access file as needed. The kinda of design depends on the scope of the project if you give people some idea they maybe able to give you some better feedback.   -----------------------------------------------------Writer, Programer, Cook, I''m a Jack of all TradesCurrent Design projectChaos Factor Design Document ;  thousands of materials and itemshundreds of skills ;  I can''t imagine what kind of project your working on that requires those amounts of skills and items.  I just hope you have a lot of money and personal otherwise your project will never be completed.With that amount of of data your going to need to use a database, which means your going to have to have large access times since eveything will have to be read from the harddrive as needed. I''m not experinced with databases of that size, but you''ll have to construction a data structure. Then populate your database with everything based on the data structure. As for accessing the data any decent database system would allow you to access the data based on any cretria you stipulate such as skill, item, material.I don''t mean to offend you since I have no idea who you are, but unless you have exeperince working with databases of this size I strongly suggest scaling down your project considerably. This is not the kind of undertaking an amature should attempt.   -----------------------------------------------------Writer, Programer, Cook, I''m a Jack of all TradesCurrent Design projectChaos Factor Design Document ;  What you want is a small scale DBMS according to your initial post.The tables I suggested are going to be the logical representation of your data.Now, we have the tables I was talking about.  Materials(material-id, name, desc), Items(item-id, name, desc, craftable*) and finally Skills(skill-id, name, desc).  These are LOGICAL representations.  They''re not implementation.Now, all the *-ids should be 32 bit ints, they''ll be fast and they''re the keys.  Which means they''re unique, there will never be the same id in the one table -- table scope.  Each table will have it''s own seperate implementaiton -- they''ll actually end up being instances of the same class.  I have a * after craftable for a reason, of course.  What you can do is the following, either make two tables, one for craftable and one for non-craftable items or mess with the ids or you can embed the information into the key -- MSB.  I recommend the former.  I think that''ll just be easier and possible even faster.Here are some thoughts on the implementation of the table ADT.It''ll need a some sort of tree, balanced would be best.  You''ll need to setup a sequence generator.  It counts up and down as needed.  You''ll of course have to be able to add and remove items -- remember to trigger a count.  You''re going to have to template this -- unless data types aren''t an issue for your language of choice.  Now just populate it with your data.The thing is now you can perform the relevant queries, the problem is that you''ll need to do a lot of unions to pull out the information you need.   So trade space for computation.  Build up a table representing the relationships.  Assuming you went with the splitting the table for craftable and non-craftable items,   Crafting(item-id, skill-id, material-id)  That should cover it.  If you need things like quantity for the amount of material or skill level needed, then simply add that information.That should cover the major things.  If you''ve taken any DB stuff, you have 3 entities, skill, material, item (aggregate with craftable and non-craftable entities) and a ternary relationship between them of crafting.  Which is basically the crafting.  That''s not perfect, but it''s pretty good at representing what''s going on. 