Author Topic: Need help designing 2DA structure  (Read 352 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need help designing 2DA structure
« on: February 17, 2012, 02:19:50 am »


               Hey, Im considering adding additional material components into default NWN crafting. By default there is only one material component used only for scribing. (With an issue that script destroy full stack instead of 1piece - which brought me there)

So I was thinking, that it would be good feature to allow material component, possible multiple and with specified ammount of stacksize to be used for brewing for example.

Example: Im builder and I want to enhance brewing potions. I will want to use new feature from CPatch that allows me to speficy custom potion resref instead of default potion. However I want to make it harder so I will set up each spell to require one to three herbs of different stacksize.

something like
barkskin (custom potion +5) - belladona 2x
invisibile (custom potion of ii) - belladona 1x + pixie dust 1x

etc.

now, questions are:
1. allow unlimited number of material components? 
- script can do it, 2DA doesnt have to contain all collumns, builder can add new collum when needed, there is probably no disadvantage
2. How to allow specify stacksize?
- new collumn or encode it into resref like "resref|2"
3. How to name the collumns?
- for backwards compatibility the collumn comp_tag used for (first) material component for scribing must stay the same
4. reuse current 2DA or create new one?
- I guess that reusing is better option from 2DA caching reasons

opinions? advices? suggestions?

EDIT: im talking about 2DA des_matcomp which looks like this by default:

2DA V2.0                                                                  
                                                                          
           Label                            InnateLvl   comp_tag          
0          Acid_Fog                         6           **** 
136        Harm                             6           NW_IT_MSMLMISC17


               
               

               


                     Modifié par ShaDoOoW, 17 février 2012 - 02:32 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #1 on: February 17, 2012, 04:18:41 am »


               I think this is tricky as we all have our own ideas about how to customize these sorts of things. I wonder how you could build flexibility into a system like this.

Anyway to the specifics of your questions:
(1) I think considering how the system would be extended is the way to approach this one. Consider a number of ways that different builders would tackle multiple components, and then try to provide for it.
(2) Each column identifies a material property, and the number in the field is the stack size (or weight?)  of items containing that material. Material property list would need to be extended to accomodate.
               
               

               


                     Modifié par henesua, 17 février 2012 - 04:19 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #2 on: February 17, 2012, 06:48:33 am »


               

henesua wrote...

I think this is tricky as we all have our own ideas about how to customize these sorts of things. I wonder how you could build flexibility into a system like this.

Im not sure yet, also because I dont know how others would customized it. But just in case, to clarify (if you understood it and meant the system customization then ignore this) - I dont want to specify any values, by default brewing potions doesnt require material component and I dont want to add them only to provide a feature for builder who would want to.

(2) Each column identifies a material property, and the number in the field is the stack size (or weight?)  of items containing that material. Material property list would need to be extended to accomodate.

interesting idea but denied because I dont want to rely on modifying anything else. This idea would required to modify all default items that could be used as material component as well as modify the iprp_material 2da to allow new values which would have to be in TLK - I cannot afford that.


My working version:

2DA V2.0                                                                  
                                                                          
           Label                            InnateLvl   comp_tag  brew_tag brew2_tag brew3_tag wand_tag
0          Acid_Fog                         6           **** **** **** **** ****
X          Barkskin                          2           **** belladona|2 **** **** ****
X          Invisibility                         2           **** belladona pixiedust **** ****
X          Lightning                          3           **** **** ***** ***** quartzstone
136        Harm                             6           NW_IT_MSMLMISC1 **** **** **** ****

- script could be written to automatically handle also added collumns like: comp2_tag, comp3_tag or wand2_tag etc.
- stacksize of material component higher than 1 needs to be specified with the | delimiter
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #3 on: February 17, 2012, 07:50:40 am »


               

ShaDoOoW wrote...

henesua wrote...
(2) Each column identifies a material property, and the number in the field is the stack size (or weight?)  of items containing that material. Material property list would need to be extended to accomodate.

interesting idea but denied because I dont want to rely on modifying anything else. This idea would required to modify all default items that could be used as material component as well as modify the iprp_material 2da to allow new values which would have to be in TLK - I cannot afford that.


If you use this idea and make a second 2da you could allow for the "OR" possibility.

Example

2DA V2.0

          MATERIAL_TYPE                   DEFAULT             OVERRIDE          SECOND_OPTION           THIRD_OPTION
0   MATERIAL_ELECTRIC            QuartzCrystal        MinerQuartz            ZeusThunderbolt             ****
1   MATERIAL_COLD                     Coldstone             ****                           ****                                      ****
2   MATERIAL_MAGIC_DUST       PixieDust              FaeriePollen           ****                                     ****
3   MATERIAL_FLAME                    AlchemistFire       ****                           FireOpal                            FireBomb


               
               

               


                     Modifié par WhiZard, 17 février 2012 - 07:53 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #4 on: February 17, 2012, 02:56:59 pm »


                 I'd be tempted to avoid using a complete 2da based on the spells list, and instead go with one based on spell level, spell school, range type, and Immunity Type (which gets you the general type of effect it is, if present).

  That way you'd only need 10 rows, it'd still be customizable, and column count would be manageable, though a little larger than your original plan.  Just name the columns exactly what the spells.2da would return for each check, and it would be quite easy to set up.

  Spell level can be innate or based on caster class, that gets you the row to reference.

  "School" returns A, C, D, E, I, N, T, or V - which could be added to "SCHOOL_" for the column to read for the first component.

  "Range" would return P, T, S, M, or L.  Added to "RANGE_", returning a second component.

  "ImmunityType" returns Acid, Cold, Death, Disease, Divine, Electricity, Fear, Fire, Negative, Mind_Affecting, Poison, Positive, or Sonic.  These would work well enough just with the returned type as column labels, giving the third component.

  That would mean 10 rows x 26 columns under this system.  A bit of work still, but I think that would make an interesting, and predictable, system for component use.
 
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #5 on: February 17, 2012, 03:47:17 pm »


               <holding an empty bottle...>

FB, that ties in very nicely with some stuff I want to do with an in-game spell-customizing system. It is non-specific, flexible and potentially very powerful.

I think the only other thing I'd consider is returning a material property rather than a specific component resref, allowing builders to make any potential item that *could* be used for particular spell
.
ex. both charcoal and dragon's blood(red) might contain the material property "MP_FIRE", though the *power* of the property would be determined based "MP_POWER" so that a fireball created with charcoal would be harder to cast and weaker than one cast with dragon's blood(red).

Does that make sense?

And I'm sorry if my "MP" material property gets confused with Bioware's crafting material property, but really, what's a better name for the stuff? :-P

<...of the good stuff, and cursing the dwarf>
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #6 on: February 17, 2012, 04:16:29 pm »


               

Rolo Kipp wrote...
ex. both charcoal and dragon's blood(red) might contain the material property "MP_FIRE", though the *power* of the property would be determined based "MP_POWER" so that a fireball created with charcoal would be harder to cast and weaker than one cast with dragon's blood(red).

Does that make sense?


Sounds like you want a support 2da as shown below for the builders to override.

2DA V2.0

          MATERIAL_TYPE                     DEFAULT             OVERRIDE          SECOND_OPTION     THIRD_OPTION
0   MATERIAL_FLAME_HIGH           Fire Bomb             ****                        DragonBlood                    ****
1   MATERIAL_FLAME_MED          AlchemistFire       ****                        ****                               ****                     
2   MATERIAL_FLAME_LOW            Fire Opal               Charcoal              DragonAle                          ****
3   MATERIAL_MAGIC_DUST_HIGH      Pixie Dust     FaeriePollen        ****                                      ****


               
               

               


                     Modifié par WhiZard, 17 février 2012 - 04:18 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #7 on: February 17, 2012, 10:49:46 pm »


               

Rolo Kipp wrote...

And I'm sorry if my "MP" material
property gets confused with Bioware's crafting material property, but
really, what's a better name for the stuff? :-P

Im not sure if I follow. This thread is about Bioware crafting. Scribing, brewing and wand crafting. The material components are used in order to create these items. I dont want to add materal components required for spellcasting (yet).

I see so you guys would want to make a system that allows different components to be used to create the item. Thats quite difficult to build as that would also required to allow new feature to craft different items based on this.

I understand the gain, yet I would like to create something very easy to use. This does look very complex.

Different components can be done also via tag. In my working version all I check is material component tag. That can be the same for green dragon blood and red dragon blood. Question is how to enable to create two different items AND how to choose which blood if PC has both in inventory - we cannot know his intents whether he want to create a wand of fireball lvl 5 or 10. (Same problem with Whizard's OR approach)

I dont want to build something "as much global as possible", rather something that can be easily expanded to do what builder wants to.
               
               

               


                     Modifié par ShaDoOoW, 17 février 2012 - 10:53 .
                     
                  


            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #8 on: February 18, 2012, 02:09:18 am »


               Well I done some work I think that a little along this lines, you need a holder. In a upcoming crafting update I going to give the pc a crafting bag (you could use a placable or something else though and have the pc put the items in it. That how you would know which blood they want to use. I would use a custom 2da too, but you could use the standard with some modification with collums of amounts. I have a test module set up already that check for amounts and product and could easily hook it into a 2da. So would be easy to update and edit. Is this more a long the lines you looking for or am I off base like everyone eles? hehe
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #9 on: February 18, 2012, 02:09:59 am »


               

ShaDoOoW wrote...

Rolo Kipp wrote...

And I'm sorry if my "MP" material
property gets confused with Bioware's crafting material property, but
really, what's a better name for the stuff? :-P

Im not sure if I follow. This thread is about Bioware crafting. Scribing, brewing and wand crafting. The material components are used in order to create these items. I dont want to add materal components required for spellcasting (yet).

I see so you guys would want to make a system that allows different components to be used to create the item. Thats quite difficult to build as that would also required to allow new feature to craft different items based on this.

I understand the gain, yet I would like to create something very easy to use. This does look very complex.

Different components can be done also via tag. In my working version all I check is material component tag. That can be the same for green dragon blood and red dragon blood. Question is how to enable to create two different items AND how to choose which blood if PC has both in inventory - we cannot know his intents whether he want to create a wand of fireball lvl 5 or 10. (Same problem with Whizard's OR approach)

I dont want to build something "as much global as possible", rather something that can be easily expanded to do what builder wants to.


You could have a reagents bag which you would stick the components you want to use into.  Then by chat dialogue select what you want to make.  But again we are thinking in the big development rather than a quick add-on.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need help designing 2DA structure
« Reply #10 on: February 18, 2012, 03:01:39 am »


               bag would solved it and made different choices possible, but that would be probably too much far from my idea, its really good concept but it doesnt suit to my plan, what I want is to make a system that can be used within default NWN resources

thanks for suggestions though, now I guess that I have shaped my idea to the specific solution
               
               

               


                     Modifié par ShaDoOoW, 18 février 2012 - 03:02 .